Librenms on docker not sending email for alert

I have deploied a librenms in docker. It doesn’t send email for any alerts.
When I tried
./scripts/test-alert.php -r [rule_id] -h [device_id] -d
It works and I can get the email. It helps me confirm the alert transport and rule works.
All the alerts are showing on the alert page, but it just doesn’t send email alert when there is a new alert generated.
Following is the result when I manually run the alerts.php, I noticed it doesn’t select the transport as my the other librenms instance which is installed locally.

Any thoughts or ideas about this?
Thank you!

/opt/librenms $ ./validate.php 
===========================================
Component | Version
--------- | -------
LibreNMS  | 25.4.0 (2025-04-15T14:18:54+00:00)
DB Schema | 2025_03_22_134124_fix_ipv6_addresses_id_type (332)
PHP       | 8.3.19
Python    | 3.12.10
Database  | MariaDB 10.11.11-MariaDB-ubu2204
RRDTool   | 1.9.0
SNMP      | 5.9.4
===========================================

[OK]    Installed from the official Docker image; no Composer required
[OK]    Database Connected
[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
[OK]    Connected to rrdcached
[OK]    Active pollers found
[OK]    Dispatcher Service is enabled
[OK]    Locks are functional
[OK]    No python wrapper pollers found
[OK]    Redis is functional
[WARN]  IPv6 is disabled on your server, you will not be able to add IPv6 devices.
[OK]    rrdtool version ok
[OK]    Connected to rrdcached
[WARN]  Updates are managed through the official Docker image
/opt/librenms $

Output below for running the alerts.php manually, not seeing anything about transport from it.

https://p.libren.ms/view/7c72be1f

I replied to your reddit thread, have you read it?

Hey Laf, yes, I’ve read it and replied.

The transport is in place, my test using ./scripts/test-alert.php -r [rule_id] -h [device_id] -d confirms it, as I successfully receive an email.

It is just alerts.php isn’t sending it for some reason.

Below are the database queries showing the relevant rules and transports.

MariaDB [librenms]> SELECT * FROM alert_transport_map WHERE rule_id IN (1,6,16,19,25,37);
+----+---------+-----------------------+-------------+
| id | rule_id | transport_or_group_id | target_type |
+----+---------+-----------------------+-------------+
|  3 |      37 |                     1 | single      |
|  4 |      37 |                     3 | single      |
|  5 |       1 |                     1 | single      |
| 22 |      16 |                     1 | single      |
| 23 |       6 |                     1 | single      |
| 27 |      19 |                     1 | single      |
| 29 |      25 |                     1 | single      |
| 30 |       1 |                     3 | single      |
| 31 |       6 |                     3 | single      |
+----+---------+-----------------------+-------------+
9 rows in set (0.001 sec)

MariaDB [librenms]> SELECT * FROM alert_transports;
+--------------+----------------+----------------+------------+-----------------------------------------------------------------------------------------------------+
| transport_id | transport_name | transport_type | is_default | transport_config                                                                                    |
+--------------+----------------+----------------+------------+-----------------------------------------------------------------------------------------------------+
|            1 | support        | mail           |          1 | {"email":"[email protected]","mail-contact":"email","role":"","bcc":null,"attach-graph":"on"} |
|            3 | yfzhmail       | mail           |          0 | {"mail-contact":"email","email":"[email protected]","role":"","bcc":null,"attach-graph":"on"}   |
+--------------+----------------+----------------+------------+-----------------------------------------------------------------------------------------------------+
2 rows in set (0.000 sec)

The debug output you have shown means the alerts aren’t in a state to actually have anything sent.

You will need to share EVERYTHING to help debugging, the alert rule, associated transport, templates, screenshots from the active alert.

Hello, please see the attached screenshots.

Alert rule for testing.

Alert template, this is the default one which applies to the above alert

Alert transport

Active alert
image

We have another librenms installed locally which works fine for email. The rules and transport are copied from it.

Thank you.

Following lines are at the end of the debug for alerts.php and there is no return for RunAlerts(), guessing probably this is why you said “alerts aren’t in a state to actually have anything sent.”

RunAlerts():
SQL[SELECT alerts.id, alerts.alerted, alerts.device_id, alerts.rule_id, alerts.state, alerts.note, alerts.info FROM alerts WHERE alerts.state != 2 && alerts.open = 1 [] 8.84ms] 
  
RunAcks():
SQL[SELECT alerts.id, alerts.alerted, alerts.device_id, alerts.rule_id, alerts.state, alerts.note, alerts.info FROM alerts WHERE alerts.state = 2 && alerts.open = 1 [] 8.93ms] 
  
End  : Sun, 04 May 2025 23:21:19 +0000

The db shows alerts with state ==1 and open ==1, which should match the query in above.

MariaDB [librenms]> SELECT * FROM alerts WHERE open = 1 AND state != 2 AND alerted = 0;
+-------+-----------+---------+-------+---------+------+------+---------------------+------+
| id    | device_id | rule_id | state | alerted | open | note | timestamp           | info |
+-------+-----------+---------+-------+---------+------+------+---------------------+------+
| 20167 |       358 |      38 |     1 |       0 |    1 |      | 2025-05-04 23:28:41 |      |
| 20214 |       925 |      38 |     1 |       0 |    1 |      | 2025-05-04 23:30:29 |      |
| 20527 |       924 |      38 |     1 |       0 |    1 |      | 2025-05-04 23:30:34 |      |
| 20599 |       375 |      38 |     1 |       0 |    1 |      | 2025-05-04 23:28:19 |      |
| 20672 |       502 |      40 |     1 |       0 |    1 |      | 2025-05-04 23:31:35 |      |
| 20863 |       503 |      40 |     1 |       0 |    1 |      | 2025-05-04 23:31:06 |      |
+-------+-----------+---------+-------+---------+------+------+---------------------+------+
6 rows in set (0.009 sec)

I removed all the alerts related stuff, the rules, transport, tempalte and recreate them.
I can get email by using the ./scripts/test-alert.php.
I can get email by click the Test transport button on Web UI.
But the system still doesn’t send email when a new alert comes up for some reason.

I migrated the DB from a local installed librenms instance to the docker Librenms. Not sure if that impacts.

Anyone has any idea about this? Or any trouble shooting hints?

Is your alerting schedule task running? Are you using cron or dispatcher? and any other info related.

Hi Tony, thanks for reply.
Both the main librenms and poller are in docker deployment.
Using dispatcher, not cron. See the following screenshot for the pollers.

Is there anything that I can check for alerting schedule task on the main server?