remove battery status from areca; code cleanup; insert into eventlog when device is XDP-discovered

git-svn-id: http://www.observium.org/svn/observer/trunk@2601 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Tom Laermans
2011-09-28 14:30:24 +00:00
parent f4def07b2d
commit 649e8586e1
3 changed files with 24 additions and 11 deletions
+15 -1
View File
@@ -25,6 +25,11 @@ if ($device['os'] == "ironware")
if (!$remote_device_id)
{
$remote_device_id = discover_new_device($fdp['snFdpCacheDeviceId']);
if ($remote_device_id)
{
$int = ifNameDescr($interface);
log_event("Device autodiscovered through FDP on " . $device['hostname'] . " (port " . $int['label'] . ")", $remote_device_id, 'interface', $int['interface_id']);
}
}
if ($remote_device_id)
@@ -57,8 +62,12 @@ if ($cdp_array)
if (!$remote_device_id)
{
$remote_device_id = discover_new_device($cdp['cdpCacheDeviceId']);
if ($remote_device_id)
{
$int = ifNameDescr($interface);
log_event("Device autodiscovered through CDP on " . $device['hostname'] . " (port " . $int['label'] . ")", $remote_device_id, 'interface', $int['interface_id']);
}
}
if ($remote_device_id)
{
@@ -104,6 +113,11 @@ if ($lldp_array)
if (!$remote_device_id)
{
$remote_device_id = discover_new_device($lldp['lldpRemSysName']);
if ($remote_device_id)
{
$int = ifNameDescr($interface);
log_event("Device autodiscovered through LLDP on " . $device['hostname'] . " (port " . $int['label'] . ")", $remote_device_id, 'interface', $int['interface_id']);
}
}
if ($remote_device_id)
+2 -3
View File
@@ -137,7 +137,7 @@ function discover_sensor(&$valid, $class, $device, $oid, $index, $type, $descr,
{
$sensor_entry = dbFetchRow("SELECT * FROM `sensors` WHERE `sensor_class` = ? AND `device_id` = ? AND `sensor_type` = ? AND `sensor_index` = ?", array($class, $device['device_id'], $type, $index));
if (!$high_limit)
if (!isset($high_limit))
{
if (!$sensor_entry['sensor_limit'])
{
@@ -149,7 +149,6 @@ function discover_sensor(&$valid, $class, $device, $oid, $index, $type, $descr,
if ($high_limit != $sensor_entry['sensor_limit'])
{
$update = array('sensor_limit' => ($high_limit == NULL ? NULL : $high_limit));
$updated = dbUpdate($update, 'sensors', '`sensor_id` = ?', array($sensor_entry['sensor_id']));
if ($debug) { echo("( $updated updated )\n"); }
@@ -157,7 +156,7 @@ function discover_sensor(&$valid, $class, $device, $oid, $index, $type, $descr,
log_event("Sensor High Limit Updated: ".mres($class)." ".mres($type)." ". mres($index)." ".mres($descr)." (".$high_limit.")", $device, 'sensor', $sensor_id);
}
if (!$low_limit)
if (!isset($low_limit))
{
if (!$sensor_entry['sensor_limit_low'])
{
+1 -1
View File
@@ -20,7 +20,7 @@ if ($device['os'] == "areca")
$index = $split_oid[count($split_oid)-1];
$oid = "1.3.6.1.4.1.18928.1.2.2.1.8.1.3." . $index;
$current = snmp_get($device, $oid, "-Oqv", "") / $divisor;
if ($descr != '"Battery Status"' || $current != 0.255) # FIXME not sure if this is supposed to be a voltage, but without BBU it's 225, then ignore.
if ($descr != '"Battery Status"') # Battery Status is charge percentage, or 255 when no BBU
{
discover_sensor($valid['sensor'], 'voltage', $device, $oid, $index, $type, trim($descr,'"'), $divisor, '1', NULL, NULL, NULL, NULL, $current);
}