From 606751f6fd27c48ca6764f28ae74063f2bc203b5 Mon Sep 17 00:00:00 2001 From: Adam Amstrong Date: Fri, 11 May 2012 18:01:28 +0000 Subject: [PATCH] port poller git-svn-id: http://www.observium.org/svn/observer/trunk@3172 61d68cd4-352d-0410-923a-c4978735b2b8 --- includes/discovery/ports.inc.php | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/includes/discovery/ports.inc.php b/includes/discovery/ports.inc.php index 07a843ff8..6d3300c99 100755 --- a/includes/discovery/ports.inc.php +++ b/includes/discovery/ports.inc.php @@ -13,13 +13,13 @@ foreach(dbFetchRows("SELECT * FROM `ports` WHERE `device_id` = ?", array($device #print_r($ports_db); -$ports = array(); -$ports = snmpwalk_cache_oid($device, "ifDescr", $ports, "IF-MIB"); -$ports = snmpwalk_cache_oid($device, "ifName", $ports, "IF-MIB"); -$ports = snmpwalk_cache_oid($device, "ifType", $ports, "IF-MIB"); +$port_stats = array(); +$port_stats = snmpwalk_cache_oid($device, "ifDescr", $port_stats, "IF-MIB"); +$port_stats = snmpwalk_cache_oid($device, "ifName", $port_stats, "IF-MIB"); +$port_stats = snmpwalk_cache_oid($device, "ifType", $port_stats, "IF-MIB"); -### New interface detection -foreach ($ports as $ifIndex => $port) +/// New interface detection +foreach ($port_stats as $ifIndex => $port) { /// Check the port against our filters. if (is_port_valid($port, $device)) @@ -43,15 +43,16 @@ foreach ($ports as $ifIndex => $port) { dbUpdate(array('deleted' => '1'), 'ports', '`interface_id` = ?', array($ports_db[$ifIndex]['interface_id'])); $ports_db[$ifIndex]['deleted'] = "1"; + echo("-"); } } echo("X"); } } -### End New interface detection - -### If it's in our $ports_l list, that means it's not been seen. Mark it deleted. +/// End New interface detection +/// Interface Deletion +/// If it's in our $ports_l list, that means it's not been seen. Mark it deleted. foreach($ports_l as $ifIndex => $port_id) { if($ports_db[$ifIndex]['deleted'] == "0") @@ -60,6 +61,7 @@ foreach($ports_l as $ifIndex => $port_id) echo("-".$ifIndex); } } +/// End interface deletion echo("\n");