Good day, I’m currently having issues with graph sensing on some devices. I’m seeing choppy graphs on the graph even though I have good connectivity to the device and there are no alarm logs.
#!/usr/bin/env php
<?php
/*
* LibreNMS
*
* Copyright (c) 2014 Neil Lathwood <https://github.com/laf/ http://www.lathwood.co.uk/fa>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
use LibreNMS\Config;
use LibreNMS\ValidationResult;
use LibreNMS\Validator;
chdir(__DIR__); // cwd to the directory containing this script
ini_set('display_errors', 1);
$options = getopt('g:m:s::h::');
if (isset($options['h'])) {
echo
"\n Validate setup tool
Usage: ./validate.php [-g <group>] [-s] [-h]
-h This help section.
-s Print the status of each group
-g Any validation groups you want to run, comma separated:
Non-default groups:
- mail: this will test your email settings (uses default_mail option even if default_only is not set)
- distributedpoller: this will test for the install running as a distributed poller
- rrdcheck: this will check to see if your rrd files are corrupt
Default groups:
- configuration: checks various config settings are correct
- database: checks the database for errors
- dependencies: checks that all required libraries are installed and up-to-date
- disk: checks for disk space and other disk related issues
- php: check that various PHP modules and functions exist
- poller: check that the poller and discovery are running properly
- programs: check that external programs exist and are executable
- python: check that various Python modules and functions exist
- system: checks system related items
- updates: checks the status of git and updates
- user: check that the LibreNMS user is set properly
Example: ./validate.php -g mail.
";
exit;
}
if (function_exists('posix_getuid') && posix_getuid() === 0) {
echo 'Do not run validate.php as root' . PHP_EOL;
exit(1);
}
// Check autoload
if (! file_exists('vendor/autoload.php')) {
print_fail('Composer has not been run, dependencies are missing', './scripts/composer_wrapper.php install --no-dev');
exit;
}
require_once 'vendor/autoload.php';
require_once 'includes/common.php';
require_once 'includes/functions.php';
// Buffer output
ob_start();
$precheck_complete = false;
register_shutdown_function(function () {
global $precheck_complete;
if (! $precheck_complete) {
// use this in case composer autoloader isn't available
spl_autoload_register(function ($class) {
@include str_replace('\\', '/', $class) . '.php';
});
print_header();
}
});
$pre_checks_failed = false;
// config.php checks
if (file_exists('config.php')) {
$syntax_check = `php -ln config.php`;
if (strpos($syntax_check, 'No syntax errors detected') === false) {
print_fail('Syntax error in config.php');
echo $syntax_check;
$pre_checks_failed = true;
}
$first_line = rtrim(`head -n1 config.php`);
if (! strpos($first_line, '<?php') === 0) {
print_fail("config.php doesn't start with a <?php - please fix this ($first_line)");
$pre_checks_failed = true;
}
if (strpos(`tail config.php`, '?>') !== false) {
print_fail('Remove the ?> at the end of config.php');
$pre_checks_failed = true;
}
}
// Composer check
$validator = new Validator();
$validator->validate(['dependencies']);
if ($validator->getGroupStatus('dependencies') == ValidationResult::FAILURE) {
$pre_checks_failed = true;
}
if ($pre_checks_failed) {
exit;
}
$init_modules = [];
require 'includes/init.php';
// make sure install_dir is set correctly, or the next includes will fail
if (! file_exists(Config::get('install_dir') . '/.env')) {
$suggested = realpath(__DIR__);
print_fail('\'install_dir\' config setting is not set correctly.', "It should probably be set to: $suggested");
exit;
}
if (\LibreNMS\DB\Eloquent::isConnected()) {
$validator->ok('Database connection successful', null, 'database');
} else {
$validator->fail('Error connecting to your database.', null, 'database');
}
$precheck_complete = true; // disable shutdown function
print_header();
if (isset($options['g'])) {
$modules = explode(',', $options['g']);
} elseif (isset($options['m'])) {
$modules = explode(',', $options['m']); // backwards compat
} else {
$modules = []; // all modules
}
// run checks
$validator->validate($modules, isset($options['s']) || ! empty($modules));
function print_header()
{
$output = ob_get_clean();
@ob_end_clean();
echo \LibreNMS\Util\Version::get()->header() . PHP_EOL;
echo $output;
}
// output matches that of ValidationResult
function print_fail($msg, $fix = null)
{
echo "[\033[31;1mFAIL\033[0m] $msg";
if ($fix && strlen($msg) > 72) {
echo PHP_EOL . ' ';
}
if (! empty($fix)) {
echo " [\033[34;1mFIX\033[0m] \033[34;1m$fix\033[0m";
}
echo PHP_EOL;
}
the polling time is set by default
Do you think it’s because of the version of my librenms?
librenms@librenms01:~$ ./validate.php
===========================================
Component | Version
--------- | -------
LibreNMS | 23.4.1-43-g75f8fe214 (2023-04-27T14:49:52-05:00)
DB Schema | 2023_04_12_174529_modify_ports_table (250)
PHP | 8.1.2-1ubuntu2.21
Python | 3.10.12
Database | MariaDB 10.6.22-MariaDB-0ubuntu0.22.04.1
RRDTool | 1.7.2
SNMP | 5.9.1
===========================================
[OK] Composer Version: 2.8.9
[OK] Dependencies up-to-date.
[OK] Database connection successful
[OK] Database Schema is current
[OK] SQL Server meets minimum requirements
[OK] lower_case_table_names is enabled
[OK] MySQL engine is optimal
[OK] Database and column collations are correct
[OK] Database schema correct
[OK] MySQl and PHP time match
[OK] Distributed Polling setting is enabled globally
[FAIL] You have not enabled rrdcached
[FIX]:
lnms config:set rrdcached <rrdcached server ip:port>
[FAIL] Missing PHP extension: memcached
[FIX]:
Please install memcached
[FAIL] No active polling method detected
[OK] Dispatcher Service not detected
[OK] Locks are functional
[FAIL] No active python wrapper pollers found
[OK] Redis is unavailable
[OK] rrd_dir is writable
[OK] rrdtool version ok
[WARN] Your local git contains modified files, this could prevent automatic updates.
[FIX]:
You can fix this with ./scripts/github-remove
Modified Files:
resources/views/layouts/menu.blade.php
[FAIL] We have found some files that are owned by a different user than 'librenms', this will stop you updating automatically and / or rrd files being updated causing graphs to fail.
[FIX]:
sudo chown -R librenms:librenms /opt/librenms
sudo setfacl -d -m g::rwx /opt/librenms/rrd /opt/librenms/logs /opt/librenms/bootstrap/cache/ /opt/librenms/storage/
sudo chmod -R ug=rwX /opt/librenms/rrd /opt/librenms/logs /opt/librenms/bootstrap/cache/ /opt/librenms/storage/
Files:
/opt/librenms/html/plugins/Weathermap/configs/CoreMap.conf.bkp
/opt/librenms/html/plugins/Weathermap/images/SW_6720.png
/opt/librenms/html/plugins/Weathermap/images/FWV_SINFONDO.png
/opt/librenms/html/plugins/Weathermap/images/SW_5720_SINFONDO.png
/opt/librenms/html/plugins/Weathermap/images/NE20E_S2E_SINFONDO.png
/opt/librenms/html/plugins/Weathermap/images/SW_6730_SINFONDO.png
/opt/librenms/html/plugins/Weathermap/images/OLT_C600_pequeño2.png
/opt/librenms/html/plugins/Weathermap/images/sw4948_SINFONDO.png
/opt/librenms/html/plugins/Weathermap/images/VSOL_OLT_SINFONDO.png
/opt/librenms/html/plugins/Weathermap/images/OLT_C300_pequeño3.png
/opt/librenms/html/plugins/Weathermap/images/FG_800D.png
/opt/librenms/html/plugins/Weathermap/images/images-to-waethermaps
/opt/librenms/html/plugins/Weathermap/images/images-to-waethermaps/SW_6720_pequeño.png
/opt/librenms/html/plugins/Weathermap/images/images-to-waethermaps/SW_6720.png
/opt/librenms/html/plugins/Weathermap/images/images-to-waethermaps/FWV_SINFONDO.png
and 76 more...
librenms@librenms01:~$
You have a lot of errors there, and two pollers which doesn’t look setup correctly.
Personally i would suggest doing a snapshot and working on upgrading your LibreNMS install and components along with fixing those errors in validation.
Last time i had those issues i had my poller times shorter than it was taking to poll my list of devices, but i dont know if that will be your issue. Can you check the Settings > Poller > Dispatcher Service and take a picture of the list of items in there?
That is not a good fix. Polling interval should match rrd heartbeat. (now if you changed rrd heartbeat, that was the real issue)
For rrd if you try to save data faster in an interval than the heartbeat, the data is discarded so you have wasted a lot of processing if that is the case.