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 <pr_id>`, i.e `./scripts/github-apply 5926`
This commit is contained in:
Tony Murray
2018-06-30 02:53:24 -05:00
committed by Neil Lathwood
parent e151aa94e4
commit 461e7067f3
2 changed files with 7 additions and 3 deletions

View File

@@ -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);

View File

@@ -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)) {