port poller

git-svn-id: http://www.observium.org/svn/observer/trunk@3172 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2012-05-11 18:01:28 +00:00
parent 9af156eb95
commit 606751f6fd

View File

@@ -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");