mirror of
https://github.com/librenms/librenms.git
synced 2024-09-22 10:58:42 +00:00
fix temperatures i think.
git-svn-id: http://www.observium.org/svn/observer/trunk@2239 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
parent
7cd3dc86ec
commit
20c2f225c9
@ -1,13 +1,11 @@
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
if ($device['os'] == "ios" || $device['os_group'] == "ios")
|
||||
{
|
||||
echo("\nCISCO-ENTITY-SENSOR");
|
||||
echo(" CISCO-ENTITY-SENSOR: ");
|
||||
|
||||
$oids = array();
|
||||
echo("\nCaching OIDs:");
|
||||
echo(" Caching OIDs: ");
|
||||
|
||||
if (!is_array($entity_array))
|
||||
{
|
||||
@ -37,8 +35,6 @@ if ($device['os'] == "ios" || $device['os_group'] == "ios")
|
||||
echo(" entSensorThresholdValue");
|
||||
$t_oids = snmpwalk_cache_twopart_oid($device, "entSensorThresholdValue", $t_oids, "CISCO-ENTITY-SENSOR-MIB");
|
||||
|
||||
echo("\nSensors: ");
|
||||
|
||||
if ($debug) { print_r($oids); }
|
||||
|
||||
$entitysensor['voltsDC'] = "voltage";
|
||||
|
@ -1,7 +1,5 @@
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
echo(" ENTITY-SENSOR ");
|
||||
|
||||
echo("\nCaching OIDs:");
|
||||
@ -56,7 +54,7 @@ if (is_array($oids))
|
||||
$descr = rewrite_entity_descr($descr);
|
||||
}
|
||||
|
||||
$valid = TRUE;
|
||||
$thisisnotbullshit = TRUE;
|
||||
|
||||
$type = $entitysensor[$entry['entPhySensorType']];
|
||||
|
||||
@ -73,13 +71,13 @@ if (is_array($oids))
|
||||
if (is_numeric($entry['entPhySensorPrecision']) && $entry['entPhySensorPrecision'] > "0") { $divisor = $divisor . str_pad('', $entry['entPhySensorPrecision'], "0"); }
|
||||
$current = $current * $multiplier / $divisor;
|
||||
|
||||
if ($type == "temperature") { if ($current > "200"){ $valid = FALSE; } $descr = preg_replace("/[T|t]emperature[|s]/", "", $descr); }
|
||||
if ($type == "temperature") { if ($current > "200"){ $thisisnotbullshit = FALSE; } $descr = preg_replace("/[T|t]emperature[|s]/", "", $descr); }
|
||||
|
||||
#echo($descr . "|" . $index . "|" .$current . "|" . $multiplier . "|" . $divisor ."|" . $entry['entPhySensorScale'] . "|" . $entry['entPhySensorPrecision'] . "\n");
|
||||
|
||||
if ($current == "-127") { $valid = FALSE; }
|
||||
if ($current == "-127") { $thisisnotbullshit = FALSE; }
|
||||
|
||||
if ($valid && mysql_result(mysql_query("SELECT COUNT(*) FROM `sensors` WHERE `device_id` = '".$device['device_id']."' AND `sensor_class` = '".$type."' AND `sensor_type` = 'cisco-entity-sensor' AND `sensor_index` = '".$index."'"),0) == "0")
|
||||
if ($thisisnotbullshit && mysql_result(mysql_query("SELECT COUNT(*) FROM `sensors` WHERE `device_id` = '".$device['device_id']."' AND `sensor_class` = '".$type."' AND `sensor_type` = 'cisco-entity-sensor' AND `sensor_index` = '".$index."'"),0) == "0")
|
||||
## Check to make sure we've not already seen this sensor via cisco's entity sensor mib
|
||||
{
|
||||
discover_sensor($valid['sensor'], $type, $device, $oid, $index, 'entity-sensor', $descr, $divisor, $multiplier, NULL, NULL, NULL, NULL, $current);
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
### Discover sensors
|
||||
function discover_sensor(&$this_valid, $class, $device, $oid, $index, $type, $descr, $divisor = '1', $multiplier = '1', $low_limit = NULL, $low_warn_limit = NULL, $warn_limit = NULL, $high_limit = NULL, $current = NULL, $poller_type = 'snmp')
|
||||
function discover_sensor(&$valid, $class, $device, $oid, $index, $type, $descr, $divisor = '1', $multiplier = '1', $low_limit = NULL, $low_warn_limit = NULL, $warn_limit = NULL, $high_limit = NULL, $current = NULL, $poller_type = 'snmp')
|
||||
{
|
||||
global $config, $debug;
|
||||
|
||||
@ -74,7 +74,7 @@ function discover_sensor(&$this_valid, $class, $device, $oid, $index, $type, $de
|
||||
if ($debug) { echo("$query\n". mysql_affected_rows() . " updated\n"); }
|
||||
}
|
||||
}
|
||||
$this_valid[$class][$type][$index] = 1;
|
||||
$valid[$class][$type][$index] = 1;
|
||||
}
|
||||
|
||||
function sensor_low_limit($class, $current)
|
||||
@ -140,7 +140,7 @@ function sensor_limit($class, $current)
|
||||
return $limit;
|
||||
}
|
||||
|
||||
function check_valid_sensors($device, $class, $this_valid)
|
||||
function check_valid_sensors($device, $class, $valid)
|
||||
{
|
||||
$sql = "SELECT * FROM sensors AS S, devices AS D WHERE S.sensor_class='".$class."' AND S.device_id = D.device_id AND D.device_id = '".$device['device_id']."'";
|
||||
if ($query = mysql_query($sql))
|
||||
@ -150,7 +150,7 @@ function check_valid_sensors($device, $class, $this_valid)
|
||||
$index = $test['sensor_index'];
|
||||
$type = $test['sensor_type'];
|
||||
if ($debug) { echo($index . " -> " . $type . "\n"); }
|
||||
if (!$this_valid[$class][$type][$index])
|
||||
if (!$valid[$class][$type][$index])
|
||||
{
|
||||
echo("-");
|
||||
mysql_query("DELETE FROM `sensors` WHERE sensor_class='".$class."' AND sensor_id = '" . $test['sensor_id'] . "'");
|
||||
@ -161,7 +161,7 @@ function check_valid_sensors($device, $class, $this_valid)
|
||||
}
|
||||
}
|
||||
|
||||
function discover_juniAtmVp(&$this_valid, $interface_id, $vp_id, $vp_descr)
|
||||
function discover_juniAtmVp(&$valid, $interface_id, $vp_id, $vp_descr)
|
||||
{
|
||||
global $config, $debug;
|
||||
|
||||
@ -177,7 +177,7 @@ function discover_juniAtmVp(&$this_valid, $interface_id, $vp_id, $vp_descr)
|
||||
{
|
||||
echo(".");
|
||||
}
|
||||
$this_valid[$interface_id][$vp_id] = 1;
|
||||
$valid[$interface_id][$vp_id] = 1;
|
||||
}
|
||||
|
||||
function discover_link($local_interface_id, $protocol, $remote_interface_id, $remote_hostname, $remote_port, $remote_platform, $remote_version)
|
||||
@ -210,7 +210,7 @@ function discover_link($local_interface_id, $protocol, $remote_interface_id, $re
|
||||
$link_exists[$local_interface_id][$remote_hostname][$remote_port] = 1;
|
||||
}
|
||||
|
||||
function discover_storage(&$this_valid, $device, $index, $type, $mib, $descr, $size, $units, $used = NULL)
|
||||
function discover_storage(&$valid, $device, $index, $type, $mib, $descr, $size, $units, $used = NULL)
|
||||
{
|
||||
global $config, $debug;
|
||||
|
||||
@ -233,12 +233,12 @@ function discover_storage(&$this_valid, $device, $index, $type, $mib, $descr, $s
|
||||
mysql_query($query);
|
||||
if ($debug) { print $query . "\n"; }
|
||||
}
|
||||
$this_valid[$mib][$index] = 1;
|
||||
$valid[$mib][$index] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function discover_processor(&$this_valid, $device, $oid, $index, $type, $descr, $precision = "1", $current = NULL, $entPhysicalIndex = NULL, $hrDeviceIndex = NULL)
|
||||
function discover_processor(&$valid, $device, $oid, $index, $type, $descr, $precision = "1", $current = NULL, $entPhysicalIndex = NULL, $hrDeviceIndex = NULL)
|
||||
{
|
||||
global $config, $debug;
|
||||
|
||||
@ -263,12 +263,12 @@ function discover_processor(&$this_valid, $device, $oid, $index, $type, $descr,
|
||||
mysql_query($query);
|
||||
if ($debug) { print $query . "\n"; }
|
||||
}
|
||||
$this_valid[$type][$index] = 1;
|
||||
$valid[$type][$index] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function discover_mempool(&$this_valid, $device, $index, $type, $descr, $precision = "1", $entPhysicalIndex = NULL, $hrDeviceIndex = NULL)
|
||||
function discover_mempool(&$valid, $device, $index, $type, $descr, $precision = "1", $entPhysicalIndex = NULL, $hrDeviceIndex = NULL)
|
||||
{
|
||||
global $config, $debug;
|
||||
|
||||
@ -293,11 +293,11 @@ function discover_mempool(&$this_valid, $device, $index, $type, $descr, $precisi
|
||||
mysql_query($query);
|
||||
if ($debug) { print $query . "\n"; }
|
||||
}
|
||||
$this_valid[$type][$index] = 1;
|
||||
$valid[$type][$index] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
function discover_toner(&$this_valid, $device, $oid, $index, $type, $descr, $capacity = NULL, $current = NULL)
|
||||
function discover_toner(&$valid, $device, $oid, $index, $type, $descr, $capacity = NULL, $current = NULL)
|
||||
{
|
||||
global $config, $debug;
|
||||
|
||||
@ -324,10 +324,10 @@ function discover_toner(&$this_valid, $device, $oid, $index, $type, $descr, $cap
|
||||
echo("U");
|
||||
}
|
||||
}
|
||||
$this_valid[$type][$index] = 1;
|
||||
$valid[$type][$index] = 1;
|
||||
}
|
||||
|
||||
function discover_process_ipv6(&$this_valid, $ifIndex,$ipv6_address,$ipv6_prefixlen,$ipv6_origin)
|
||||
function discover_process_ipv6(&$valid, $ifIndex,$ipv6_address,$ipv6_prefixlen,$ipv6_origin)
|
||||
{
|
||||
global $device,$config;
|
||||
|
||||
@ -370,8 +370,8 @@ function discover_process_ipv6(&$this_valid, $ifIndex,$ipv6_address,$ipv6_prefix
|
||||
echo(".");
|
||||
}
|
||||
$full_address = "$ipv6_address/$ipv6_prefixlen";
|
||||
$this_valid_address = $full_address . "-" . $interface_id;
|
||||
$this_valid['ipv6'][$this_valid_address] = 1;
|
||||
$valid_address = $full_address . "-" . $interface_id;
|
||||
$valid['ipv6'][$valid_address] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,5 @@
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
## IPMI
|
||||
if ($ipmi['host'] = get_dev_attrib($device,'ipmi_hostname'))
|
||||
{
|
||||
|
@ -5,8 +5,10 @@ $valid['sensor'] = array();
|
||||
echo("Sensors: ");
|
||||
|
||||
include("includes/discovery/cisco-entity-sensor.inc.php");
|
||||
print_r($valid['sensors']);
|
||||
include("includes/discovery/entity-sensor.inc.php");
|
||||
include("includes/discovery/ipmi.inc.php");
|
||||
print_r($valid['sensors']);
|
||||
|
||||
include("includes/discovery/temperatures.inc.php");
|
||||
include("includes/discovery/humidity.inc.php");
|
||||
|
Loading…
Reference in New Issue
Block a user