From e31b884cc903baec00cfe35d7c7f25762a577ae6 Mon Sep 17 00:00:00 2001 From: Zmegolaz Date: Thu, 9 Nov 2017 13:57:00 +0100 Subject: [PATCH] Feature: selected_ports per OS. Fixed layout of example MySQL table. (#7674) * selected_ports per OS. Fixed layout of example MySQL table. * Better table markdown. --- doc/Support/Performance.md | 5 ++--- includes/polling/ports.inc.php | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/doc/Support/Performance.md b/doc/Support/Performance.md index 7c584aa78e..9e11f7cbee 100644 --- a/doc/Support/Performance.md +++ b/doc/Support/Performance.md @@ -82,13 +82,12 @@ LibreNMS server. Something like pdns-recursor can be used and then configure `/e By default the polling ports module will walk ifXEntry + some items from ifEntry regardless of the port. So if a port is marked as deleted because you don't want to see them or it's disabled then we still collect data. For the most part this is fine as the walks are quite quick. However for devices with a lot of ports and good % of those are either deleted or disabled then this approach isn't optimal. So to counter this you can enable 'selected port polling' per device within the edit device -> misc section or by -globally enabling it (not recommended): `$config['polling']['selected_ports'] = true;`. +globally enabling it (not recommended): `$config['polling']['selected_ports'] = true;`. You can also set it for a specific OS: `$config['os']['ios']['polling']['selected_ports'] = true;`. If you would like to see if you should turn this on then run this query in MySQL: `select device_id, count(*) as total from ports where deleted=1 group by device_id order by total desc;`. You will see output like the following: -+-----------+-------+ | device_id | total | -+-----------+-------+ +| --------: | ----: | | 128 | 339 | | 92 | 56 | | 41 | 41 | diff --git a/includes/polling/ports.inc.php b/includes/polling/ports.inc.php index 52b4df2557..aa1e938d5a 100644 --- a/includes/polling/ports.inc.php +++ b/includes/polling/ports.inc.php @@ -176,7 +176,7 @@ $data = array(); if ($device['os'] === 'f5' && (version_compare($device['version'], '11.2.0', '>=') && version_compare($device['version'], '11.7', '<'))) { require_once 'ports/f5.inc.php'; } else { - if ($config['polling']['selected_ports'] === true || $device['attribs']['selected_ports'] == 'true') { + if ($config['polling']['selected_ports'] === true || $config['os'][$device['os']]['polling']['selected_ports'] === true || $device['attribs']['selected_ports'] == 'true') { echo('Select ports polling'); $lports = dbFetchRows("SELECT * FROM `ports` where `device_id` = ? AND `deleted` = 0 AND `disabled` = 0", array($device['device_id'])); foreach ($lports as $lport) {