3 # PNP4Nagios template for check_openmanage
4 # Author: Trond Hasle Amundsen
5 # Contact: t.h.amundsen@usit.uio.no
6 # Website: http://folk.uio.no/trondham/software/check_openmanage.html
9 # Array with different colors
10 $colors = array("0022ff", "22ff22", "ff0000", "00aaaa", "ff00ff",
11 "ffa500", "cc0000", "0000cc", "0080C0", "8080C0",
12 "FF0080", "800080", "688e23", "408080", "808000",
13 "000000", "00FF00", "0080FF", "FF8000", "800000",
16 # Color for power usage in watts
20 $count = 0; # general counter
21 $f = 0; # fan probe counter
22 $t = 0; # temp probe counter
23 $a = 0; # amp probe counter
24 $v = 0; # volt probe counter
25 $e = 0; # enclosure counter
37 $def_title = 'Dell OpenManage';
39 # Loop through the performance data
42 # TEMPERATURES (Celsius)
43 if (preg_match('/^T/', $NAME[$i])) {
44 if ($visited_temp == 0) {
50 $NAME[$i] = preg_replace('/^T(\d+)_(.+)/', 'Probe $1 [$2]', $NAME[$i]);
51 $NAME[$i] = preg_replace('/_/', ' ', $NAME[$i]);
54 $NAME[$i] = preg_replace('/^T(\d+)$/', 'Probe $1', $NAME[$i]);
56 $ds_name[$count] = "Chassis Temperatures";
61 if ($WARN[$i] != "") {
62 $warnThresh = $WARN[$i];
64 if ($CRIT[$i] != "") {
65 $critThresh = $CRIT[$i];
68 $opt[$count] = "--slope-mode --vertical-label \"Celsius\" --title \"$def_title: Chassis Temperatures\" ";
69 if(isset($def[$count])){
70 $def[$count] .= "DEF:var$i=$rrdfile:$DS[$i]:AVERAGE " ;
73 $def[$count] = "DEF:var$i=$rrdfile:$DS[$i]:AVERAGE " ;
75 $def[$count] .= "LINE:var$i#".$colors[$t++].":\"$NAME[$i]\" " ;
76 $def[$count] .= "GPRINT:var$i:LAST:\"%6.0lf C last \" ";
77 $def[$count] .= "GPRINT:var$i:MAX:\"%6.0lf C max \" ";
78 $def[$count] .= "GPRINT:var$i:AVERAGE:\"%6.2lf C avg \\n\" ";
82 if (preg_match('/^W/', $NAME[$i])) {
85 $NAME[$i] = preg_replace('/^W(\d+)_(.+)/', 'Probe $1 [$2]', $NAME[$i]);
86 $NAME[$i] = preg_replace('/_/', ' ', $NAME[$i]);
89 $NAME[$i] = preg_replace('/^W(\d+)$/', 'Probe $1', $NAME[$i]);
92 $ds_name[$count] = "Power Consumption";
95 $title = $ds_name[$count];
97 $opt[$count] = "--slope-mode --vertical-label \"$vlabel\" --title \"$def_title: $title\" ";
99 if(isset($def[$count])){
100 $def[$count] .= "DEF:var$i=$rrdfile:$DS[$i]:AVERAGE " ;
103 $def[$count] = "DEF:var$i=$rrdfile:$DS[$i]:AVERAGE " ;
105 $def[$count] .= "AREA:var$i#$PWRcolor:\"$NAME[$i]\" " ;
106 $def[$count] .= "LINE:var$i#000000: " ;
107 $def[$count] .= "GPRINT:var$i:LAST:\"%6.0lf W last \" ";
108 $def[$count] .= "GPRINT:var$i:MAX:\"%6.0lf W max \" ";
109 $def[$count] .= "GPRINT:var$i:AVERAGE:\"%6.2lf W avg \\n\" ";
113 if (preg_match('/^A/', $NAME[$i])) {
116 $NAME[$i] = preg_replace('/^A(\d+)_(.+)/', 'Probe $1 [$2]', $NAME[$i]);
117 $NAME[$i] = preg_replace('/_/', ' ', $NAME[$i]);
120 $NAME[$i] = preg_replace('/^A(\d+)$/', 'Probe $1', $NAME[$i]);
122 if ($visited_amp == 0) {
126 $ds_name[$count] = "Amperage Probes";
129 $title = $ds_name[$count];
131 $opt[$count] = "-X0 --lower-limit 0 --slope-mode --vertical-label \"$vlabel\" --title \"$def_title: $title\" ";
132 if(isset($def[$count])){
133 $def[$count] .= "DEF:var$i=$rrdfile:$DS[$i]:AVERAGE " ;
136 $def[$count] = "DEF:var$i=$rrdfile:$DS[$i]:AVERAGE " ;
138 $def[$count] .= "LINE:var$i#".$colors[$a].":\"$NAME[$i]\" " ;
139 $def[$count] .= "GPRINT:var$i:LAST:\"%4.2lf A last \" ";
140 $def[$count] .= "GPRINT:var$i:MAX:\"%4.2lf A max \" ";
141 $def[$count] .= "GPRINT:var$i:AVERAGE:\"%4.4lf A avg \\n\" ";
146 if (preg_match('/^V/', $NAME[$i])) {
149 $NAME[$i] = preg_replace('/^V(\d+)_(.+)/', 'Probe $1 [$2]', $NAME[$i]);
150 $NAME[$i] = preg_replace('/_/', ' ', $NAME[$i]);
153 $NAME[$i] = preg_replace('/^V(\d+)$/', 'Probe $1', $NAME[$i]);
155 if ($visited_volt == 0) {
159 $ds_name[$count] = "Voltage Probes";
162 $title = $ds_name[$count];
164 $opt[$count] = "-X0 --lower-limit 0 --slope-mode --vertical-label \"$vlabel\" --title \"$def_title: $title\" ";
165 if(isset($def[$count])){
166 $def[$count] .= "DEF:var$i=$rrdfile:$DS[$i]:AVERAGE " ;
169 $def[$count] = "DEF:var$i=$rrdfile:$DS[$i]:AVERAGE " ;
171 $def[$count] .= "LINE:var$i#".$colors[$v].":\"$NAME[$i]\" " ;
172 $def[$count] .= "GPRINT:var$i:LAST:\"%4.2lf A last \" ";
173 $def[$count] .= "GPRINT:var$i:MAX:\"%4.2lf A max \" ";
174 $def[$count] .= "GPRINT:var$i:AVERAGE:\"%4.4lf A avg \\n\" ";
178 if (preg_match('/^F/', $NAME[$i])) {
179 if ($visited_fan == 0) {
185 $NAME[$i] = preg_replace('/^F(\d+)_(.+)/', 'Probe $1 [$2]', $NAME[$i]);
186 $NAME[$i] = preg_replace('/_/', ' ', $NAME[$i]);
189 $NAME[$i] = preg_replace('/^F(\d+)$/', 'Probe $1', $NAME[$i]);
191 $ds_name[$count] = "Fan Probes";
193 $opt[$count] = "-X0 --slope-mode --vertical-label \"RPMs\" --title \"$def_title: Fan Speeds\" ";
194 if(isset($def[$count])){
195 $def[$count] .= "DEF:var$i=$rrdfile:$DS[$i]:AVERAGE " ;
198 $def[$count] = "DEF:var$i=$rrdfile:$DS[$i]:AVERAGE " ;
200 $def[$count] .= "LINE:var$i#".$colors[$f++].":\"$NAME[$i]\" " ;
201 $def[$count] .= "GPRINT:var$i:LAST:\"%6.0lf RPM last \" ";
202 $def[$count] .= "GPRINT:var$i:MAX:\"%6.0lf RPM max \" ";
203 $def[$count] .= "GPRINT:var$i:AVERAGE:\"%6.2lf RPM avg \\n\" ";
206 # ENCLOSURE TEMPERATURES (Celsius)
207 if(preg_match('/^E(?P<id>.+?)_temp_\d+$/', $NAME[$i], $matches)
208 || preg_match('/^E(?P<id>.+?)_t\d+$/', $NAME[$i], $matches)){
209 $this_id = $matches['id'];
211 if ($enclosure_id != $this_id) {
214 $enclosure_id = $this_id;
218 $NAME[$i] = preg_replace('/^E.+?_temp_(\d+)$/', 'Probe $1', $NAME[$i]);
221 $NAME[$i] = preg_replace('/^E.+?t(\d+)$/', 'Probe $1', $NAME[$i]);
223 $ds_name[$count] = "Enclosure $enclosure_id Temperatures";
228 if ($WARN[$i] != "") {
229 $warnThresh = $WARN[$i];
231 if ($CRIT[$i] != "") {
232 $critThresh = $CRIT[$i];
235 $opt[$count] = "--slope-mode --vertical-label \"Celsius\" --title \"$def_title: Enclosure $enclosure_id Temperatures\" ";
237 if(isset($def[$count])){
238 $def[$count] .= "DEF:var$i=$rrdfile:$DS[$i]:AVERAGE " ;
241 $def[$count] = "DEF:var$i=$rrdfile:$DS[$i]:AVERAGE " ;
243 $def[$count] .= "LINE:var$i#".$colors[$e++].":\"$NAME[$i]\" " ;
244 $def[$count] .= "GPRINT:var$i:LAST:\"%6.0lf C last \" ";
245 $def[$count] .= "GPRINT:var$i:MAX:\"%6.0lf C max \" ";
246 $def[$count] .= "GPRINT:var$i:AVERAGE:\"%6.2lf C avg \\n\" ";