mirror of
https://github.com/stylersnico/librenms.git
synced 2026-08-03 00:11:49 +02:00
port poller
git-svn-id: http://www.observium.org/svn/observer/trunk@3172 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -13,13 +13,13 @@ foreach(dbFetchRows("SELECT * FROM `ports` WHERE `device_id` = ?", array($device
|
|||||||
|
|
||||||
#print_r($ports_db);
|
#print_r($ports_db);
|
||||||
|
|
||||||
$ports = array();
|
$port_stats = array();
|
||||||
$ports = snmpwalk_cache_oid($device, "ifDescr", $ports, "IF-MIB");
|
$port_stats = snmpwalk_cache_oid($device, "ifDescr", $port_stats, "IF-MIB");
|
||||||
$ports = snmpwalk_cache_oid($device, "ifName", $ports, "IF-MIB");
|
$port_stats = snmpwalk_cache_oid($device, "ifName", $port_stats, "IF-MIB");
|
||||||
$ports = snmpwalk_cache_oid($device, "ifType", $ports, "IF-MIB");
|
$port_stats = snmpwalk_cache_oid($device, "ifType", $port_stats, "IF-MIB");
|
||||||
|
|
||||||
### New interface detection
|
/// New interface detection
|
||||||
foreach ($ports as $ifIndex => $port)
|
foreach ($port_stats as $ifIndex => $port)
|
||||||
{
|
{
|
||||||
/// Check the port against our filters.
|
/// Check the port against our filters.
|
||||||
if (is_port_valid($port, $device))
|
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']));
|
dbUpdate(array('deleted' => '1'), 'ports', '`interface_id` = ?', array($ports_db[$ifIndex]['interface_id']));
|
||||||
$ports_db[$ifIndex]['deleted'] = "1";
|
$ports_db[$ifIndex]['deleted'] = "1";
|
||||||
|
echo("-");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
echo("X");
|
echo("X");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
### End New interface detection
|
/// End New interface detection
|
||||||
|
|
||||||
### If it's in our $ports_l list, that means it's not been seen. Mark it deleted.
|
|
||||||
|
|
||||||
|
/// 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)
|
foreach($ports_l as $ifIndex => $port_id)
|
||||||
{
|
{
|
||||||
if($ports_db[$ifIndex]['deleted'] == "0")
|
if($ports_db[$ifIndex]['deleted'] == "0")
|
||||||
@@ -60,6 +61,7 @@ foreach($ports_l as $ifIndex => $port_id)
|
|||||||
echo("-".$ifIndex);
|
echo("-".$ifIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/// End interface deletion
|
||||||
|
|
||||||
echo("\n");
|
echo("\n");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user