mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
more fixes for new sensor setup. more to come no doubt. also started making graphs which can 'widen'
git-svn-id: http://www.observium.org/svn/observer/trunk@1534 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@ -3,11 +3,12 @@
|
|||||||
include("includes/graphs/common.inc.php");
|
include("includes/graphs/common.inc.php");
|
||||||
$device = device_by_id_cache($id);
|
$device = device_by_id_cache($id);
|
||||||
|
|
||||||
$rrd_options .= " -l 0 -E ";
|
if($_GET['width'] > "300") { $descr_len = "40"; } else { $descr_len = "22"; }
|
||||||
|
|
||||||
|
$rrd_options .= " -l 0 -E ";
|
||||||
$iter = "1";
|
$iter = "1";
|
||||||
$sql = mysql_query("SELECT * FROM sensors WHERE sensor_class='temperature' AND device_id = '$id' ORDER BY sensor_index");
|
$sql = mysql_query("SELECT * FROM sensors WHERE sensor_class='temperature' AND device_id = '$id' ORDER BY sensor_index");
|
||||||
$rrd_options .= " COMMENT:' Cur Min Max\\n'";
|
$rrd_options .= " COMMENT:'".str_pad('',$descr_len)." Cur Min Max\\n'";
|
||||||
while($temperature = mysql_fetch_array($sql))
|
while($temperature = mysql_fetch_array($sql))
|
||||||
{
|
{
|
||||||
switch ($iter)
|
switch ($iter)
|
||||||
@ -37,7 +38,7 @@ while($temperature = mysql_fetch_array($sql))
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$temperature['sensor_descr_fixed'] = substr(str_pad($temperature['sensor_descr'], 22),0,22);
|
$temperature['sensor_descr_fixed'] = substr(str_pad($temperature['sensor_descr'], $descr_len),0,$descr_len);
|
||||||
$rrd_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/temp-" . safename($temperature['sensor_type']."-".$temperature['sensor_index']) . ".rrd";
|
$rrd_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/temp-" . safename($temperature['sensor_type']."-".$temperature['sensor_index']) . ".rrd";
|
||||||
$rrd_options .= " DEF:temp" . $temperature['sensor_id'] . "=$rrd_file:temp:AVERAGE ";
|
$rrd_options .= " DEF:temp" . $temperature['sensor_id'] . "=$rrd_file:temp:AVERAGE ";
|
||||||
$rrd_options .= " LINE1:temp" . $temperature['sensor_id'] . "#" . $colour . ":'" . str_replace(':','\:',str_replace('\*','*',$temperature['sensor_descr_fixed'])) . "'";
|
$rrd_options .= " LINE1:temp" . $temperature['sensor_id'] . "#" . $colour . ":'" . str_replace(':','\:',str_replace('\*','*',$temperature['sensor_descr_fixed'])) . "'";
|
||||||
|
@ -5,10 +5,12 @@ $device = device_by_id_cache($id);
|
|||||||
|
|
||||||
$rrd_options .= " -l 0 -E ";
|
$rrd_options .= " -l 0 -E ";
|
||||||
|
|
||||||
|
if($_GET['width'] > "300") { $descr_len = "38"; } else { $descr_len = "18"; }
|
||||||
|
$rrd_options .= " COMMENT:'".str_pad('',$descr_len)." Cur Min Max\\n'";
|
||||||
|
|
||||||
$iter = "1";
|
$iter = "1";
|
||||||
$sql = mysql_query("SELECT * FROM sensors WHERE sensor_class='voltage' AND device_id = '$id'");
|
$sql = mysql_query("SELECT * FROM sensors WHERE sensor_class='voltage' AND device_id = '$id'");
|
||||||
$rrd_options .= " COMMENT:' Cur Min Max\\n'";
|
while($sensor = mysql_fetch_array($sql))
|
||||||
while($voltage = mysql_fetch_array($sql))
|
|
||||||
{
|
{
|
||||||
switch ($iter)
|
switch ($iter)
|
||||||
{
|
{
|
||||||
@ -37,17 +39,18 @@ while($voltage = mysql_fetch_array($sql))
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$hostname = gethostbyid($voltage['device_id']);
|
|
||||||
|
|
||||||
$descr = substr(str_pad($voltage['sensor_descr'], 15),0,15);
|
$sensor['sensor_descr_fixed'] = substr(str_pad($sensor['sensor_descr'], $descr_len),0,$descr_len);
|
||||||
$rrd_filename = $config['rrd_dir'] . "/".$device['hostname']."/" . safename("volt-" . $voltage['sensor_descr'] . ".rrd");
|
$sensor['sensor_descr_fixed'] = str_replace(':','\:',str_replace('\*','*',$sensor['sensor_descr_fixed']));
|
||||||
$volt_id = $voltage['sensor_id'];
|
|
||||||
|
|
||||||
$rrd_options .= " DEF:volt$volt_id=$rrd_filename:volt:AVERAGE";
|
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/volt-" . safename($sensor['sensor_type']."-".$sensor['sensor_index']) . ".rrd";
|
||||||
$rrd_options .= " LINE1:volt$volt_id#".$colour.":'" . $descr . "'";
|
$sensor_id = $sensor['sensor_id'];
|
||||||
$rrd_options .= " GPRINT:volt$volt_id:AVERAGE:%5.2lfV";
|
|
||||||
$rrd_options .= " GPRINT:volt$volt_id:MIN:%5.2lfV";
|
$rrd_options .= " DEF:s$sensor_id=$rrd_filename:volt:AVERAGE";
|
||||||
$rrd_options .= " GPRINT:volt$volt_id:MAX:%5.2lfV\\\\l";
|
$rrd_options .= " LINE1:s$sensor_id#".$colour.":'" . $sensor['sensor_descr_fixed'] . "'";
|
||||||
|
$rrd_options .= " GPRINT:s$sensor_id:AVERAGE:%5.2lfV";
|
||||||
|
$rrd_options .= " GPRINT:s$sensor_id:MIN:%5.2lfV";
|
||||||
|
$rrd_options .= " GPRINT:s$sensor_id:MAX:%5.2lfV\\\\l";
|
||||||
|
|
||||||
$iter++;
|
$iter++;
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ include("includes/graphs/common.inc.php");
|
|||||||
$device = device_by_id_cache($sensor['device_id']);
|
$device = device_by_id_cache($sensor['device_id']);
|
||||||
|
|
||||||
$sensor['sensor_descr_fixed'] = substr(str_pad($sensor['sensor_descr'], 22),0,22);
|
$sensor['sensor_descr_fixed'] = substr(str_pad($sensor['sensor_descr'], 22),0,22);
|
||||||
|
$sensor['sensor_descr_fixed'] = str_replace(':','\:',str_replace('\*','*',$sensor['sensor_descr_fixed']));
|
||||||
|
|
||||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/temp-" . safename($sensor['sensor_type']."-".$sensor['sensor_index']) . ".rrd";
|
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/temp-" . safename($sensor['sensor_type']."-".$sensor['sensor_index']) . ".rrd";
|
||||||
|
|
||||||
@ -29,7 +30,7 @@ include("includes/graphs/common.inc.php");
|
|||||||
# $rrd_options .= " AREA:tempwarm#FFCCCC";
|
# $rrd_options .= " AREA:tempwarm#FFCCCC";
|
||||||
# $rrd_options .= " AREA:tempcold#CCCCFF";
|
# $rrd_options .= " AREA:tempcold#CCCCFF";
|
||||||
# $rrd_options .= " LINE1:temp#cc0000:'" . str_replace(':','\:',str_replace('\*','*',quotemeta($sensor['sensor_descr_fixed'])))."'"; # Ugly hack :(
|
# $rrd_options .= " LINE1:temp#cc0000:'" . str_replace(':','\:',str_replace('\*','*',quotemeta($sensor['sensor_descr_fixed'])))."'"; # Ugly hack :(
|
||||||
$rrd_options .= " LINE1:temp#cc0000:'" . str_replace(':','\:',str_replace('\*','*',$sensor['sensor_descr_fixed']))."'"; # Ugly hack :(
|
$rrd_options .= " LINE1:temp#cc0000:'" . $sensor['sensor_descr_fixed']."'";
|
||||||
$rrd_options .= " LINE1:tempwarm#660000";
|
$rrd_options .= " LINE1:tempwarm#660000";
|
||||||
$rrd_options .= " GPRINT:temp:LAST:%4.1lfC";
|
$rrd_options .= " GPRINT:temp:LAST:%4.1lfC";
|
||||||
$rrd_options .= " GPRINT:temp:MIN:%4.1lfC";
|
$rrd_options .= " GPRINT:temp:MIN:%4.1lfC";
|
||||||
|
@ -6,26 +6,23 @@ include("includes/graphs/common.inc.php");
|
|||||||
|
|
||||||
$rrd_options .= " -A ";
|
$rrd_options .= " -A ";
|
||||||
|
|
||||||
$rrd_options .= " COMMENT:' Last Max\\n'";
|
$rrd_options .= " COMMENT:' Last Max\\n'";
|
||||||
|
|
||||||
$voltage = mysql_fetch_array(mysql_query("SELECT * FROM sensors WHERE sensor_class='voltage' AND sensor_id = '".mres($_GET['id'])."'"));
|
$sensor['sensor_descr_fixed'] = substr(str_pad($sensor['sensor_descr'], 22),0,22);
|
||||||
|
$sensor['sensor_descr_fixed'] = str_replace(':','\:',str_replace('\*','*',$sensor['sensor_descr_fixed']));
|
||||||
|
|
||||||
$hostname = mysql_result(mysql_query("SELECT hostname FROM devices WHERE device_id = '" . $voltage['device_id'] . "'"),0);
|
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/volt-" . safename($sensor['sensor_type']."-".$sensor['sensor_index']) . ".rrd";
|
||||||
|
|
||||||
$voltage['sensor_descr_fixed'] = substr(str_pad($voltage['sensor_descr'], 22),0,22);
|
$rrd_options .= " DEF:volt=$rrd_filename:volt:AVERAGE";
|
||||||
|
$rrd_options .= " DEF:volt_max=$rrd_filename:volt:MAX";
|
||||||
|
$rrd_options .= " DEF:volt_min=$rrd_filename:volt:MIN";
|
||||||
|
|
||||||
$rrd_filename = $config['rrd_dir'] . "/".$hostname."/" . safename("volt-" . $voltage['sensor_descr'] . ".rrd");
|
$rrd_options .= " AREA:volt_max#c5c5c5";
|
||||||
|
$rrd_options .= " AREA:volt_min#ffffffff";
|
||||||
|
|
||||||
$rrd_options .= " DEF:volt=$rrd_filename:volt:AVERAGE";
|
#$rrd_options .= " AREA:volt#FFFF99";
|
||||||
$rrd_options .= " DEF:volt_max=$rrd_filename:volt:MAX";
|
$rrd_options .= " LINE1.5:volt#cc0000:'" . $sensor['sensor_descr_fixed']."'";
|
||||||
$rrd_options .= " DEF:volt_min=$rrd_filename:volt:MIN";
|
$rrd_options .= " GPRINT:volt:LAST:%3.2lfV";
|
||||||
|
$rrd_options .= " GPRINT:volt:MAX:%3.2lfV\\\\l";
|
||||||
$rrd_options .= " AREA:volt_max#c5c5c5";
|
|
||||||
$rrd_options .= " AREA:volt_min#ffffffff";
|
|
||||||
|
|
||||||
#$rrd_options .= " AREA:volt#FFFF99";
|
|
||||||
$rrd_options .= " LINE1.5:volt#cc0000:'" . $voltage['sensor_descr_fixed']."'";
|
|
||||||
$rrd_options .= " GPRINT:volt:LAST:%3.2lfV";
|
|
||||||
$rrd_options .= " GPRINT:volt:MAX:%3.2lfV\\\\l";
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@ -12,13 +12,13 @@ while($temp = mysql_fetch_array($query)) {
|
|||||||
if(!is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
|
if(!is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
|
||||||
|
|
||||||
echo("<tr class=list-large style=\"background-color: $row_colour; padding: 5px;\">
|
echo("<tr class=list-large style=\"background-color: $row_colour; padding: 5px;\">
|
||||||
<td width=350>" . $temp['sensor_descr'] . "</td>
|
<td width=450>" . $temp['sensor_descr'] . "</td>
|
||||||
<td width=350>" . $temp['sensor_type'] . "</td>
|
<td >" . $temp['sensor_type'] . "</td>
|
||||||
<td>" . print_temperature($temp['sensor_current'], $temp['sensor_limit']) . " °C</td>
|
<td width=50>" . print_temperature($temp['sensor_current'], $temp['sensor_limit']) . " °C</td>
|
||||||
<td>" . $temp['sensor_limit'] . " °C</td>
|
<td width=50>" . $temp['sensor_limit'] . " °C</td>
|
||||||
<td>" . $temp['sensor_notes'] . "</td>
|
<td width=350>" . $temp['sensor_notes'] . "</td>
|
||||||
</tr>\n");
|
</tr>\n");
|
||||||
echo("<tr bgcolor=$row_colour><td colspan='4'>");
|
echo("<tr bgcolor=$row_colour><td colspan='5'>");
|
||||||
|
|
||||||
$graph_type = "sensor_temperature";
|
$graph_type = "sensor_temperature";
|
||||||
|
|
||||||
|
@ -12,12 +12,13 @@ while($volt = mysql_fetch_array($query)) {
|
|||||||
if(!is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
|
if(!is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
|
||||||
|
|
||||||
echo("<tr class=list-large style=\"background-color: $row_colour; padding: 5px;\">
|
echo("<tr class=list-large style=\"background-color: $row_colour; padding: 5px;\">
|
||||||
<td width=350>" . $volt['sensor_descr'] . "</td>
|
<td width=450>" . $volt['sensor_descr'] . "</td>
|
||||||
<td>" . $volt['sensor_current'] . "V</td>
|
<td>" . $volt['sensor_type'] . "</td>
|
||||||
<td>" . $volt['sensor_limit_low'] . 'V - ' . $volt['sensor_limit'] . "V</td>
|
<td width=50>" . $volt['sensor_current'] . "V</td>
|
||||||
<td>" . $volt['sensor_notes'] . "</td>
|
<td width=75>" . $volt['sensor_limit_low'] . 'V - ' . $volt['sensor_limit'] . "V</td>
|
||||||
|
<td width=200>" . $volt['sensor_notes'] . "</td>
|
||||||
</tr>\n");
|
</tr>\n");
|
||||||
echo("<tr bgcolor=$row_colour><td colspan='4'>");
|
echo("<tr bgcolor=$row_colour><td colspan='5'>");
|
||||||
|
|
||||||
$graph_type = "sensor_voltage";
|
$graph_type = "sensor_voltage";
|
||||||
|
|
||||||
|
@ -33,11 +33,19 @@ if ($device['os'] == "ios" || $device['os_group'] == "ios")
|
|||||||
if($entitysensor[$entry['entSensorType']] && is_numeric($entry['entSensorValue']) && is_numeric($index))
|
if($entitysensor[$entry['entSensorType']] && is_numeric($entry['entSensorValue']) && is_numeric($index))
|
||||||
{
|
{
|
||||||
$entPhysicalIndex = $index;
|
$entPhysicalIndex = $index;
|
||||||
$entPhysicalIndex_measured = $entry['entSensorMeasuredEntity'];
|
$descr = snmp_get($device, "entPhysicalName.".$index, "-Oqv", "ENTITY-MIB");
|
||||||
$descr = snmp_get($device, "entPhysicalDescr.".$index, "-Oqv", "ENTITY-MIB");
|
if(is_numeric($entry['entSensorMeasuredEntity']) && $entry['entSensorMeasuredEntity']) {
|
||||||
|
$measured_descr = snmp_get($device, "entPhysicalName.".$entry['entSensorMeasuredEntity'],"-Oqv", "ENTITY-MIB");
|
||||||
|
$descr = $measured_descr . " - " . $descr;
|
||||||
|
}
|
||||||
|
|
||||||
|
### Bit dirty also, clean later
|
||||||
|
$descr = str_replace("Temp: ", "", $descr);
|
||||||
|
$descr = str_replace("temperature ", "", $descr);
|
||||||
|
$descr = str_replace("Temperature ", "", $descr);
|
||||||
|
|
||||||
$oid = ".1.3.6.1.4.1.9.9.91.1.1.1.1.4.".$index;
|
$oid = ".1.3.6.1.4.1.9.9.91.1.1.1.1.4.".$index;
|
||||||
$current = $entry['entSensorValue'];
|
$current = $entry['entSensorValue'];
|
||||||
|
|
||||||
$type = $entitysensor[$entry['entSensorType']];
|
$type = $entitysensor[$entry['entSensorType']];
|
||||||
|
|
||||||
#echo("$index : ".$entry['entSensorScale']."|");
|
#echo("$index : ".$entry['entSensorScale']."|");
|
||||||
@ -51,7 +59,6 @@ if ($device['os'] == "ios" || $device['os_group'] == "ios")
|
|||||||
if($entry['entSensorScale'] == "giga") { $divisor = "1"; $multiplier = "1000000000"; }
|
if($entry['entSensorScale'] == "giga") { $divisor = "1"; $multiplier = "1000000000"; }
|
||||||
|
|
||||||
$current = $current * $multiplier / $divisor;
|
$current = $current * $multiplier / $divisor;
|
||||||
|
|
||||||
discover_sensor($valid_sensor, $type, $device, $oid, $index, 'cisco-entity-sensor', $descr, $divisor, $multiplier, NULL, NULL, NULL, NULL, $temperature);
|
discover_sensor($valid_sensor, $type, $device, $oid, $index, 'cisco-entity-sensor', $descr, $divisor, $multiplier, NULL, NULL, NULL, NULL, $temperature);
|
||||||
|
|
||||||
$cisco_entity_temperature = 1;
|
$cisco_entity_temperature = 1;
|
||||||
|
@ -2,16 +2,19 @@
|
|||||||
|
|
||||||
$query = "SELECT * FROM sensors WHERE sensor_class='voltage' AND device_id = '" . $device['device_id'] . "'";
|
$query = "SELECT * FROM sensors WHERE sensor_class='voltage' AND device_id = '" . $device['device_id'] . "'";
|
||||||
$volt_data = mysql_query($query);
|
$volt_data = mysql_query($query);
|
||||||
while($voltage = mysql_fetch_array($volt_data)) {
|
while($sensor = mysql_fetch_array($volt_data)) {
|
||||||
|
|
||||||
echo("Checking voltage " . $voltage['sensor_descr'] . "... ");
|
echo("Checking voltage " . $sensor['sensor_descr'] . "... ");
|
||||||
|
|
||||||
$volt = snmp_get($device, $voltage['sensor_oid'], "-OUqnv", "SNMPv2-MIB");
|
$volt = snmp_get($device, $sensor['sensor_oid'], "-OUqnv", "SNMPv2-MIB");
|
||||||
|
|
||||||
if ($voltage['sensor_divisor']) { $volt = $volt / $voltage['sensor_divisor']; }
|
if ($sensor['sensor_divisor']) { $volt = $volt / $sensor['sensor_divisor']; }
|
||||||
if ($voltage['sensor_multiplier']) { $volt = $volt * $voltage['sensor_multiplier']; }
|
if ($sensor['sensor_multiplier']) { $volt = $volt * $sensor['sensor_multiplier']; }
|
||||||
|
|
||||||
$rrd_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("volt-" . $voltage['sensor_descr'] . ".rrd");
|
$old_rrd_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("volt-" . $sensor['sensor_descr'] . ".rrd");
|
||||||
|
$rrd_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/volt-" . safename($sensor['sensor_type']."-".$sensor['sensor_index']) . ".rrd";
|
||||||
|
|
||||||
|
if(is_file($old_rrd_file)) { rename($old_rrd_file, $rrd_file); }
|
||||||
|
|
||||||
if (!is_file($rrd_file)) {
|
if (!is_file($rrd_file)) {
|
||||||
`rrdtool create $rrd_file \
|
`rrdtool create $rrd_file \
|
||||||
@ -27,25 +30,25 @@ while($voltage = mysql_fetch_array($volt_data)) {
|
|||||||
|
|
||||||
rrdtool_update($rrd_file,"N:$volt");
|
rrdtool_update($rrd_file,"N:$volt");
|
||||||
|
|
||||||
if($voltage['sensor_current'] > $voltage['sensor_limit_low'] && $volt <= $voltage['sensor_limit_low'])
|
if($sensor['sensor_current'] > $sensor['sensor_limit_low'] && $volt <= $sensor['sensor_limit_low'])
|
||||||
{
|
{
|
||||||
if($device['sysContact']) { $email = $device['sysContact']; } else { $email = $config['email_default']; }
|
if($device['sysContact']) { $email = $device['sysContact']; } else { $email = $config['email_default']; }
|
||||||
$msg = "Voltage Alarm: " . $device['hostname'] . " " . $voltage['sensor_descr'] . " is " . $volt . "V (Limit " . $voltage['sensor_limit'];
|
$msg = "Voltage Alarm: " . $device['hostname'] . " " . $sensor['sensor_descr'] . " is " . $volt . "V (Limit " . $sensor['sensor_limit'];
|
||||||
$msg .= "V) at " . date($config['timestamp_format']);
|
$msg .= "V) at " . date($config['timestamp_format']);
|
||||||
notify($device, "Voltage Alarm: " . $device['hostname'] . " " . $voltage['sensor_descr'], $msg);
|
notify($device, "Voltage Alarm: " . $device['hostname'] . " " . $sensor['sensor_descr'], $msg);
|
||||||
echo("Alerting for " . $device['hostname'] . " " . $voltage['sensor_descr'] . "\n");
|
echo("Alerting for " . $device['hostname'] . " " . $sensor['sensor_descr'] . "\n");
|
||||||
log_event('Voltage ' . $voltage['sensor_descr'] . " under threshold: " . $volt . " V (< " . $voltage['sensor_limit_low'] . " V)", $device['device_id'], 'voltage', $voltage['sensor_id']);
|
log_event('Voltage ' . $sensor['sensor_descr'] . " under threshold: " . $volt . " V (< " . $sensor['sensor_limit_low'] . " V)", $device['device_id'], 'voltage', $sensor['sensor_id']);
|
||||||
}
|
}
|
||||||
else if($voltage['sensor_current'] < $voltage['sensor_limit'] && $volt >= $voltage['sensor_limit'])
|
else if($sensor['sensor_current'] < $sensor['sensor_limit'] && $volt >= $sensor['sensor_limit'])
|
||||||
{
|
{
|
||||||
if($device['sysContact']) { $email = $device['sysContact']; } else { $email = $config['email_default']; }
|
if($device['sysContact']) { $email = $device['sysContact']; } else { $email = $config['email_default']; }
|
||||||
$msg = "Voltage Alarm: " . $device['hostname'] . " " . $voltage['sensor_descr'] . " is " . $volt . "V (Limit " . $voltage['sensor_limit'];
|
$msg = "Voltage Alarm: " . $device['hostname'] . " " . $sensor['sensor_descr'] . " is " . $volt . "V (Limit " . $sensor['sensor_limit'];
|
||||||
$msg .= "V) at " . date($config['timestamp_format']);
|
$msg .= "V) at " . date($config['timestamp_format']);
|
||||||
notify($device, "Voltage Alarm: " . $device['hostname'] . " " . $voltage['sensor_descr'], $msg);
|
notify($device, "Voltage Alarm: " . $device['hostname'] . " " . $sensor['sensor_descr'], $msg);
|
||||||
echo("Alerting for " . $device['hostname'] . " " . $voltage['sensor_descr'] . "\n");
|
echo("Alerting for " . $device['hostname'] . " " . $sensor['sensor_descr'] . "\n");
|
||||||
log_event('Voltage ' . $voltage['sensor_descr'] . " above threshold: " . $volt . " V (> " . $voltage['sensor_limit'] . " V)", $device['device_id'], 'voltage', $voltage['sensor_id']);
|
log_event('Voltage ' . $sensor['sensor_descr'] . " above threshold: " . $volt . " V (> " . $sensor['sensor_limit'] . " V)", $device['device_id'], 'voltage', $sensor['sensor_id']);
|
||||||
}
|
}
|
||||||
mysql_query("UPDATE sensors SET sensor_current = '$volt' WHERE sensor_class='voltage' AND sensor_id = '" . $voltage['sensor_id'] . "'");
|
mysql_query("UPDATE sensors SET sensor_current = '$volt' WHERE sensor_class='voltage' AND sensor_id = '" . $sensor['sensor_id'] . "'");
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
Reference in New Issue
Block a user