mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
fix: Fixed arp-tables duplicate data (#8147)
Truncating the table here, because we could have a massive amount of duplicate rows which could cause php oom.
This commit is contained in:
committed by
Neil Lathwood
parent
0a6f113f5a
commit
a98ab6363b
@ -42,10 +42,16 @@ foreach ($vrfs_lite_cisco as $vrf) {
|
||||
$arp_data = snmpwalk_group($device, 'ipNetToMediaPhysAddress', 'IP-MIB', 1, $arp_data);
|
||||
}
|
||||
|
||||
$existing_data = dbFetchRows(
|
||||
"SELECT * from `ipv4_mac` WHERE `device_id`=? AND `context_name`=?",
|
||||
array($device['device_id'], $context)
|
||||
);
|
||||
$sql = "SELECT * from `ipv4_mac` WHERE `device_id`=?";
|
||||
$params = array($device['device_id']);
|
||||
if (is_null($context)) {
|
||||
$sql .= ' AND `context_name` IS NULL';
|
||||
} else {
|
||||
$sql .= ' AND `context_name`=?';
|
||||
$params[] = $context;
|
||||
}
|
||||
$existing_data = dbFetchRows($sql, $params);
|
||||
|
||||
$ipv4_addresses = array_map(function ($data) {
|
||||
return $data['ipv4_address'];
|
||||
}, $existing_data);
|
||||
|
2
sql-schema/232.sql
Normal file
2
sql-schema/232.sql
Normal file
@ -0,0 +1,2 @@
|
||||
TRUNCATE `ipv4_mac`;
|
||||
|
Reference in New Issue
Block a user