mirror of
https://github.com/librenms/librenms.git
synced 2024-09-27 05:18:10 +00:00
fix previous commit, do NULL check for all sensor types, minor start of unification
git-svn-id: http://www.observium.org/svn/observer/trunk@2072 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
parent
a1ffa0b11a
commit
1864e577d8
@ -2,16 +2,16 @@
|
||||
|
||||
$query = "SELECT * FROM sensors WHERE sensor_class='current' AND device_id = '" . $device['device_id'] . "' AND poller_type='snmp'";
|
||||
$current_data = mysql_query($query);
|
||||
while ($dbcurrent = mysql_fetch_assoc($current_data))
|
||||
while ($sensor = mysql_fetch_assoc($current_data))
|
||||
{
|
||||
echo("Checking current " . $dbcurrent['sensor_descr'] . "... ");
|
||||
echo("Checking current " . $sensor['sensor_descr'] . "... ");
|
||||
|
||||
$current = snmp_get($device, $dbcurrent['sensor_oid'], "-OUqnv", "SNMPv2-MIB");
|
||||
$current = snmp_get($device, $sensor['sensor_oid'], "-OUqnv", "SNMPv2-MIB");
|
||||
|
||||
if ($dbcurrent['sensor_divisor']) { $current = $current / $dbcurrent['sensor_divisor']; }
|
||||
if ($dbcurrent['sensor_multplier']) { $current = $current * $dbcurrent['sensor_multiplier']; }
|
||||
if ($sensor['sensor_divisor']) { $current = $current / $sensor['sensor_divisor']; }
|
||||
if ($sensor['sensor_multplier']) { $current = $current * $sensor['sensor_multiplier']; }
|
||||
|
||||
$currentrrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("current-" . $dbcurrent['sensor_descr'] . ".rrd");
|
||||
$currentrrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("current-" . $sensor['sensor_descr'] . ".rrd");
|
||||
|
||||
if (!is_file($currentrrd))
|
||||
{
|
||||
@ -28,24 +28,24 @@ while ($dbcurrent = mysql_fetch_assoc($current_data))
|
||||
rrdtool_update($currentrrd,"N:$current");
|
||||
|
||||
# FIXME also warn when crossing WARN level!!
|
||||
if ($dbcurrent['sensor_limit_low'] != "" && $dbcurrent['sensor_current'] > $dbcurrent['sensor_limit_low'] && $current <= $dbcurrent['sensor_limit_low'])
|
||||
if ($sensor['sensor_limit_low'] != "" && $sensor['sensor_current'] > $sensor['sensor_limit_low'] && $current <= $sensor['sensor_limit_low'])
|
||||
{
|
||||
$msg = "Current Alarm: " . $device['hostname'] . " " . $dbcurrent['sensor_descr'] . " is under threshold: " . $current . "A (< " . $dbcurrent['sensor_limit'];
|
||||
$msg = "Current Alarm: " . $device['hostname'] . " " . $sensor['sensor_descr'] . " is under threshold: " . $current . "A (< " . $sensor['sensor_limit'];
|
||||
$msg .= "A) at " . date($config['timestamp_format']);
|
||||
notify($device, "Current Alarm: " . $device['hostname'] . " " . $dbcurrent['sensor_descr'], $msg);
|
||||
echo("Alerting for " . $device['hostname'] . " " . $dbcurrent['sensor_descr'] . "\n");
|
||||
log_event('Current ' . $dbcurrent['sensor_descr'] . " under threshold: " . $current . " A (< " . $dbcurrent['sensor_limit_low'] . " A)", $device, 'current', $current['sensor_id']);
|
||||
notify($device, "Current Alarm: " . $device['hostname'] . " " . $sensor['sensor_descr'], $msg);
|
||||
echo("Alerting for " . $device['hostname'] . " " . $sensor['sensor_descr'] . "\n");
|
||||
log_event('Current ' . $sensor['sensor_descr'] . " under threshold: " . $current . " A (< " . $sensor['sensor_limit_low'] . " A)", $device, 'current', $current['sensor_id']);
|
||||
}
|
||||
else if ($dbcurrent['sensor_limit_low'] != "" && $dbcurrent['sensor_current'] < $dbcurrent['sensor_limit'] && $current >= $dbcurrent['sensor_limit'])
|
||||
else if ($sensor['sensor_limit'] != "" && $sensor['sensor_current'] < $sensor['sensor_limit'] && $current >= $sensor['sensor_limit'])
|
||||
{
|
||||
$msg = "Current Alarm: " . $device['hostname'] . " " . $dbcurrent['sensor_descr'] . " is over threshold: " . $current . "A (> " . $dbcurrent['sensor_limit'];
|
||||
$msg = "Current Alarm: " . $device['hostname'] . " " . $sensor['sensor_descr'] . " is over threshold: " . $current . "A (> " . $sensor['sensor_limit'];
|
||||
$msg .= "A) at " . date($config['timestamp_format']);
|
||||
notify($device, "Current Alarm: " . $device['hostname'] . " " . $dbcurrent['sensor_descr'], $msg);
|
||||
echo("Alerting for " . $device['hostname'] . " " . $dbcurrent['sensor_descr'] . "\n");
|
||||
log_event('Current ' . $dbcurrent['sensor_descr'] . " above threshold: " . $current . " A (> " . $dbcurrent['sensor_limit'] . " A)", $device, 'current', $current['sensor_id']);
|
||||
notify($device, "Current Alarm: " . $device['hostname'] . " " . $sensor['sensor_descr'], $msg);
|
||||
echo("Alerting for " . $device['hostname'] . " " . $sensor['sensor_descr'] . "\n");
|
||||
log_event('Current ' . $sensor['sensor_descr'] . " above threshold: " . $current . " A (> " . $sensor['sensor_limit'] . " A)", $device, 'current', $current['sensor_id']);
|
||||
}
|
||||
|
||||
mysql_query("UPDATE sensors SET sensor_current = '$current' WHERE sensor_class='current' AND sensor_id = '" . $dbcurrent['sensor_id'] . "'");
|
||||
mysql_query("UPDATE sensors SET sensor_current = '$current' WHERE sensor_class='current' AND sensor_id = '" . $sensor['sensor_id'] . "'");
|
||||
}
|
||||
|
||||
?>
|
@ -3,17 +3,17 @@
|
||||
$query = "SELECT * FROM sensors WHERE sensor_class='fanspeed' AND device_id = '" . $device['device_id'] . "' AND poller_type='snmp'";
|
||||
$fan_data = mysql_query($query);
|
||||
|
||||
while ($fanspeed = mysql_fetch_assoc($fan_data))
|
||||
while ($sensor = mysql_fetch_assoc($fan_data))
|
||||
{
|
||||
echo("Checking fan " . $fanspeed['sensor_descr'] . "... ");
|
||||
echo("Checking fan " . $sensor['sensor_descr'] . "... ");
|
||||
|
||||
$fan = snmp_get($device, $fanspeed['sensor_oid'], "-OUqnv", "SNMPv2-MIB");
|
||||
$fan = snmp_get($device, $sensor['sensor_oid'], "-OUqnv", "SNMPv2-MIB");
|
||||
|
||||
if ($fanspeed['sensor_divisor']) { $fan = $fan / $fanspeed['sensor_divisor']; }
|
||||
if ($fanspeed['sensor_multiplier']) { $fan = $fan * $fanspeed['sensor_multiplier']; }
|
||||
if ($sensor['sensor_divisor']) { $fan = $fan / $sensor['sensor_divisor']; }
|
||||
if ($sensor['sensor_multiplier']) { $fan = $fan * $sensor['sensor_multiplier']; }
|
||||
|
||||
$old_rrd_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("fanspeed-" . $fanspeed['sensor_descr'] . ".rrd");
|
||||
$rrd_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/fanspeed-" . safename($fanspeed['sensor_type']."-".$fanspeed['sensor_index']) . ".rrd";
|
||||
$old_rrd_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("fanspeed-" . $sensor['sensor_descr'] . ".rrd");
|
||||
$rrd_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/fanspeed-" . safename($sensor['sensor_type']."-".$sensor['sensor_index']) . ".rrd";
|
||||
|
||||
if (is_file($old_rrd_file)) { rename($old_rrd_file, $rrd_file); }
|
||||
|
||||
@ -31,24 +31,24 @@ while ($fanspeed = mysql_fetch_assoc($fan_data))
|
||||
|
||||
rrdtool_update($rrd_file,"N:$fan");
|
||||
|
||||
if ($fanspeed['sensor_current'] > $fanspeed['sensor_limit_low'] && $fan <= $fanspeed['sensor_limit_low'])
|
||||
if ($sensor['sensor_limit_low'] != "" && $sensor['sensor_current'] > $sensor['sensor_limit_low'] && $fan <= $sensor['sensor_limit_low'])
|
||||
{
|
||||
$msg = "Fan Alarm: " . $device['hostname'] . " " . $fanspeed['sensor_descr'] . " is " . $fan . "rpm (Limit " . $fanspeed['sensor_limit_low'];
|
||||
$msg = "Fan Alarm: " . $device['hostname'] . " " . $sensor['sensor_descr'] . " is " . $fan . "rpm (Limit " . $sensor['sensor_limit_low'];
|
||||
$msg .= "rpm) at " . date($config['timestamp_format']);
|
||||
notify($device, "Fan Alarm: " . $device['hostname'] . " " . $fanspeed['sensor_descr'], $msg);
|
||||
echo("Alerting for " . $device['hostname'] . " " . $fanspeed['sensor_descr'] . "\n");
|
||||
log_event('Fan speed ' . $fanspeed['sensor_descr'] . " under threshold: " . $fanspeed['sensor_current'] . " rpm (<= " . $fanspeed['sensor_limit_low'] . " rpm)", $device, 'fanspeed', $fanspeed['sensor_id']);
|
||||
notify($device, "Fan Alarm: " . $device['hostname'] . " " . $sensor['sensor_descr'], $msg);
|
||||
echo("Alerting for " . $device['hostname'] . " " . $sensor['sensor_descr'] . "\n");
|
||||
log_event('Fan speed ' . $sensor['sensor_descr'] . " under threshold: " . $sensor['sensor_current'] . " rpm (<= " . $sensor['sensor_limit_low'] . " rpm)", $device, 'fanspeed', $sensor['sensor_id']);
|
||||
}
|
||||
else if ($fanspeed['sensor_limit_low_warn'] && $fanspeed['sensor_current'] > $fanspeed['sensor_limit_warn'] && $fan <= $fanspeed['sensor_limit_low_warn'])
|
||||
else if ($sensor['sensor_limit_low_warn'] != "" && $sensor['sensor_limit_low_warn'] && $sensor['sensor_current'] > $sensor['sensor_limit_warn'] && $fan <= $sensor['sensor_limit_low_warn'])
|
||||
{
|
||||
$msg = "Fan Warning: " . $device['hostname'] . " " . $fanspeed['sensor_descr'] . " is " . $fan . "rpm (Warning limit " . $fanspeed['sensor_limit_low_warn'];
|
||||
$msg = "Fan Warning: " . $device['hostname'] . " " . $sensor['sensor_descr'] . " is " . $fan . "rpm (Warning limit " . $sensor['sensor_limit_low_warn'];
|
||||
$msg .= "rpm) at " . date($config['timestamp_format']);
|
||||
notify($device, "Fan Warning: " . $device['hostname'] . " " . $fanspeed['sensor_descr'], $msg);
|
||||
echo("Alerting for " . $device['hostname'] . " " . $fanspeed['sensor_descr'] . "\n");
|
||||
log_event('Fan speed ' . $fanspeed['sensor_descr'] . " under warning threshold: " . $fanspeed['sensor_current'] . " rpm (<= " . $fanspeed['sensor_limit_low_warn'] . " rpm)", $device, 'fanspeed', $fanspeed['sensor_id']);
|
||||
notify($device, "Fan Warning: " . $device['hostname'] . " " . $sensor['sensor_descr'], $msg);
|
||||
echo("Alerting for " . $device['hostname'] . " " . $sensor['sensor_descr'] . "\n");
|
||||
log_event('Fan speed ' . $sensor['sensor_descr'] . " under warning threshold: " . $sensor['sensor_current'] . " rpm (<= " . $sensor['sensor_limit_low_warn'] . " rpm)", $device, 'fanspeed', $sensor['sensor_id']);
|
||||
}
|
||||
|
||||
mysql_query("UPDATE sensors SET sensor_current = '$fan' WHERE sensor_class='fanspeed' AND sensor_id = '" . $fanspeed['sensor_id'] . "'");
|
||||
mysql_query("UPDATE sensors SET sensor_current = '$fan' WHERE sensor_class='fanspeed' AND sensor_id = '" . $sensor['sensor_id'] . "'");
|
||||
}
|
||||
|
||||
?>
|
@ -2,16 +2,16 @@
|
||||
|
||||
$query = "SELECT * FROM sensors WHERE sensor_class='humidity' AND device_id = '" . $device['device_id'] . "' AND poller_type='snmp'";
|
||||
$hum_data = mysql_query($query);
|
||||
while ($humidity = mysql_fetch_assoc($hum_data))
|
||||
while ($sensor = mysql_fetch_assoc($hum_data))
|
||||
{
|
||||
echo("Checking humidity " . $humidity['sensor_descr'] . "... ");
|
||||
echo("Checking humidity " . $sensor['sensor_descr'] . "... ");
|
||||
|
||||
$hum = snmp_get($device, $humidity['sensor_oid'], "-OUqnv", "SNMPv2-MIB");
|
||||
$hum = snmp_get($device, $sensor['sensor_oid'], "-OUqnv", "SNMPv2-MIB");
|
||||
|
||||
if ($humidity['sensor_divisor']) { $hum = $hum / $humidity['sensor_divisor']; }
|
||||
if ($humidity['sensor_multiplier']) { $hum = $hum / $humidity['sensor_multiplier']; }
|
||||
if ($sensor['sensor_divisor']) { $hum = $hum / $sensor['sensor_divisor']; }
|
||||
if ($sensor['sensor_multiplier']) { $hum = $hum / $sensor['sensor_multiplier']; }
|
||||
|
||||
$humrrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("humidity-" . $humidity['sensor_descr'] . ".rrd");
|
||||
$humrrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("humidity-" . $sensor['sensor_descr'] . ".rrd");
|
||||
|
||||
if (!is_file($humrrd))
|
||||
{
|
||||
@ -27,24 +27,24 @@ while ($humidity = mysql_fetch_assoc($hum_data))
|
||||
|
||||
rrdtool_update($humrrd,"N:$hum");
|
||||
|
||||
if ($humidity['sensor_current'] > $humidity['sensor_limit_low'] && $hum <= $humidity['sensor_limit_low'])
|
||||
if ($sensor['sensor_limit_low'] != "" && $sensor['sensor_current'] > $sensor['sensor_limit_low'] && $hum <= $sensor['sensor_limit_low'])
|
||||
{
|
||||
$msg = "Humidity Alarm: " . $device['hostname'] . " " . $humidity['sensor_descr'] . " is " . $hum . "% (Limit " . $humidity['sensor_limit'];
|
||||
$msg = "Humidity Alarm: " . $device['hostname'] . " " . $sensor['sensor_descr'] . " is " . $hum . "% (Limit " . $sensor['sensor_limit'];
|
||||
$msg .= "%) at " . date($config['timestamp_format']);
|
||||
notify($device, "Humidity Alarm: " . $device['hostname'] . " " . $humidity['sensor_descr'], $msg);
|
||||
echo("Alerting for " . $device['hostname'] . " " . $humidity['sensor_descr'] . "\n");
|
||||
log_event('Frequency ' . $humidity['sensor_descr'] . " under threshold: " . $hum . " % (< " . $humidity['sensor_limit_low'] . " %)", $device, 'humidity', $humidity['sensor_id']);
|
||||
notify($device, "Humidity Alarm: " . $device['hostname'] . " " . $sensor['sensor_descr'], $msg);
|
||||
echo("Alerting for " . $device['hostname'] . " " . $sensor['sensor_descr'] . "\n");
|
||||
log_event('Frequency ' . $sensor['sensor_descr'] . " under threshold: " . $hum . " % (< " . $sensor['sensor_limit_low'] . " %)", $device, 'humidity', $sensor['sensor_id']);
|
||||
}
|
||||
else if ($humidity['sensor_current'] < $humidity['sensor_limit'] && $hum >= $humidity['sensor_limit'])
|
||||
else if ($sensor['sensor_limit'] != "" && $sensor['sensor_current'] < $sensor['sensor_limit'] && $hum >= $sensor['sensor_limit'])
|
||||
{
|
||||
$msg = "Humidity Alarm: " . $device['hostname'] . " " . $humidity['sensor_descr'] . " is " . $hum . "% (Limit " . $humidity['sensor_limit'];
|
||||
$msg = "Humidity Alarm: " . $device['hostname'] . " " . $sensor['sensor_descr'] . " is " . $hum . "% (Limit " . $sensor['sensor_limit'];
|
||||
$msg .= "%) at " . date($config['timestamp_format']);
|
||||
notify($device, "Humidity Alarm: " . $device['hostname'] . " " . $humidity['sensor_descr'], $msg);
|
||||
echo("Alerting for " . $device['hostname'] . " " . $humidity['sensor_descr'] . "\n");
|
||||
log_event('Humidity ' . $humidity['sensor_descr'] . " above threshold: " . $hum . " % (> " . $humidity['sensor_limit'] . " %)", $device, 'humidity', $humidity['sensor_id']);
|
||||
notify($device, "Humidity Alarm: " . $device['hostname'] . " " . $sensor['sensor_descr'], $msg);
|
||||
echo("Alerting for " . $device['hostname'] . " " . $sensor['sensor_descr'] . "\n");
|
||||
log_event('Humidity ' . $sensor['sensor_descr'] . " above threshold: " . $hum . " % (> " . $sensor['sensor_limit'] . " %)", $device, 'humidity', $sensor['sensor_id']);
|
||||
}
|
||||
|
||||
mysql_query("UPDATE sensors SET sensor_current = '$hum' WHERE sensor_class='humidity' AND sensor_id = '" . $humidity['sensor_id'] . "'");
|
||||
mysql_query("UPDATE sensors SET sensor_current = '$hum' WHERE sensor_class='humidity' AND sensor_id = '" . $sensor['sensor_id'] . "'");
|
||||
}
|
||||
|
||||
?>
|
@ -2,25 +2,25 @@
|
||||
|
||||
$query = "SELECT * FROM sensors WHERE sensor_class='temperature' AND device_id = '" . $device['device_id'] . "' AND poller_type='snmp'";
|
||||
$temp_data = mysql_query($query);
|
||||
while ($temperature = mysql_fetch_assoc($temp_data))
|
||||
while ($sensor = mysql_fetch_assoc($temp_data))
|
||||
{
|
||||
echo("Checking temp " . $temperature['sensor_descr'] . "... ");
|
||||
echo("Checking temp " . $sensor['sensor_descr'] . "... ");
|
||||
|
||||
for ($i = 0;$i < 5;$i++) # Try 5 times to get a valid temp reading
|
||||
{
|
||||
if ($debug) echo("Attempt $i ");
|
||||
$temp = snmp_get($device, $temperature['sensor_oid'], "-OUqnv", "SNMPv2-MIB");
|
||||
$temp = snmp_get($device, $sensor['sensor_oid'], "-OUqnv", "SNMPv2-MIB");
|
||||
$temp = trim(str_replace("\"", "", $temp));
|
||||
|
||||
if ($temp != 9999) break; # TME sometimes sends 999.9 when it is right in the middle of an update;
|
||||
sleep(1); # Give the TME some time to reset
|
||||
}
|
||||
|
||||
if ($temperature['sensor_divisor']) { $temp = $temp / $temperature['sensor_divisor']; }
|
||||
if ($temperature['sensor_multiplier']) { $temp = $temp * $temperature['sensor_multiplier']; }
|
||||
if ($sensor['sensor_divisor']) { $temp = $temp / $sensor['sensor_divisor']; }
|
||||
if ($sensor['sensor_multiplier']) { $temp = $temp * $sensor['sensor_multiplier']; }
|
||||
|
||||
$old_rrd_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("temperature-" . $temperature['sensor_descr'] . ".rrd");
|
||||
$rrd_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/temperature-" . safename($temperature['sensor_type']."-".$temperature['sensor_index']) . ".rrd";
|
||||
$old_rrd_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("temperature-" . $sensor['sensor_descr'] . ".rrd");
|
||||
$rrd_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/temperature-" . safename($sensor['sensor_type']."-".$sensor['sensor_index']) . ".rrd";
|
||||
|
||||
if (is_file($old_rrd_file)) { rename($old_rrd_file, $rrd_file); }
|
||||
|
||||
@ -46,16 +46,16 @@ while ($temperature = mysql_fetch_assoc($temp_data))
|
||||
|
||||
rrdtool_update($rrd_file,"N:$temp");
|
||||
|
||||
if ($temperature['sensor_current'] < $temperature['sensor_limit'] && $temp >= $temperature['sensor_limit'])
|
||||
if ($sensor['sensor_limit_low'] != "" && $sensor['sensor_current'] < $sensor['sensor_limit'] && $temp >= $sensor['sensor_limit'])
|
||||
{
|
||||
$msg = "Temp Alarm: " . $device['hostname'] . " " . $temperature['sensor_descr'] . " is " . $temp . " (Limit " . $temperature['sensor_limit'];
|
||||
$msg = "Temp Alarm: " . $device['hostname'] . " " . $sensor['sensor_descr'] . " is " . $temp . " (Limit " . $sensor['sensor_limit'];
|
||||
$msg .= ") at " . date($config['timestamp_format']);
|
||||
notify($device, "Temp Alarm: " . $device['hostname'] . " " . $temperature['sensor_descr'], $msg);
|
||||
echo("Alerting for " . $device['hostname'] . " " . $temperature['sensor_descr'] . "\n");
|
||||
log_event('Temperature ' . $temperature['sensor_descr'] . " over threshold: " . $temp . " " . html_entity_decode('°') . "C (>= " . $temperature['sensor_limit'] . " " . html_entity_decode('°') . 'C)', $device, 'temperature', $temperature['sensor_id']);
|
||||
notify($device, "Temp Alarm: " . $device['hostname'] . " " . $sensor['sensor_descr'], $msg);
|
||||
echo("Alerting for " . $device['hostname'] . " " . $sensor['sensor_descr'] . "\n");
|
||||
log_event('Temperature ' . $sensor['sensor_descr'] . " over threshold: " . $temp . " " . html_entity_decode('°') . "C (>= " . $sensor['sensor_limit'] . " " . html_entity_decode('°') . 'C)', $device, 'temperature', $sensor['sensor_id']);
|
||||
}
|
||||
|
||||
mysql_query("UPDATE sensors SET sensor_current = '$temp' WHERE sensor_class='temperature' AND sensor_id = '" . $temperature['sensor_id'] . "'");
|
||||
mysql_query("UPDATE sensors SET sensor_current = '$temp' WHERE sensor_class='temperature' AND sensor_id = '" . $sensor['sensor_id'] . "'");
|
||||
}
|
||||
|
||||
?>
|
@ -31,7 +31,7 @@ while ($sensor = mysql_fetch_assoc($volt_data))
|
||||
|
||||
rrdtool_update($rrd_file,"N:$volt");
|
||||
|
||||
if ($sensor['sensor_current'] > $sensor['sensor_limit_low'] && $volt <= $sensor['sensor_limit_low'])
|
||||
if ($sensor['sensor_limit_low'] != "" && $sensor['sensor_current'] > $sensor['sensor_limit_low'] && $volt <= $sensor['sensor_limit_low'])
|
||||
{
|
||||
$msg = "Voltage Alarm: " . $device['hostname'] . " " . $sensor['sensor_descr'] . " is " . $volt . "V (Limit " . $sensor['sensor_limit'];
|
||||
$msg .= "V) at " . date($config['timestamp_format']);
|
||||
@ -39,7 +39,7 @@ while ($sensor = mysql_fetch_assoc($volt_data))
|
||||
echo("Alerting for " . $device['hostname'] . " " . $sensor['sensor_descr'] . "\n");
|
||||
log_event('Voltage ' . $sensor['sensor_descr'] . " under threshold: " . $volt . " V (< " . $sensor['sensor_limit_low'] . " V)", $device, 'voltage', $sensor['sensor_id']);
|
||||
}
|
||||
else if ($sensor['sensor_current'] < $sensor['sensor_limit'] && $volt >= $sensor['sensor_limit'])
|
||||
else if ($sensor['sensor_limit'] != "" && $sensor['sensor_current'] < $sensor['sensor_limit'] && $volt >= $sensor['sensor_limit'])
|
||||
{
|
||||
$msg = "Voltage Alarm: " . $device['hostname'] . " " . $sensor['sensor_descr'] . " is " . $volt . "V (Limit " . $sensor['sensor_limit'];
|
||||
$msg .= "V) at " . date($config['timestamp_format']);
|
||||
|
Loading…
Reference in New Issue
Block a user