refactor: rewrite arp-table discovery #5048

Merged
merged 6 commits into from Nov 25, 2016

Projects

None yet

4 participants

@murrant
Contributor
murrant commented Nov 22, 2016 edited

Please note

Please read this information carefully. You can run ./scripts/pre-commit.php to check your code before submitting.

Now uses many, many less sql queries
Checks both ipNetToPhysicalPhysAddress and ipNetToMediaPhysAddress for data
Should support vrf better
Remove unused, broken function port_by_id_cache()
Fixes: #4559

@murrant murrant refactor: rewrite arp-table discovery
Now uses many, many less sql queries
Checks both ipNetToPhysicalPhysAddress and ipNetToMediaPhysAddress for data
Should support vrf better
b47bf00
murrant added some commits Nov 22, 2016
@murrant murrant remove extra line
1143e7f
@murrant murrant Add copyright and remove left over unset statement
777ee1d
@murrant murrant fix type in dbDelete statement 6e6a98a
@murrant murrant Fix another context issue
234aa57
@laf
Member
laf commented Nov 22, 2016

Works ok for me. Actual slight increase in discovery time from 1m09 to 1m22.

However the formatting with debug on is a bit, erm awful:

...SQL[SELECT * FROM `ports` WHERE `device_id` = '3006' AND `ifIndex` = '151126514']
...SQL[SELECT * FROM `ports` WHERE `device_id` = '3006' AND `ifIndex` = '151126515']
...SQL[SELECT * FROM `ports` WHERE `device_id` = '3006' AND `ifIndex` = '151126520']
.......................................................................................................................................................SQL[SELECT * FROM `ports` WHERE `device_id` = '3006' AND `ifIndex` = '151126521']
.....................................................................................................................................................................................................................................................SQL[SELECT * FROM `ports` WHERE `device_id` = '3006' AND `ifIndex` = '151126522']
........SQL[SELECT * FROM `ports` WHERE `device_id` = '3006' AND `ifIndex` = '151126526']
......................................................SQL[SELECT * FROM `ports` WHERE `device_id` = '3006' AND `ifIndex` = '151126529']
....................SQL[SELECT * FROM `ports` WHERE `device_id` = '3006' AND `ifIndex` = '151126531']
...SQL[SELECT * FROM `ports` WHERE `device_id` = '3006' AND `ifIndex` = '151126538']
............SQL[SELECT * FROM `ports` WHERE `device_id` = '3006' AND `ifIndex` = '151126540']
.............SQL[SELECT * FROM `ports` WHERE `device_id` = '3006' AND `ifIndex` = '151126542']
............SQL[SELECT * FROM `ports` WHERE `device_id` = '3006' AND `ifIndex` = '151126548']
.................SQL[SELECT * FROM `ports` WHERE `device_id` = '3006' AND `ifIndex` = '151126549']
...SQL[SELECT * FROM `ports` WHERE `device_id` = '3006' AND `ifIndex` = '151126550']
............SQL[SELECT * FROM `ports` WHERE `device_id` = '3006' AND `ifIndex` = '151126558']
.............................................SQL[SELECT * FROM `ports` WHERE `device_id` = '3006' AND `ifIndex` = '151126559']
...SQL[SELECT * FROM `ports` WHERE `device_id` = '3006' AND `ifIndex` = '151126561']
....SQL[SELECT * FROM `ports` WHERE `device_id` = '3006' AND `ifIndex` = '151126562']
..........SQL[SELECT * FROM `ports` WHERE `device_id` =
@murrant
Contributor
murrant commented Nov 23, 2016

@laf, I agree, how can I make it better, skip the dots during debug?

@murrant
Contributor
murrant commented Nov 23, 2016

Reason for the time increase is we fetch both SNMP oids every time now :-(. The reason is as I posted in the other PR, sometimes one doesn't contain all the data.

@laf
Member
laf commented Nov 23, 2016

Will take a look at the code that does the output and see. We do the same in other modules so wonder how it is there.

@murrant murrant Remove .,+,- from debug output.
4dccd96
@scrutinizer-notifier

The inspection completed: 2 new issues

@laf laf added the Discovery label Nov 25, 2016
@laf laf merged commit da3d687 into librenms:master Nov 25, 2016

2 checks passed

Auto-Deploy Build finished.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@murrant murrant deleted the murrant:rewrite-arp-table branch Nov 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment