mirror of
https://github.com/stylersnico/librenms.git
synced 2026-08-01 16:26:55 +02:00
don't report/record mac addresses/changes on broken snmp implementations
git-svn-id: http://www.observium.org/svn/observer/trunk@2859 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -12,10 +12,12 @@ foreach (explode("\n", $ipNetToMedia_data) as $data)
|
||||
{
|
||||
list($oid, $mac) = explode(" ", $data);
|
||||
list($if, $first, $second, $third, $fourth) = explode(".", $oid);
|
||||
list($m_a, $m_b, $m_c, $m_d, $m_e, $m_f) = explode(":", $mac);
|
||||
$interface = mysql_fetch_assoc(mysql_query("SELECT * FROM ports WHERE device_id = '".$device['device_id']."' AND ifIndex = '".$if."'"));
|
||||
$ip = $first .".". $second .".". $third .".". $fourth;
|
||||
if ($ip != '...')
|
||||
{
|
||||
$interface = mysql_fetch_assoc(mysql_query("SELECT * FROM ports WHERE device_id = '".$device['device_id']."' AND ifIndex = '".$if."'"));
|
||||
|
||||
list($m_a, $m_b, $m_c, $m_d, $m_e, $m_f) = explode(":", $mac);
|
||||
$m_a = zeropad($m_a);$m_b = zeropad($m_b);$m_c = zeropad($m_c);$m_d = zeropad($m_d);$m_e = zeropad($m_e);$m_f = zeropad($m_f);
|
||||
$md_a = hexdec($m_a);$md_b = hexdec($m_b);$md_c = hexdec($m_c);$md_d = hexdec($m_d);$md_e = hexdec($m_e);$md_f = hexdec($m_f);
|
||||
$mac = "$m_a:$m_b:$m_c:$m_d:$m_e:$m_f";
|
||||
@@ -46,7 +48,7 @@ foreach (explode("\n", $ipNetToMedia_data) as $data)
|
||||
#echo("Add MAC $mac\n");
|
||||
mysql_query("INSERT INTO `ipv4_mac` (interface_id, mac_address, ipv4_address) VALUES ('".$interface['interface_id']."','$clean_mac','$ip')");
|
||||
}
|
||||
$interface_id = $interface['interface_id'];
|
||||
}
|
||||
}
|
||||
|
||||
$sql = "SELECT * from ipv4_mac AS M, ports as I WHERE M.interface_id = I.interface_id and I.device_id = '".$device['device_id']."'";
|
||||
|
||||
Reference in New Issue
Block a user