diff --git a/includes/discovery/discovery-protocols.inc.php b/includes/discovery/discovery-protocols.inc.php index 4038727e16..342af5944e 100755 --- a/includes/discovery/discovery-protocols.inc.php +++ b/includes/discovery/discovery-protocols.inc.php @@ -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) @@ -54,11 +59,15 @@ if ($cdp_array) $cdp = $cdp_if_array[$entry_key]; $remote_device_id = @mysql_result(mysql_query("SELECT `device_id` FROM `devices` WHERE `sysName` = '".$cdp['cdpCacheDeviceId']."' OR `hostname`='".$cdp['cdpCacheDeviceId']."'"), 0); - if (!$remote_device_id) + if (!$remote_device_id) + { + $remote_device_id = discover_new_device($cdp['cdpCacheDeviceId']); + if ($remote_device_id) { - $remote_device_id = discover_new_device($cdp['cdpCacheDeviceId']); + $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) @@ -114,8 +128,8 @@ if ($lldp_array) $remote_interface_id = "0"; } - if (is_numeric($interface['interface_id']) && isset($lldp['lldpRemSysName']) && isset($lldp['lldpRemPortId'])) - { + if (is_numeric($interface['interface_id']) && isset($lldp['lldpRemSysName']) && isset($lldp['lldpRemPortId'])) + { discover_link($interface['interface_id'], 'lldp', $remote_interface_id, $lldp['lldpRemSysName'], $lldp['lldpRemPortId'], NULL, $lldp['lldpRemSysDesc']); } } diff --git a/includes/discovery/functions.inc.php b/includes/discovery/functions.inc.php index 183fdc00ee..1cfa3af2df 100644 --- a/includes/discovery/functions.inc.php +++ b/includes/discovery/functions.inc.php @@ -137,11 +137,11 @@ 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']) { - $high_limit = sensor_limit($class, $current); + $high_limit = sensor_limit($class, $current); } else { $high_limit = $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,11 +156,11 @@ 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']) { - $low_limit = sensor_low_limit($class, $current); + $low_limit = sensor_low_limit($class, $current); } else { $low_limit = $sensor_entry['sensor_limit_low']; } diff --git a/includes/discovery/voltages/areca.inc.php b/includes/discovery/voltages/areca.inc.php index df86c7b20c..dc065e121b 100644 --- a/includes/discovery/voltages/areca.inc.php +++ b/includes/discovery/voltages/areca.inc.php @@ -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); }