Email Alerting timing and description question

Please let me know if I need to include any additional information…

I only have one Cisco router setup in LibreNMS currently as testing before rolling this out to 50ish devices. I setup email alerts, and they seem to work. Meaning, I do get an email alert, however, it seems like it isn’t very timely.

At 10:57am CST, I have an alert that comes through giving me a Device up/down message. When I log into the router and check the log, I see a tunnel bounced at 8:04am CST. Then, an email comes through at 11:02am CST stating the device has recovered. This could be an issue and I’m wondering how I can troubleshoot or find out why there is such a delay with notifications. (I verified the date/time is correct on the router.)

Second question, is there a way to customize the email message to include what interface and tunnel has gone down, possibly even interface description? The tunnel that went down was for our backup, so no harm done. But it would be nice to see what connection has gone down from the email instead of trying to access the router.

Thank you in advance.

You need to set timezone in php.ini or check the system on the server make sure its also correct.

Also best way to to check these kinda of alerts is using the event log

You can edit the template.

Yes post the output of ./validate.php

You need to set timezone in php.ini or check the system on the server make sure its also correct.

I SSH’d into the device and issued the ‘date’ command.


So that is correct.

Output of ./validate.php

[email protected]:~$ cat validate.php
#!/usr/bin/env php

<?php /* * LibreNMS * * Copyright (c) 2014 Neil Lathwood * * 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\Validator; chdir(__DIR__); // cwd to the directory containing this script require_once 'includes/common.php'; require_once 'includes/functions.php'; require_once 'includes/dbFacile.php'; $options = getopt('g:m:s::h::'); if (isset($options['h'])) { echo "\n Validate setup tool Usage: ./validate.php [-g ] [-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 distr ibuted 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 - 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 - updates: checks the status of git and updates - user: check that the LibreNMS user is set properly Example: ./validate.php -g mail. " ; exit; } // Buffer output ob_start(); $precheck_complete = false; register_shutdown_function(function () { global $precheck_complete; if (!$precheck_complete) { print_header(version_info()); } }); // critical config.php checks if (!file_exists('config.php')) { print_fail('config.php does not exist, please copy config.php.default to con fig.php'); exit; } $pre_checks_failed = false; $syntax_check = `php -ln config.php`; if (!str_contains($syntax_check, 'No syntax errors detected')) { print_fail('Syntax error in config.php'); echo $syntax_check; $pre_checks_failed = true; } $first_line = rtrim(`head -n1 config.php`); if (!starts_with($first_line, '<?php')) { print_fail("config.php doesn't start with a <?php - please fix this ($first_ line)"); $pre_checks_failed = true; } if (str_contains(`tail config.php`, '?>')) {
print_fail("Remove the ?> at the end of config.php");
$pre_checks_failed = true;


// Composer checks
if (!file_exists(‘vendor/autoload.php’)) {
print_fail(‘Composer has not been run, dependencies are missing’, ‘composer install --no-dev’);
$pre_checks_failed = true;

if (!str_contains(shell_exec(‘php scripts/composer_wrapper.php --version’), ‘Com poser version’)) {
print_fail(“No composer available, please install composer”, “https://getcom”);
$pre_checks_failed = true;

$dep_check = shell_exec(‘php scripts/composer_wrapper.php install --no-dev --dry -run’);
preg_match_all(‘/Installing ([^ ]+/[^ ]+) (/’, $dep_check, $dep_missing);
if (!empty($dep_missing[0])) {
print_fail(“Missing dependencies!”, “./scripts/composer_wrapper.php install --no-dev”);
$pre_checks_failed = true;
print_list($dep_missing[1], “\t %s\n”);
preg_match_all(‘/Updating ([^ ]+/[^ ]+) (/’, $dep_check, $dep_outdated);
if (!empty($dep_outdated[0])) {
print_fail(“Outdated dependencies”, “./scripts/composer_wrapper.php install --no-dev”);
print_list($dep_outdated[1], “\t %s\n”);

if ($pre_checks_failed) {

$init_modules = array(‘nodb’);
require ‘includes/init.php’;

// make sure install_dir is set correctly, or the next includes will fail
if (!file_exists(Config::get(‘install_dir’).‘/config.php’)) {
$suggested = realpath(DIR . ‘/…/…’);
print_fail(‘$config['install_dir'] is not set correctly.’, “It should prob ably be set to: $suggested”);

$validator = new Validator();

// Connect to MySQL
try {

// pull in the database config settings

$validator->ok('Database connection successful', null, 'database');

} catch (\LibreNMS\Exceptions\DatabaseConnectException $e) {
$validator->fail('Error connecting to your database. '.$e->getMessage(), nul l, ‘database’);

$precheck_complete = true; // disable shutdown function

if (isset($options[‘g’])) {
$modules = explode(‘,’, $options[‘g’]);
} elseif (isset($options[‘m’])) {
$modules = explode(‘,’, $options[‘m’]); // backwards compat
} else {
$modules = array(); // all modules

// run checks
$validator->validate($modules, isset($options[‘s’])||!empty($modules));

function print_header($versions)
$output = ob_get_clean();

echo <<< EOF


Component Version
LibreNMS ${versions[‘local_ver’]}
DB Schema ${versions[‘db_schema’]}
PHP ${versions[‘php_ver’]}
MySQL ${versions[‘mysql_ver’]}
RRDTool ${versions[‘rrdtool_ver’]}
SNMP ${versions[‘netsnmp_ver’]}


// output matches that of ValidationResult
function print_fail($msg, $fix = null)
c_echo(“[%RFAIL%n] $msg”);
if ($fix && strlen($msg) > 72) {
echo PHP_EOL . " ";

if (!empty($fix)) {
    c_echo(" [%BFIX%n] %B$fix%n");
echo PHP_EOL;

[email protected]:~$

Yes, the server time is correct but you still haven’t set the timezone in php.ini

You need to run ./validate.php

1 Like