diff --git a/html/includes/graphs/device/temperatures.inc.php b/html/includes/graphs/device/temperatures.inc.php
index 61c5e68abf..1ba473d933 100644
--- a/html/includes/graphs/device/temperatures.inc.php
+++ b/html/includes/graphs/device/temperatures.inc.php
@@ -3,11 +3,12 @@
include("includes/graphs/common.inc.php");
$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";
$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))
{
switch ($iter)
@@ -37,7 +38,7 @@ while($temperature = mysql_fetch_array($sql))
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_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'])) . "'";
diff --git a/html/includes/graphs/device/voltages.inc.php b/html/includes/graphs/device/voltages.inc.php
index 880f4e9368..6e2df235a6 100644
--- a/html/includes/graphs/device/voltages.inc.php
+++ b/html/includes/graphs/device/voltages.inc.php
@@ -5,10 +5,12 @@ $device = device_by_id_cache($id);
$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";
$sql = mysql_query("SELECT * FROM sensors WHERE sensor_class='voltage' AND device_id = '$id'");
-$rrd_options .= " COMMENT:' Cur Min Max\\n'";
-while($voltage = mysql_fetch_array($sql))
+while($sensor = mysql_fetch_array($sql))
{
switch ($iter)
{
@@ -37,17 +39,18 @@ while($voltage = mysql_fetch_array($sql))
break;
}
- $hostname = gethostbyid($voltage['device_id']);
- $descr = substr(str_pad($voltage['sensor_descr'], 15),0,15);
- $rrd_filename = $config['rrd_dir'] . "/".$device['hostname']."/" . safename("volt-" . $voltage['sensor_descr'] . ".rrd");
- $volt_id = $voltage['sensor_id'];
+ $sensor['sensor_descr_fixed'] = substr(str_pad($sensor['sensor_descr'], $descr_len),0,$descr_len);
+ $sensor['sensor_descr_fixed'] = str_replace(':','\:',str_replace('\*','*',$sensor['sensor_descr_fixed']));
- $rrd_options .= " DEF:volt$volt_id=$rrd_filename:volt:AVERAGE";
- $rrd_options .= " LINE1:volt$volt_id#".$colour.":'" . $descr . "'";
- $rrd_options .= " GPRINT:volt$volt_id:AVERAGE:%5.2lfV";
- $rrd_options .= " GPRINT:volt$volt_id:MIN:%5.2lfV";
- $rrd_options .= " GPRINT:volt$volt_id:MAX:%5.2lfV\\\\l";
+ $rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/volt-" . safename($sensor['sensor_type']."-".$sensor['sensor_index']) . ".rrd";
+ $sensor_id = $sensor['sensor_id'];
+
+ $rrd_options .= " DEF:s$sensor_id=$rrd_filename:volt:AVERAGE";
+ $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++;
}
diff --git a/html/includes/graphs/sensor/temperature.inc.php b/html/includes/graphs/sensor/temperature.inc.php
index 5f82804460..122a83abff 100644
--- a/html/includes/graphs/sensor/temperature.inc.php
+++ b/html/includes/graphs/sensor/temperature.inc.php
@@ -11,6 +11,7 @@ include("includes/graphs/common.inc.php");
$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'] = str_replace(':','\:',str_replace('\*','*',$sensor['sensor_descr_fixed']));
$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: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('\*','*',$sensor['sensor_descr_fixed']))."'"; # Ugly hack :(
+ $rrd_options .= " LINE1:temp#cc0000:'" . $sensor['sensor_descr_fixed']."'";
$rrd_options .= " LINE1:tempwarm#660000";
$rrd_options .= " GPRINT:temp:LAST:%4.1lfC";
$rrd_options .= " GPRINT:temp:MIN:%4.1lfC";
diff --git a/html/includes/graphs/sensor/voltage.inc.php b/html/includes/graphs/sensor/voltage.inc.php
index bd48743bde..2d5e6ca59c 100644
--- a/html/includes/graphs/sensor/voltage.inc.php
+++ b/html/includes/graphs/sensor/voltage.inc.php
@@ -6,26 +6,23 @@ include("includes/graphs/common.inc.php");
$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 .= " DEF:volt_max=$rrd_filename:volt:MAX";
- $rrd_options .= " DEF:volt_min=$rrd_filename:volt:MIN";
-
- $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";
+#$rrd_options .= " AREA:volt#FFFF99";
+$rrd_options .= " LINE1.5:volt#cc0000:'" . $sensor['sensor_descr_fixed']."'";
+$rrd_options .= " GPRINT:volt:LAST:%3.2lfV";
+$rrd_options .= " GPRINT:volt:MAX:%3.2lfV\\\\l";
?>
diff --git a/html/pages/device/health/temperatures.inc.php b/html/pages/device/health/temperatures.inc.php
index dbdc453f4d..8769268a52 100644
--- a/html/pages/device/health/temperatures.inc.php
+++ b/html/pages/device/health/temperatures.inc.php
@@ -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; }
echo("
- " . $temp['sensor_descr'] . " |
- " . $temp['sensor_type'] . " |
- " . print_temperature($temp['sensor_current'], $temp['sensor_limit']) . " °C |
- " . $temp['sensor_limit'] . " °C |
- " . $temp['sensor_notes'] . " |
+ " . $temp['sensor_descr'] . " |
+ " . $temp['sensor_type'] . " |
+ " . print_temperature($temp['sensor_current'], $temp['sensor_limit']) . " °C |
+ " . $temp['sensor_limit'] . " °C |
+ " . $temp['sensor_notes'] . " |
\n");
- echo("");
+ echo(" |
");
$graph_type = "sensor_temperature";
diff --git a/html/pages/device/health/voltages.inc.php b/html/pages/device/health/voltages.inc.php
index 1cf74e32f5..7f0deed991 100644
--- a/html/pages/device/health/voltages.inc.php
+++ b/html/pages/device/health/voltages.inc.php
@@ -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; }
echo(" |
- " . $volt['sensor_descr'] . " |
- " . $volt['sensor_current'] . "V |
- " . $volt['sensor_limit_low'] . 'V - ' . $volt['sensor_limit'] . "V |
- " . $volt['sensor_notes'] . " |
+ " . $volt['sensor_descr'] . " |
+ " . $volt['sensor_type'] . " |
+ " . $volt['sensor_current'] . "V |
+ " . $volt['sensor_limit_low'] . 'V - ' . $volt['sensor_limit'] . "V |
+ " . $volt['sensor_notes'] . " |
\n");
- echo("");
+ echo(" |
");
$graph_type = "sensor_voltage";
diff --git a/includes/discovery/cisco-entity-sensor.inc.php b/includes/discovery/cisco-entity-sensor.inc.php
index 53fb8bd837..04c0cb60e3 100644
--- a/includes/discovery/cisco-entity-sensor.inc.php
+++ b/includes/discovery/cisco-entity-sensor.inc.php
@@ -33,11 +33,19 @@ if ($device['os'] == "ios" || $device['os_group'] == "ios")
if($entitysensor[$entry['entSensorType']] && is_numeric($entry['entSensorValue']) && is_numeric($index))
{
$entPhysicalIndex = $index;
- $entPhysicalIndex_measured = $entry['entSensorMeasuredEntity'];
- $descr = snmp_get($device, "entPhysicalDescr.".$index, "-Oqv", "ENTITY-MIB");
+ $descr = snmp_get($device, "entPhysicalName.".$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;
$current = $entry['entSensorValue'];
-
$type = $entitysensor[$entry['entSensorType']];
#echo("$index : ".$entry['entSensorScale']."|");
@@ -51,7 +59,6 @@ if ($device['os'] == "ios" || $device['os_group'] == "ios")
if($entry['entSensorScale'] == "giga") { $divisor = "1"; $multiplier = "1000000000"; }
$current = $current * $multiplier / $divisor;
-
discover_sensor($valid_sensor, $type, $device, $oid, $index, 'cisco-entity-sensor', $descr, $divisor, $multiplier, NULL, NULL, NULL, NULL, $temperature);
$cisco_entity_temperature = 1;
diff --git a/includes/polling/voltages.inc.php b/includes/polling/voltages.inc.php
index 3e2d7b8ff0..483fc9a0b1 100755
--- a/includes/polling/voltages.inc.php
+++ b/includes/polling/voltages.inc.php
@@ -2,16 +2,19 @@
$query = "SELECT * FROM sensors WHERE sensor_class='voltage' AND device_id = '" . $device['device_id'] . "'";
$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 ($voltage['sensor_multiplier']) { $volt = $volt * $voltage['sensor_multiplier']; }
+ if ($sensor['sensor_divisor']) { $volt = $volt / $sensor['sensor_divisor']; }
+ 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)) {
`rrdtool create $rrd_file \
@@ -27,25 +30,25 @@ while($voltage = mysql_fetch_array($volt_data)) {
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']; }
- $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']);
- notify($device, "Voltage Alarm: " . $device['hostname'] . " " . $voltage['sensor_descr'], $msg);
- echo("Alerting for " . $device['hostname'] . " " . $voltage['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']);
+ notify($device, "Voltage Alarm: " . $device['hostname'] . " " . $sensor['sensor_descr'], $msg);
+ 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['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']; }
- $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']);
- notify($device, "Voltage Alarm: " . $device['hostname'] . " " . $voltage['sensor_descr'], $msg);
- echo("Alerting for " . $device['hostname'] . " " . $voltage['sensor_descr'] . "\n");
- log_event('Voltage ' . $voltage['sensor_descr'] . " above threshold: " . $volt . " V (> " . $voltage['sensor_limit'] . " V)", $device['device_id'], 'voltage', $voltage['sensor_id']);
+ notify($device, "Voltage Alarm: " . $device['hostname'] . " " . $sensor['sensor_descr'], $msg);
+ echo("Alerting for " . $device['hostname'] . " " . $sensor['sensor_descr'] . "\n");
+ 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'] . "'");
}
?>
|