diff --git a/includes/polling/fanspeeds.inc.php b/includes/polling/fanspeeds.inc.php index 5ee023e6d..24e49b3c8 100755 --- a/includes/polling/fanspeeds.inc.php +++ b/includes/polling/fanspeeds.inc.php @@ -9,6 +9,7 @@ while($fanspeed = mysql_fetch_array($fan_data)) { $fan_cmd = $config['snmpget'] . " -m SNMPv2-MIB -O Uqnv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " " . $fanspeed['fan_oid'] . "|grep -v \"No Such Instance\""; $fan = trim(str_replace("\"", "", shell_exec($fan_cmd))); if ($fanspeed['fan_precision']) { $fan = $fan / $fanspeed['fan_precision']; } + #FIXME also divide the limit here $fanrrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("fan-" . $fanspeed['fan_descr'] . ".rrd"); @@ -27,10 +28,10 @@ while($fanspeed = mysql_fetch_array($fan_data)) { rrdtool_update($fanrrd,"N:$fan"); if($fanspeed['fan_current'] > $fanspeed['fan_limit'] && $fan <= $fanspeed['fan_limit']) { - $updated = ", `service_changed` = '" . time() . "' "; + $updated = ", `service_changed` = '" . time() . "' "; # FIXME what's this if($device['sysContact']) { $email = $device['sysContact']; } else { $email = $config['email_default']; } - $msg = "Fan Alarm: " . $device['hostname'] . " " . $fanspeed['fan_descr'] . " is " . $fan . " (Limit " . $fanspeed['fan_limit']; - $msg .= ") at " . date('l dS F Y h:i:s A'); + $msg = "Fan Alarm: " . $device['hostname'] . " " . $fanspeed['fan_descr'] . " is " . $fan . "rpm (Limit " . $fanspeed['fan_limit']; + $msg .= "rpm) at " . date('l dS F Y h:i:s A'); mail($email, "Fan Alarm: " . $device['hostname'] . " " . $fanspeed['fan_descr'], $msg, $config['email_headers']); echo("Alerting for " . $device['hostname'] . " " . $fanspeed['fan_descr'] . "\n"); eventlog('Fan speed ' . $fanspeed['fan_descr'] . " under threshold: " . $fanspeed['fan_current'] . " rpm (> " . $fanspeed['fan_limit'] . " rpm)", $device['device_id']); diff --git a/includes/polling/temperatures.inc.php b/includes/polling/temperatures.inc.php index ffb56d87e..f01062b89 100755 --- a/includes/polling/temperatures.inc.php +++ b/includes/polling/temperatures.inc.php @@ -11,15 +11,17 @@ while($temperature = mysql_fetch_array($temp_data)) { if ($debug) echo "Attempt $i "; $temp_cmd = $config['snmpget'] . " -m SNMPv2-MIB -O Uqnv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " " . $temperature['temp_oid'] . "|grep -v \"No Such Instance\""; $temp = trim(str_replace("\"", "", shell_exec($temp_cmd))); - if($temperature['temp_tenths']) { $temp = $temp / 10; } - else - { - if ($temperature['temp_precision']) { $temp = $temp / $temperature['temp_precision']; } - } - if ($temp != 999.9) break; # TME sometimes sends 999.9 when it is right in the middle of an update; + if ($temp != 9999) break; # TME sometimes sends 999.9 when it is right in the middle of an update; } + if($temperature['temp_tenths']) { $temp = $temp / 10; } + else + { + if ($temperature['temp_precision']) { $temp = $temp / $temperature['temp_precision']; } + } + #FIXME also divide the limit here + $temprrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("temp-" . $temperature['temp_descr'] . ".rrd"); if (!is_file($temprrd)) { @@ -37,7 +39,7 @@ while($temperature = mysql_fetch_array($temp_data)) { rrdtool_update($temprrd,"N:$temp"); if($temperature['temp_current'] < $temperature['temp_limit'] && $temp >= $temperature['temp_limit']) { - $updated = ", `service_changed` = '" . time() . "' "; + $updated = ", `service_changed` = '" . time() . "' "; # FIXME what's this if($device['sysContact']) { $email = $device['sysContact']; } else { $email = $config['email_default']; } $msg = "Temp Alarm: " . $device['hostname'] . " " . $temperature['temp_descr'] . " is " . $temp . " (Limit " . $temperature['temp_limit']; $msg .= ") at " . date('l dS F Y h:i:s A'); diff --git a/includes/polling/voltages.inc.php b/includes/polling/voltages.inc.php new file mode 100755 index 000000000..e84703502 --- /dev/null +++ b/includes/polling/voltages.inc.php @@ -0,0 +1,58 @@ + $voltage['volt_limit_low'] && $volt <= $voltage['volt_limit_low']) + { + $updated = ", `service_changed` = '" . time() . "' "; # FIXME what's this? + if($device['sysContact']) { $email = $device['sysContact']; } else { $email = $config['email_default']; } + $msg = "Voltage Alarm: " . $device['hostname'] . " " . $voltage['volt_descr'] . " is " . $volt . "V (Limit " . $voltage['volt_limit']; + $msg .= "V) at " . date('l dS F Y h:i:s A'); + mail($email, "Voltage Alarm: " . $device['hostname'] . " " . $voltage['volt_descr'], $msg, $config['email_headers']); + echo("Alerting for " . $device['hostname'] . " " . $voltage['volt_descr'] . "\n"); + eventlog('Voltage ' . $voltage['volt_descr'] . " under threshold: " . $voltage['volt_current'] . " rpm (> " . $voltage['volt_limit'] . " rpm)", $device['device_id']); + } + else if($voltage['volt_current'] < $voltage['volt_limit'] && $volt >= $voltage['volt_limit']) + { + $updated = ", `service_changed` = '" . time() . "' "; # FIXME what's this? + if($device['sysContact']) { $email = $device['sysContact']; } else { $email = $config['email_default']; } + $msg = "Voltage Alarm: " . $device['hostname'] . " " . $voltage['volt_descr'] . " is " . $volt . "V (Limit " . $voltage['volt_limit']; + $msg .= "V) at " . date('l dS F Y h:i:s A'); + mail($email, "Voltage Alarm: " . $device['hostname'] . " " . $voltage['volt_descr'], $msg, $config['email_headers']); + echo("Alerting for " . $device['hostname'] . " " . $voltage['volt_descr'] . "\n"); + eventlog('Voltage ' . $voltage['volt_descr'] . " above threshold: " . $voltage['volt_current'] . " rpm (> " . $voltage['volt_limit'] . " rpm)", $device['device_id']); + } + + mysql_query("UPDATE voltage SET volt_current = '$volt' WHERE volt_id = '" . $voltage['volt_id'] . "'"); +} + +?> diff --git a/poll-device.php b/poll-device.php index 984395f56..455f6e592 100755 --- a/poll-device.php +++ b/poll-device.php @@ -104,6 +104,7 @@ while ($device = mysql_fetch_array($device_query)) { include("includes/polling/temperatures.inc.php"); include("includes/polling/fanspeeds.inc.php"); + include("includes/polling/voltages.inc.php"); include("includes/polling/device-netstats.inc.php"); include("includes/polling/ipSystemStats.inc.php"); include("includes/polling/ports.inc.php");