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+)_(.+)/', 'Temperature Probe $1 [$2]', $NAME[$i]);
51 $NAME[$i] = preg_replace('/_/', ' ', $NAME[$i]);
54 $NAME[$i] = preg_replace('/^T(\d+)$/', 'Temperature 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+)_(.+)/', 'Amerage Probe $1 [$2]', $NAME[$i]);
86 $NAME[$i] = preg_replace('/_/', ' ', $NAME[$i]);
89 $NAME[$i] = preg_replace('/^W(\d+)$/', 'Amperage 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+)_(.+)/', 'Amperage Probe $1 [$2]', $NAME[$i]);
117 $NAME[$i] = preg_replace('/_/', ' ', $NAME[$i]);
120 $NAME[$i] = preg_replace('/^A(\d+)$/', 'Amperage 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] .= "AREA:var$i#".$colors[$a++]."20: " ;
140 $def[$count] .= "GPRINT:var$i:LAST:\"%4.2lf A last \" ";
141 $def[$count] .= "GPRINT:var$i:MAX:\"%4.2lf A max \" ";
142 $def[$count] .= "GPRINT:var$i:AVERAGE:\"%4.4lf A avg \\n\" ";
147 if (preg_match('/^V/', $NAME[$i])) {
150 $NAME[$i] = preg_replace('/^V(\d+)_(.+)/', 'Voltage Probe $1 [$2]', $NAME[$i]);
151 $NAME[$i] = preg_replace('/_/', ' ', $NAME[$i]);
154 $NAME[$i] = preg_replace('/^V(\d+)$/', 'Voltage Probe $1', $NAME[$i]);
156 if ($visited_volt == 0) {
160 $ds_name[$count] = "Voltage Probes";
163 $title = $ds_name[$count];
165 $opt[$count] = "-X0 --lower-limit 0 --slope-mode --vertical-label \"$vlabel\" --title \"$def_title: $title\" ";
166 if(isset($def[$count])){
167 $def[$count] .= "DEF:var$i=$rrdfile:$DS[$i]:AVERAGE " ;
170 $def[$count] = "DEF:var$i=$rrdfile:$DS[$i]:AVERAGE " ;
172 $def[$count] .= "LINE:var$i#".$colors[$v].":\"$NAME[$i]\" " ;
173 $def[$count] .= "AREA:var$i#".$colors[$v++]."20: " ;
174 $def[$count] .= "GPRINT:var$i:LAST:\"%4.2lf A last \" ";
175 $def[$count] .= "GPRINT:var$i:MAX:\"%4.2lf A max \" ";
176 $def[$count] .= "GPRINT:var$i:AVERAGE:\"%4.4lf A avg \\n\" ";
180 if (preg_match('/^F/', $NAME[$i])) {
181 if ($visited_fan == 0) {
187 $NAME[$i] = preg_replace('/^F(\d+)_(.+)/', 'Fan Probe $1 [$2]', $NAME[$i]);
188 $NAME[$i] = preg_replace('/_/', ' ', $NAME[$i]);
191 $NAME[$i] = preg_replace('/^F(\d+)$/', 'Fan Probe $1', $NAME[$i]);
193 $ds_name[$count] = "Fan Probes";
195 $opt[$count] = "-X0 --slope-mode --vertical-label \"RPMs\" --title \"$def_title: Fan Speeds\" ";
196 if(isset($def[$count])){
197 $def[$count] .= "DEF:var$i=$rrdfile:$DS[$i]:AVERAGE " ;
200 $def[$count] = "DEF:var$i=$rrdfile:$DS[$i]:AVERAGE " ;
202 $def[$count] .= "LINE:var$i#".$colors[$f++].":\"$NAME[$i]\" " ;
203 $def[$count] .= "GPRINT:var$i:LAST:\"%6.0lf RPM last \" ";
204 $def[$count] .= "GPRINT:var$i:MAX:\"%6.0lf RPM max \" ";
205 $def[$count] .= "GPRINT:var$i:AVERAGE:\"%6.2lf RPM avg \\n\" ";
208 # ENCLOSURE TEMPERATURES (Celsius)
209 if(preg_match('/^E(?P<id>.+?)_temp_\d+$/', $NAME[$i], $matches)
210 || preg_match('/^E(?P<id>.+?)t\d+$/', $NAME[$i], $matches)){
211 $this_id = $matches['id'];
213 if ($enclosure_id != $this_id) {
216 $enclosure_id = $this_id;
220 $NAME[$i] = preg_replace('/^enclosure_.+?_temp_(\d+)$/', 'Probe $1', $NAME[$i]);
223 $NAME[$i] = preg_replace('/^e.+?t(\d+)$/', 'Probe $1', $NAME[$i]);
225 $ds_name[$count] = "Enclosure $enclosure_id Temperatures";
230 if ($WARN[$i] != "") {
231 $warnThresh = $WARN[$i];
233 if ($CRIT[$i] != "") {
234 $critThresh = $CRIT[$i];
237 $opt[$count] = "--slope-mode --vertical-label \"Celsius\" --title \"$def_title: Enclosure $enclosure_id Temperatures\" ";
239 if(isset($def[$count])){
240 $def[$count] .= "DEF:var$i=$rrdfile:$DS[$i]:AVERAGE " ;
243 $def[$count] = "DEF:var$i=$rrdfile:$DS[$i]:AVERAGE " ;
245 $def[$count] .= "LINE:var$i#".$colors[$e++].":\"$NAME[$i]\" " ;
246 $def[$count] .= "GPRINT:var$i:LAST:\"%6.0lf C last \" ";
247 $def[$count] .= "GPRINT:var$i:MAX:\"%6.0lf C max \" ";
248 $def[$count] .= "GPRINT:var$i:AVERAGE:\"%6.2lf C avg \\n\" ";