From 461e7067f34eaf3689b66ea9ba44ae12d192d135 Mon Sep 17 00:00:00 2001 From: Tony Murray Date: Sat, 30 Jun 2018 02:53:24 -0500 Subject: [PATCH] Only list polling as overdue when it is 20% over the rrd_step value. (#8848) 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. - [x] Have you followed our [code guidelines?](http://docs.librenms.org/Developing/Code-Guidelines/) #### Testers If you would like to test this pull request then please run: `./scripts/github-apply `, i.e `./scripts/github-apply 5926` --- LibreNMS/Validations/Poller.php | 7 +++++-- html/includes/table/poll-log.inc.php | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/LibreNMS/Validations/Poller.php b/LibreNMS/Validations/Poller.php index 20223c12a3..4732fa7b36 100644 --- a/LibreNMS/Validations/Poller.php +++ b/LibreNMS/Validations/Poller.php @@ -25,6 +25,7 @@ namespace LibreNMS\Validations; +use LibreNMS\Config; use LibreNMS\ValidationResult; use LibreNMS\Validator; @@ -97,7 +98,8 @@ class Poller extends BaseValidation private function checkDeviceLastPolled(Validator $validator) { - if (count($devices = dbFetchColumn("SELECT `hostname` FROM `devices` WHERE (`last_polled` < DATE_ADD(NOW(), INTERVAL - 5 MINUTE) OR `last_polled` IS NULL) AND `ignore` = 0 AND `disabled` = 0 AND `status` = 1")) > 0) { + $overdue = (int)(Config::get('rrd_step', 300) * 1.2); + if (count($devices = dbFetchColumn("SELECT `hostname` FROM `devices` WHERE (`last_polled` < DATE_ADD(NOW(), INTERVAL - $overdue SECOND) OR `last_polled` IS NULL) AND `ignore` = 0 AND `disabled` = 0 AND `status` = 1")) > 0) { $result = ValidationResult::warn("Some devices have not been polled in the last 5 minutes. You may have performance issues.") ->setList('Devices', $devices); @@ -115,7 +117,8 @@ class Poller extends BaseValidation private function checkDevicePollDuration(Validator $validator) { - if (count($devices = dbFetchColumn('SELECT `hostname` FROM `devices` WHERE last_polled_timetaken > 300 AND `ignore` = 0 AND `disabled` = 0 AND `status` = 1')) > 0) { + $period = (int)Config::get('rrd_step', 300); + if (count($devices = dbFetchColumn("SELECT `hostname` FROM `devices` WHERE last_polled_timetaken > $period AND `ignore` = 0 AND `disabled` = 0 AND `status` = 1")) > 0) { $result = ValidationResult::fail("Some devices have not completed their polling run in 5 minutes, this will create gaps in data.") ->setList('Devices', $devices); diff --git a/html/includes/table/poll-log.inc.php b/html/includes/table/poll-log.inc.php index 347464d3e6..7f372caefb 100644 --- a/html/includes/table/poll-log.inc.php +++ b/html/includes/table/poll-log.inc.php @@ -21,7 +21,8 @@ if (isset($searchPhrase) && !empty($searchPhrase)) { } if ($vars['type'] == "unpolled") { - $sql .= " AND `last_polled` <= DATE_ADD(NOW(), INTERVAL - 15 minute)"; + $overdue = (int)(Config::get('rrd_step', 300) * 1.2); + $sql .= " AND `last_polled` <= DATE_ADD(NOW(), INTERVAL - $overdue SECOND)"; } if (!isset($sort) || empty($sort)) {