fix temperature and processors discovery

git-svn-id: http://www.observium.org/svn/observer/trunk@2238 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2011-05-04 12:58:57 +00:00
parent bccaa2c279
commit 7cd3dc86ec
36 changed files with 60 additions and 146 deletions

View File

@@ -2,8 +2,6 @@
echo("Physical Inventory : ");
unset($valid);
if ($config['enable_inventory']) {
@@ -86,8 +84,6 @@
}
}
unset($valid);
echo("\n");
?>

View File

@@ -1,7 +1,7 @@
<?php
### Discover sensors
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')
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')
{
global $config, $debug;
@@ -74,7 +74,7 @@ function discover_sensor(&$valid, $class, $device, $oid, $index, $type, $descr,
if ($debug) { echo("$query\n". mysql_affected_rows() . " updated\n"); }
}
}
$valid[$class][$type][$index] = 1;
$this_valid[$class][$type][$index] = 1;
}
function sensor_low_limit($class, $current)
@@ -140,19 +140,17 @@ function sensor_limit($class, $current)
return $limit;
}
function check_valid_sensors($device, $class, $valid)
function check_valid_sensors($device, $class, $this_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))
{
while ($test = mysql_fetch_assoc($query))
{
print_r($test);
$index = $test['sensor_index'];
$type = $test['sensor_type'];
if ($debug) { echo($index . " -> " . $type . "\n"); }
if (!$valid[$class][$type][$index])
if (!$this_valid[$class][$type][$index])
{
echo("-");
mysql_query("DELETE FROM `sensors` WHERE sensor_class='".$class."' AND sensor_id = '" . $test['sensor_id'] . "'");
@@ -163,8 +161,7 @@ function check_valid_sensors($device, $class, $valid)
}
}
function discover_juniAtmVp(&$valid, $interface_id, $vp_id, $vp_descr)
function discover_juniAtmVp(&$this_valid, $interface_id, $vp_id, $vp_descr)
{
global $config, $debug;
@@ -180,7 +177,7 @@ function discover_juniAtmVp(&$valid, $interface_id, $vp_id, $vp_descr)
{
echo(".");
}
$valid[$interface_id][$vp_id] = 1;
$this_valid[$interface_id][$vp_id] = 1;
}
function discover_link($local_interface_id, $protocol, $remote_interface_id, $remote_hostname, $remote_port, $remote_platform, $remote_version)
@@ -213,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(&$valid, $device, $index, $type, $mib, $descr, $size, $units, $used = NULL)
function discover_storage(&$this_valid, $device, $index, $type, $mib, $descr, $size, $units, $used = NULL)
{
global $config, $debug;
@@ -236,12 +233,12 @@ function discover_storage(&$valid, $device, $index, $type, $mib, $descr, $size,
mysql_query($query);
if ($debug) { print $query . "\n"; }
}
$valid[$mib][$index] = 1;
$this_valid[$mib][$index] = 1;
}
}
function discover_processor(&$valid, $device, $oid, $index, $type, $descr, $precision = "1", $current = NULL, $entPhysicalIndex = NULL, $hrDeviceIndex = NULL)
function discover_processor(&$this_valid, $device, $oid, $index, $type, $descr, $precision = "1", $current = NULL, $entPhysicalIndex = NULL, $hrDeviceIndex = NULL)
{
global $config, $debug;
@@ -266,12 +263,12 @@ function discover_processor(&$valid, $device, $oid, $index, $type, $descr, $prec
mysql_query($query);
if ($debug) { print $query . "\n"; }
}
$valid[$type][$index] = 1;
$this_valid[$type][$index] = 1;
}
}
function discover_mempool(&$valid, $device, $index, $type, $descr, $precision = "1", $entPhysicalIndex = NULL, $hrDeviceIndex = NULL)
function discover_mempool(&$this_valid, $device, $index, $type, $descr, $precision = "1", $entPhysicalIndex = NULL, $hrDeviceIndex = NULL)
{
global $config, $debug;
@@ -296,11 +293,11 @@ function discover_mempool(&$valid, $device, $index, $type, $descr, $precision =
mysql_query($query);
if ($debug) { print $query . "\n"; }
}
$valid[$type][$index] = 1;
$this_valid[$type][$index] = 1;
}
}
function discover_toner(&$valid, $device, $oid, $index, $type, $descr, $capacity = NULL, $current = NULL)
function discover_toner(&$this_valid, $device, $oid, $index, $type, $descr, $capacity = NULL, $current = NULL)
{
global $config, $debug;
@@ -327,10 +324,10 @@ function discover_toner(&$valid, $device, $oid, $index, $type, $descr, $capacity
echo("U");
}
}
$valid[$type][$index] = 1;
$this_valid[$type][$index] = 1;
}
function discover_process_ipv6(&$valid, $ifIndex,$ipv6_address,$ipv6_prefixlen,$ipv6_origin)
function discover_process_ipv6(&$this_valid, $ifIndex,$ipv6_address,$ipv6_prefixlen,$ipv6_origin)
{
global $device,$config;
@@ -373,8 +370,8 @@ function discover_process_ipv6(&$valid, $ifIndex,$ipv6_address,$ipv6_prefixlen,$
echo(".");
}
$full_address = "$ipv6_address/$ipv6_prefixlen";
$valid_address = $full_address . "-" . $interface_id;
$valid['ipv6'][$valid_address] = 1;
$this_valid_address = $full_address . "-" . $interface_id;
$this_valid['ipv6'][$this_valid_address] = 1;
}
}

View File

@@ -14,8 +14,8 @@ if ($device['os_group'] == "unix" && $count == "0")
if (is_numeric($percent))
{
discover_processor($valid_processor, $device, 0, 0, "ucd-old", "CPU", "1", $system+$user, NULL, NULL);
discover_processor($valid['processor'], $device, 0, 0, "ucd-old", "CPU", "1", $system+$user, NULL, NULL);
}
}
?>
?>

View File

@@ -2,8 +2,6 @@
echo("Processors : ");
global $valid_processor;
include_dir("includes/discovery/processors");
## Last-resort discovery here
@@ -15,14 +13,14 @@ include("processors-ucd-old.inc.php");
$sql = "SELECT * FROM `processors` WHERE `device_id` = '".$device['device_id']."'";
$query = mysql_query($sql);
if ($debug) { print_r ($valid_processor); }
if ($debug) { print_r ($valid['processor']); }
while ($test_processor = mysql_fetch_assoc($query))
{
$processor_index = $test_processor['processor_index'];
$processor_type = $test_processor['processor_type'];
if ($debug) { echo($processor_index . " -> " . $processor_type . "\n"); }
if (!$valid_processor[$processor_type][$processor_index])
if (!$valid['processor'][$processor_type][$processor_index])
{
echo("-");
mysql_query("DELETE FROM `processors` WHERE processor_id = '" . $test_processor['processor_id'] . "'");
@@ -30,7 +28,6 @@ while ($test_processor = mysql_fetch_assoc($query))
unset($processor_oid); unset($processor_type);
}
unset($valid_processor);
echo("\n");
?>

View File

@@ -1,7 +1,5 @@
<?php
global $valid_processor;
## Hardcoded discovery of device CPU usage on Alcatel-Lucent Omniswitches.
if ($device['os'] == "aos")
@@ -13,10 +11,10 @@ if ($device['os'] == "aos")
if (is_numeric($usage))
{
discover_processor($valid_processor, $device, "1.3.6.1.4.1.6486.800.1.2.1.16.1.1.1.13.0", "0", "aos-system", $descr, "1", $usage, NULL, NULL);
discover_processor($valid['processor'], $device, "1.3.6.1.4.1.6486.800.1.2.1.16.1.1.1.13.0", "0", "aos-system", $descr, "1", $usage, NULL, NULL);
}
}
unset ($processors_array);
?>
?>

View File

@@ -1,7 +1,5 @@
<?php
global $valid_processor;
echo("hrDevice ");
$hrDevice_oids = array('hrDevice','hrProcessorLoad');
unset($hrDevice_array);
@@ -40,7 +38,7 @@ if (is_array($hrDevice_array))
}
if (isset($descr) && $descr != "An electronic chip that makes the computer work.")
{
discover_processor($valid_processor, $device, $usage_oid, $index, "hr", $descr, "1", $usage, NULL, $hrDeviceIndex);
discover_processor($valid['processor'], $device, $usage_oid, $index, "hr", $descr, "1", $usage, NULL, $hrDeviceIndex);
}
unset($old_rrd,$new_rrd,$descr,$entry,$usage_oid,$index,$usage,$hrDeviceIndex,$descr_array);
}
@@ -51,4 +49,4 @@ if (is_array($hrDevice_array))
## End hrDevice Processors
?>
?>

View File

@@ -1,7 +1,5 @@
<?php
global $valid_processor;
if ($device['os'] == "ios" || $device['os_group'] == "ios")
{
echo("CISCO-PROCESS-MIB : ");
@@ -43,17 +41,17 @@ if ($device['os'] == "ios" || $device['os_group'] == "ios")
if (!strstr($descr, "No") && !strstr($usage, "No") && $descr != "")
{
discover_processor($valid_processor, $device, $usage_oid, $index, "cpm", $descr, "1", $entry['juniSystemModuleCpuUtilPct'], $entPhysicalIndex, NULL);
discover_processor($valid['processor'], $device, $usage_oid, $index, "cpm", $descr, "1", $entry['juniSystemModuleCpuUtilPct'], $entPhysicalIndex, NULL);
}
}
}
if (!is_array($valid_processor['cpm']))
if (!is_array($valid['processor']['cpm']))
{
$avgBusy5 = snmp_get($device, ".1.3.6.1.4.1.9.2.1.58.0", "-Oqv");
if (is_numeric($avgBusy5))
{
discover_processor($valid_processor, $device, ".1.3.6.1.4.1.9.2.1.58.0", "0", "ios", "Processor", "1", $avgBusy5, NULL, NULL);
discover_processor($valid['processor'], $device, ".1.3.6.1.4.1.9.2.1.58.0", "0", "ios", "Processor", "1", $avgBusy5, NULL, NULL);
}
}
}
@@ -61,4 +59,4 @@ if ($device['os'] == "ios" || $device['os_group'] == "ios")
unset ($processors_array);
?>
?>

View File

@@ -1,7 +1,5 @@
<?php
global $valid_processor;
if ($device['os'] == "ironware" || $device['os_group'] == "ironware")
{
echo("IronWare : ");
@@ -36,7 +34,7 @@ if ($device['os'] == "ironware" || $device['os_group'] == "ironware")
if (!strstr($descr, "No") && !strstr($usage, "No") && $descr != "")
{
discover_processor($valid_processor, $device, $usage_oid, $index, "ironware", $descr, $precision, $usage, $entPhysicalIndex, NULL);
discover_processor($valid['processor'], $device, $usage_oid, $index, "ironware", $descr, $precision, $usage, $entPhysicalIndex, NULL);
}
}
}
@@ -44,4 +42,4 @@ if ($device['os'] == "ironware" || $device['os_group'] == "ironware")
unset ($processors_array);
?>
?>

View File

@@ -1,7 +1,5 @@
<?php
global $valid_processor;
## JUNOS Processors
if ($device['os'] == "junos")
{
@@ -23,7 +21,7 @@ if ($device['os'] == "junos")
$usage = $entry['jnxOperatingCPU'];
if (!strstr($descr, "No") && !strstr($usage, "No") && $descr != "")
{
discover_processor($valid_processor, $device, $usage_oid, $index, "junos", $descr, "1", $usage, NULL, NULL);
discover_processor($valid['processor'], $device, $usage_oid, $index, "junos", $descr, "1", $usage, NULL, NULL);
}
} ## End if checks
} ## End Foreach
@@ -32,4 +30,4 @@ if ($device['os'] == "junos")
unset ($processors_array);
?>
?>

View File

@@ -1,7 +1,5 @@
<?php
global $valid_processor;
## JUNOSe Processors
if ($device['os'] == "junose")
{
@@ -21,7 +19,7 @@ if ($device['os'] == "junose")
if (!strstr($descr, "No") && !strstr($usage, "No") && $descr != "")
{
discover_processor($valid_processor, $device, $usage_oid, $index, "junose", $descr, "1", $usage, $entPhysicalIndex, NULL);
discover_processor($valid['processor'], $device, $usage_oid, $index, "junose", $descr, "1", $usage, $entPhysicalIndex, NULL);
}
}
}
@@ -29,4 +27,4 @@ if ($device['os'] == "junose")
unset ($processors_array);
?>
?>

View File

@@ -1,7 +1,5 @@
<?php
global $valid_processor;
##
## Hardcoded discovery of cpu usage on HP Procurve devices.
##
@@ -17,10 +15,10 @@ if ($device['os'] == "procurve")
if (is_numeric($usage))
{
discover_processor($valid_processor, $device, "1.3.6.1.4.1.11.2.14.11.5.1.9.6.1.0", "0", "procurve-fixed", $descr, "1", $usage, NULL, NULL);
discover_processor($valid['processor'], $device, "1.3.6.1.4.1.11.2.14.11.5.1.9.6.1.0", "0", "procurve-fixed", $descr, "1", $usage, NULL, NULL);
}
}
unset ($processors_array);
?>
?>

View File

@@ -1,7 +1,5 @@
<?php
global $valid_processor;
##
## Hardcoded discovery of cpu usage on RADLAN devices.
##
@@ -15,10 +13,10 @@ if ($device['os'] == "radlan")
if (is_numeric($usage))
{
discover_processor($valid_processor, $device, ".1.3.6.1.4.1.89.1.9.0", "0", "radlan", $descr, "1", $usage, NULL, NULL);
discover_processor($valid['processor'], $device, ".1.3.6.1.4.1.89.1.9.0", "0", "radlan", $descr, "1", $usage, NULL, NULL);
}
}
unset ($processors_array);
?>
?>

View File

@@ -11,8 +11,8 @@ if ($device['os'] == "screenos" && mysql_result(mysql_query("SELECT COUNT(*) FRO
if (is_numeric($percent))
{
discover_processor($valid_processor, $device, ".1.3.6.1.4.1.3224.16.1.3.0", "1", "screenos", "Processor", "1", $percent, NULL, NULL);
discover_processor($valid['processor'], $device, ".1.3.6.1.4.1.3224.16.1.3.0", "1", "screenos", "Processor", "1", $percent, NULL, NULL);
}
}
?>
?>

View File

@@ -1,7 +1,5 @@
<?php
if ($device['os'] == "akcp" || $device['os'] == "minkelsrms")
{
$oids = snmp_walk($device, ".1.3.6.1.4.1.3854.1.2.2.1.16.1.4", "-Osqn", "");
@@ -38,4 +36,4 @@ if ($device['os'] == "akcp" || $device['os'] == "minkelsrms")
}
}
?>
?>

View File

@@ -1,7 +1,5 @@
<?php
if ($device['os'] == "aos")
{
echo("Alcatel-Lucent Device: ");

View File

@@ -1,7 +1,5 @@
<?php
if ($device['os'] == "apc")
{
$oids = snmp_get($device, "1.3.6.1.4.1.318.1.1.1.2.2.2.0", "-OsqnU", "");

View File

@@ -1,7 +1,5 @@
<?php
if ($device['os'] == "areca")
{
$oids = snmp_walk($device, "1.3.6.1.4.1.18928.1.1.2.14.1.2", "-Osqn", "");
@@ -47,4 +45,4 @@ if ($device['os'] == "areca")
}
}
?>
?>

View File

@@ -1,7 +1,5 @@
<?php
global $entity_temperature;
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `sensors` WHERE `device_id` = '".$device['device_id']."' AND `sensor_class` = 'temperature' AND (`sensor_type` = 'cisco-entity-sensor' OR `sensor_type` = 'entity-sensor')"),0) == "0" && ($device['os'] == "ios" || $device['os_group'] == "ios"))
{
echo("Cisco ");
@@ -27,6 +25,8 @@ if (mysql_result(mysql_query("SELECT COUNT(*) FROM `sensors` WHERE `device_id` =
discover_sensor($valid['sensor'], 'temperature', $device, $oid, $index, 'cisco', $descr, '1', '1', NULL, NULL, NULL, NULL, $temperature);
print_r($valid['sensor']);
}
}
}

View File

@@ -1,7 +1,5 @@
<?php
if ($device['os'] == "cometsystem-p85xx")
{
$regexp = '/
@@ -62,4 +60,4 @@ if ($device['os'] == "cometsystem-p85xx")
}
}
?>
?>

View File

@@ -1,7 +1,5 @@
<?php
if (strstr($device['hardware'], "dell"))
{
$oids = snmp_walk($device, "coolingDeviceDiscreteReading", "-Osqn", "MIB-Dell-10892");
@@ -24,4 +22,4 @@ if (strstr($device['hardware'], "dell"))
}
?>
?>

View File

@@ -1,7 +1,5 @@
<?php
### Force10 C-Series
#F10-C-SERIES-CHASSIS-MIB::chSysCardType.1 = INTEGER: lc4802E48TB(1024)
@@ -12,9 +10,7 @@
if ($device['os'] == "ftos" || $device['os_group'] == "ftos")
{
echo("FTOS C-Series ");
$oids = snmpwalk_cache_oid($device, "chSysCardTemp", array(), "F10-C-SERIES-CHASSIS-MIB", $config['mib_dir'].":".$config['mib_dir']."/ftos" );
if (is_array($oids))
{
foreach ($oids as $index => $entry)
@@ -22,16 +18,9 @@ if ($device['os'] == "ftos" || $device['os_group'] == "ftos")
$entry['descr'] = "Slot ".$index;
$entry['oid'] = ".1.3.6.1.4.1.6027.3.8.1.2.1.1.5.".$index;
$entry['current'] = $entry['chSysCardTemp'];
discover_sensor($valid['sensor'], 'temperature', $device, $entry['oid'], $index, 'ftos-cseries', $entry['descr'], '1', '1', NULL, NULL, NULL, NULL, $entry['current']);
}
unset($entry);
}
unset($oids);
}
?>

View File

@@ -1,7 +1,5 @@
<?php
### Force10 E-Series
#F10-CHASSIS-MIB::chSysCardType.1 = INTEGER: rpmCardEF3(206)
@@ -28,8 +26,6 @@ if ($device['os'] == "ftos" || $device['os_group'] == "ftos")
discover_sensor($valid['sensor'], 'temperature', $device, $oid, $index, 'ftos-eseries', $descr, '1', '1', NULL, NULL, NULL, NULL, $current);
}
}
unset($oids);
}
?>
?>

View File

@@ -1,7 +1,5 @@
<?php
### Force10 S-Series
#F10-S-SERIES-CHASSIS-MIB::chStackUnitTemp.1 = Gauge32: 47
@@ -21,12 +19,9 @@ if ($device['os'] == "ftos" || $device['os_group'] == "ftos")
$descr = "Unit ".$index . " " . $entry['chStackUnitSysType'];
$oid = ".1.3.6.1.4.1.6027.3.10.1.2.2.1.14.".$index;
$current = $entry['chStackUnitTemp'];
discover_sensor($valid['sensor'], 'temperature', $device, $oid, $index, 'ftos-sseries', $descr, '1', '1', NULL, NULL, NULL, NULL, $current);
}
}
unset($oids);
}
?>
?>

View File

@@ -3,8 +3,6 @@
# FIXME: EMD "stack" support?
# FIXME: What to do with IPOMANII-MIB::ipmEnvEmdConfigTempOffset.0 ?
if ($device['os'] == "ipoman")
{
echo(" IPOMANII-MIB ");
@@ -27,4 +25,4 @@ if ($device['os'] == "ipoman")
}
}
?>
?>

View File

@@ -1,7 +1,5 @@
<?php
if ($device['os'] == "ironware")
{
echo("IronWare ");
@@ -38,4 +36,4 @@ if ($device['os'] == "ironware")
}
}
?>
?>

View File

@@ -1,7 +1,5 @@
<?php
if ($device['os'] == "junos" || $device['os_group'] == "junos")
{
echo("JunOS ");
@@ -32,4 +30,4 @@ if ($device['os'] == "junos" || $device['os_group'] == "junos")
}
}
?>
?>

View File

@@ -1,7 +1,5 @@
<?php
## JunOSe Temperatures
if ($device['os'] == "junose")
@@ -27,4 +25,4 @@ if ($device['os'] == "junose")
}
}
?>
?>

View File

@@ -1,7 +1,5 @@
<?php
if ($device['os'] == "linux")
{
$oids = snmp_walk($device, "lmTempSensorsDevice", "-Osqn", "LM-SENSORS-MIB");
@@ -29,4 +27,4 @@ if ($device['os'] == "linux")
}
}
?>
?>

View File

@@ -1,7 +1,5 @@
<?php
if ($device['os_group'] == "unix")
{
# FIXME snmp_walk
@@ -25,4 +23,4 @@ if ($device['os_group'] == "unix")
}
}
?>
?>

View File

@@ -1,7 +1,5 @@
<?php
if ($device['os'] == "papouch-tme")
{
echo("Papouch TME ");
@@ -17,4 +15,4 @@ if ($device['os'] == "papouch-tme")
}
}
?>
?>

View File

@@ -1,7 +1,5 @@
<?php
if ($device['os'] == "powerconnect")
{
$oids = snmp_get($device, ".1.3.6.1.4.1.674.10895.5000.2.6132.1.1.43.1.8.1.4.0", "-OsqnU", "");
@@ -20,4 +18,4 @@ if ($device['os'] == "powerconnect")
}
}
?>
?>

View File

@@ -1,7 +1,5 @@
<?php
if ($device['os'] == "netmanplus" || $device['os'] == "deltaups" || $device['os'] == "poweralert")
{
$oids = snmp_walk($device, "1.3.6.1.2.1.33.1.2.7", "-Osqn", "UPS-MIB");

View File

@@ -1,7 +1,5 @@
<?php
if ($device['os'] == "sentry3")
{
$oids = snmp_walk($device, "tempHumidSensorTempValue", "-Osqn", "Sentry3-MIB");
@@ -32,9 +30,7 @@ if ($device['os'] == "sentry3")
discover_sensor($valid['sensor'], 'temperature', $device, $temperature_oid, $index, 'sentry3', $descr, $divisor, $multiplier, $low_limit, $low_warn_limit, $high_warn_limit, $high_limit, $current);
}
}
unset($data);
}
unset($oids);
}
?>

View File

@@ -1,7 +1,5 @@
<?php
if ($device['os'] == "linux")
{
# Supermicro sensors
@@ -38,4 +36,4 @@ if ($device['os'] == "linux")
}
}
?>
?>

View File

@@ -1,7 +1,5 @@
<?php
if ($device['os'] == "powerware")
{
# XUPS-MIB::xupsEnvAmbientTemp.0 = INTEGER: 52
@@ -30,4 +28,4 @@ if ($device['os'] == "powerware")
}
}
?>
?>

View File

@@ -1,7 +1,5 @@
<?php
if ($device['os'] == 'ies')
{
echo("ZyXEL IES ");
@@ -25,4 +23,4 @@ if ($device['os'] == 'ies')
}
}
?>
?>