Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Update some snmpwalks for ports polling to improve speed #6341

Merged
merged 1 commit into from Apr 5, 2017

Conversation

laf
Copy link
Member

@laf laf commented Apr 4, 2017

DO NOT DELETE THIS TEXT

Please note

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

  • Have you signed the Contributors agreement - please do NOT submit a pull request unless you have (signing the agreement in the same pull request is fine). Your commit message for signing the agreement must appear as per the docs.
  • Have you followed our code guidelines?

Testers

If you would like to test this pull request then please run: ./scripts/github-apply <pr_id>, i.e ./scripts/github-apply 5926

I'll do some inline comments on this one but for me it drops port polling on Arista down from 160 -> 80 seconds. It also helps our Cisco switches, with about 800 devices I've dropped 20 seconds on each distributed poller.

@mention-bot
Copy link

Thank you for submitting a PR @laf! We have found the following @BarbarossaTM, @murrant and @ekoyle based on the history of these files to review this PR.

@@ -66,23 +66,6 @@
'ifOutMulticastPkts',
);

// From above for DB
$etherlike_oids = array(
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We appear to not use these at all.

@@ -224,11 +210,11 @@
}
}

if ($config['enable_ports_etherlike']) {
echo 'dot3Stats ';
$port_stats = snmpwalk_cache_oid($device, 'dot3StatsEntry', $port_stats, 'EtherLike-MIB');
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't use any of this table.

echo 'dot3StatsDuplexStatus';
if ($config['enable_ports_poe'] || $config['enable_ports_etherlike']) {
$port_stats = snmpwalk_cache_oid($device, 'dot3StatsIndex', $port_stats, 'EtherLike-MIB');
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use only this + dot3StatsDuplexStatus within poe and etherlike port polling files so only look those up.

if ($device['os_group'] == 'cisco' && $device['os'] != 'asa') {
foreach ($pagp_oids as $oid) {
$port_stats = snmpwalk_cache_oid($device, $oid, $port_stats, 'CISCO-PAGP-MIB');
$pagp_port_stats = snmpwalk_cache_oid($device, $oid, array(), 'CISCO-PAGP-MIB');
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Later on we only use the check for pagpOperationMode so we poll that first, check it has data and if so apply it to $port_stats and then poll the rest of pagp data.

@@ -280,7 +270,7 @@
$port_stats = snmpwalk_cache_oid($device, 'vlanTrunkPortEncapsulationOperType', $port_stats, 'CISCO-VTP-MIB');
$port_stats = snmpwalk_cache_oid($device, 'vlanTrunkPortNativeVlan', $port_stats, 'CISCO-VTP-MIB');
} elseif ($device['os'] != 'asa') {
$port_stats = snmpwalk_cache_oid($device, 'dot1qPortVlanTable', $port_stats, 'Q-BRIDGE-MIB');
$port_stats = snmpwalk_cache_oid($device, 'dot1qPvid', $port_stats, 'Q-BRIDGE-MIB');
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We only used dot1qPvid out of the entire table!

@laf
Copy link
Member Author

laf commented Apr 4, 2017

Comments on both old and new changes in: https://github.com/librenms/librenms/pull/6341/files

@LibreNMS-CI
Copy link

Auto-Deploy finished, Test PR at http://6341.ci.librenms.org or https://6341.ci.librenms.org

@scrutinizer-notifier
Copy link

The inspection completed: No new issues

@murrant
Copy link
Member

murrant commented Apr 4, 2017

@laf Looks nice! Not sure when I will have time to test...

@laf
Copy link
Member Author

laf commented Apr 4, 2017

You can have faith :)

@murrant
Copy link
Member

murrant commented Apr 5, 2017

I have faith, but for some portions of the code I require myself to test before approving ;)

@laf
Copy link
Member Author

laf commented Apr 5, 2017

Wimp :D

Copy link
Member

@murrant murrant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Running on production, looks good.

@laf laf merged commit da68e50 into librenms:master Apr 5, 2017
@laf laf deleted the ports-polling-perf branch April 5, 2017 15:14
@laf laf mentioned this pull request May 5, 2017
@lock lock bot locked as resolved and limited conversation to collaborators May 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants