Alerts cannot be sent, need to modify alerts.php


My alerts were last sent properly on 11/22 and I haven’t received them since.


Component Version
LibreNMS 1.70.1-6-g9ccb707
DB Schema 2020_10_12_095504_mempools_add_oids (191)
PHP 7.4.13
Python 3.5.2
MySQL 10.0.38-MariaDB-0ubuntu0.16.04.1
RRDTool 1.5.5


[OK] Composer Version: 2.0.8
[OK] Dependencies up-to-date.
[OK] Database connection successful
[OK] Database schema correct
[INFO] Detected Python Wrapper
[OK] Connection to memcached is ok

After checking, I found that it was a problem inside alerts.php.
When I comment out the following paragraph ($alerts_lock->get()), the alerts will be sent normally.

$alerts_lock = Cache::lock('alerts', \LibreNMS\Config::get('service_alerting_frequency'));
//if ($alerts_lock->get()) {
    $alerts = new RunAlerts();
    if (! defined('TEST') && \LibreNMS\Config::get('alert.disable') != 'true') {
        echo 'Start: ' . date('r') . "\r\n";
        echo 'ClearStaleAlerts():' . PHP_EOL;
        echo "RunFollowUp():\r\n";
        echo "RunAlerts():\r\n";
        echo "RunAcks():\r\n";
        echo 'End  : ' . date('r') . "\r\n";

After comparing the test with several different LibreNMS site, I guessed that the problem started to occur only after the distributed polling was enabled.

So far, if you have distributed polling enabled, you still need to manually modify alerts.php as described in this article to comment out that judgment after has been upgraded, otherwise it still won’t issue alerts.

I can’t find the source of the problem yet, I don’t know how to fix it, I wonder if other friends have suggestions or clues?

My alerts have stopped working as well recently. I do not have distributed polling enabled.

If I test a transport, I get the message. If I manually run alerts.php -d I get the current alerts. I modified alters.php as indicated about, but I’m still not getting alerts.