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 $e = 0; # enclosure counter
35 $def_title = 'Dell OpenManage';
37 # Loop through the performance data
41 if(preg_match('/^pwr_mon_/', $NAME[$i]) || preg_match('/^p\d+[aw]$/', $NAME[$i])) {
44 if (preg_match('/system/', $NAME[$i]) || preg_match('/^p\d+w$/', $NAME[$i])) {
47 $NAME[$i] = preg_replace('/^pwr_mon_\d+_/', '', $NAME[$i]);
48 $NAME[$i] = preg_replace('/_/', ' ', $NAME[$i]);
51 $NAME[$i] = preg_replace('/^p(\d+)w$/', 'Power Probe $1', $NAME[$i]);
54 $ds_name[$count] = "Power Consumption";
57 $title = $ds_name[$count];
59 $opt[$count] = "--slope-mode --vertical-label \"$vlabel\" --title \"$def_title: $title\" ";
61 if(isset($def[$count])){
62 $def[$count] .= "DEF:var$i=$rrdfile:$DS[$i]:AVERAGE " ;
65 $def[$count] = "DEF:var$i=$rrdfile:$DS[$i]:AVERAGE " ;
67 $def[$count] .= "AREA:var$i#$PWRcolor:\"$NAME[$i]\" " ;
68 $def[$count] .= "LINE:var$i#000000: " ;
69 $def[$count] .= "GPRINT:var$i:LAST:\"%6.0lf W last \" ";
70 $def[$count] .= "GPRINT:var$i:MAX:\"%6.0lf W max \" ";
71 $def[$count] .= "GPRINT:var$i:AVERAGE:\"%6.2lf W avg \\n\" ";
74 elseif (preg_match('/current/', $NAME[$i]) || preg_match('/^p\d+a$/', $NAME[$i])) {
77 $NAME[$i] = preg_replace('/^pwr_mon_\d+_/', '', $NAME[$i]);
78 $NAME[$i] = preg_replace('/_/', ' ', $NAME[$i]);
79 $NAME[$i] = preg_replace('/ current \d+$/', '', $NAME[$i]);
80 $NAME[$i] = preg_replace('/ps/', 'PowerSupply', $NAME[$i]);
83 $NAME[$i] = preg_replace('/^p(\d+)a$/', 'Amperage Probe $1', $NAME[$i]);
85 if ($visited_pwr == 0) {
89 $ds_name[$count] = "Amperage Probes";
92 $title = $ds_name[$count];
94 $opt[$count] = "-X0 --lower-limit 0 --slope-mode --vertical-label \"$vlabel\" --title \"$def_title: $title\" ";
95 if(isset($def[$count])){
96 $def[$count] .= "DEF:var$i=$rrdfile:$DS[$i]:AVERAGE " ;
99 $def[$count] = "DEF:var$i=$rrdfile:$DS[$i]:AVERAGE " ;
101 $def[$count] .= "LINE:var$i#".$colors[$a].":\"$NAME[$i]\" " ;
102 $def[$count] .= "AREA:var$i#".$colors[$a++]."20: " ;
103 $def[$count] .= "GPRINT:var$i:LAST:\"%4.2lf A last \" ";
104 $def[$count] .= "GPRINT:var$i:MAX:\"%4.2lf A max \" ";
105 $def[$count] .= "GPRINT:var$i:AVERAGE:\"%4.4lf A avg \\n\" ";
110 if(preg_match('/^fan_/', $NAME[$i]) || preg_match('/^f\d+$/', $NAME[$i])){
111 if ($visited_fan == 0) {
117 $NAME[$i] = preg_replace('/^fan_\d+_/', '', $NAME[$i]);
118 $NAME[$i] = preg_replace('/_rpm$/', '', $NAME[$i]);
119 $NAME[$i] = preg_replace('/_/', ' ', $NAME[$i]);
122 $NAME[$i] = preg_replace('/^f(\d+)$/', 'Fan Probe $1', $NAME[$i]);
124 $ds_name[$count] = "Fan Speed";
126 $opt[$count] = "-X0 --slope-mode --vertical-label \"RPMs\" --title \"$def_title: Fan Speeds\" ";
127 if(isset($def[$count])){
128 $def[$count] .= "DEF:var$i=$rrdfile:$DS[$i]:AVERAGE " ;
131 $def[$count] = "DEF:var$i=$rrdfile:$DS[$i]:AVERAGE " ;
133 $def[$count] .= "LINE:var$i#".$colors[$f++].":\"$NAME[$i]\" " ;
134 $def[$count] .= "GPRINT:var$i:LAST:\"%6.0lf RPM last \" ";
135 $def[$count] .= "GPRINT:var$i:MAX:\"%6.0lf RPM max \" ";
136 $def[$count] .= "GPRINT:var$i:AVERAGE:\"%6.2lf RPM avg \\n\" ";
139 # TEMPERATURES (Celsius)
140 if(preg_match('/^temp_/', $NAME[$i]) || preg_match('/^t\d+$/', $NAME[$i])){
141 if ($visited_temp == 0) {
147 $NAME[$i] = preg_replace('/^temp_\d+_/', '', $NAME[$i]);
148 $NAME[$i] = preg_replace('/_/', ' ', $NAME[$i]);
151 $NAME[$i] = preg_replace('/^t(\d+)$/', 'Temperature Probe $1', $NAME[$i]);
153 $ds_name[$count] = "Chassis Temperatures";
158 if ($WARN[$i] != "") {
159 $warnThresh = $WARN[$i];
161 if ($CRIT[$i] != "") {
162 $critThresh = $CRIT[$i];
165 $opt[$count] = "--slope-mode --vertical-label \"Celsius\" --title \"$def_title: Chassis Temperatures\" ";
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[$t++].":\"$NAME[$i]\" " ;
173 $def[$count] .= "GPRINT:var$i:LAST:\"%6.0lf C last \" ";
174 $def[$count] .= "GPRINT:var$i:MAX:\"%6.0lf C max \" ";
175 $def[$count] .= "GPRINT:var$i:AVERAGE:\"%6.2lf C avg \\n\" ";
178 # ENCLOSURE TEMPERATURES (Celsius)
179 if(preg_match('/^enclosure_(?<id>.+?)_temp_\d+$/', $NAME[$i], $matches)
180 || preg_match('/^e(?<id>.+?)t\d+$/', $NAME[$i], $matches)){
181 $this_id = $matches['id'];
183 if ($enclosure_id != $this_id) {
186 $enclosure_id = $this_id;
190 $NAME[$i] = preg_replace('/^enclosure_.+?_temp_(\d+)$/', 'Probe $1', $NAME[$i]);
193 $NAME[$i] = preg_replace('/^e.+?t(\d+)$/', 'Probe $1', $NAME[$i]);
195 $ds_name[$count] = "Enclosure $enclosure_id Temperatures";
200 if ($WARN[$i] != "") {
201 $warnThresh = $WARN[$i];
203 if ($CRIT[$i] != "") {
204 $critThresh = $CRIT[$i];
207 $opt[$count] = "--slope-mode --vertical-label \"Celsius\" --title \"$def_title: Enclosure $enclosure_id Temperatures\" ";
209 if(isset($def[$count])){
210 $def[$count] .= "DEF:var$i=$rrdfile:$DS[$i]:AVERAGE " ;
213 $def[$count] = "DEF:var$i=$rrdfile:$DS[$i]:AVERAGE " ;
215 $def[$count] .= "LINE:var$i#".$colors[$e++].":\"$NAME[$i]\" " ;
216 $def[$count] .= "GPRINT:var$i:LAST:\"%6.0lf C last \" ";
217 $def[$count] .= "GPRINT:var$i:MAX:\"%6.0lf C max \" ";
218 $def[$count] .= "GPRINT:var$i:AVERAGE:\"%6.2lf C avg \\n\" ";