Mail alert not working

After last LibreNMS update Mail alerts stopped working.

Test transport alert gives message:
Test to mail failed - general error.

[librenms@toc-libremon ~]$ ./validate.php

Component Version
LibreNMS 23.8.2-39-g0f7a066f3 (2023-09-10T19:18:28-04:00)
DB Schema 2023_08_30_105156_add_applications_soft_deleted (259)
PHP 8.1.11
Python 3.6.8
Database MariaDB 10.6.10-MariaDB
RRDTool 1.7.0
SNMP 5.8
===========================================

[OK] Composer Version: 2.6.2
[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] Active pollers found
[OK] Dispatcher Service not detected
[OK] Locks are functional
[OK] Python poller wrapper is polling
[OK] Redis is unavailable
[OK] rrd_dir is writable
[OK] rrdtool version ok

It gives error in librenms.log:

LibreNMS\Cache\Device::get(): Argument #1 ($device) must be of type string|int|null, array given, called in /opt/librenms/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php on line 353 {“userId”:1,“exception”:“[object] (TypeError(code: 0): LibreNMS\Cache\Device::get(): Argument #1 ($device) must be of type string|int|null, array given, called in /opt/librenms/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php on line 353 at /opt/librenms/LibreNMS/Cache/Device.php:69)”}

Hmm, it doesn’t show where the bug is triggered from. Is there a backtrace with the error in the log?

When i hit “Test Transport” it shows message in /var/log/httpd/access_log:

10.126.XXXX.XXXX - - [11/Sep/2023:15:23:23 -0400] “POST /alert/transports/1/test HTTP/1.1” 500 69 “http://toc-librexxxx.xxxx.xxxx.edu/alert-transports” “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36”

and above message in librenms.log

upgrade did not help. it is the same issue.

Component Version
LibreNMS 23.8.2-40-g28603f2a6 (2023-09-11T22:23:26-04:00)
DB Schema 2023_08_30_105156_add_applications_soft_deleted (259)
PHP 8.1.11
Python 3.6.8
Database MariaDB 10.6.10-MariaDB
RRDTool 1.7.0
SNMP 5.8

Experiencing the same issue since yesterday.

Component Version
LibreNMS 23.8.2-41-ga1eb90fe6 (2023-09-12T04:05:08-04:00)
DB Schema 2023_08_30_105156_add_applications_soft_deleted (259)
PHP 8.1.2-1ubuntu2.14
Python 3.10.12
Database MariaDB 10.6.12-MariaDB-0ubuntu0.22.04.1
RRDTool 1.7.2
SNMP 5.9.1

librenms.log :

LibreNMS\Cache\Device::get(): Argument #1 ($device) must be of type string|int|null, array given, called in /opt/librenms/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php on line 353 {“userId”:1,“exception”:“[object] (TypeError(code: 0): LibreNMS\Cache\Device::get(): Argument #1 ($device) must be of type string|int|null, array given, called in /opt/librenms/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php on line 353 at /opt/librenms/LibreNMS/Cache/Device.php:69)”}

The same issue after update:

Component Version
LibreNMS 23.8.2-41-ga1eb90fe6 (2023-09-12T04:05:08-04:00)
DB Schema 2023_08_30_105156_add_applications_soft_deleted (259)
PHP 8.1.11
Python 3.6.8
Database MariaDB 10.6.10-MariaDB
RRDTool 1.7.0
SNMP 5.8

Anything we can do to help? I have this same problem on multiple Librenms installs.

===========================================

Component Version
LibreNMS 23.8.2-41-ga1eb90fe6 (2023-09-12T01:05:08-07:00)
DB Schema 2023_08_30_105156_add_applications_soft_deleted (259)
PHP 8.2.10
Python 3.8.10
Database MariaDB 10.3.38-MariaDB-0ubuntu0.20.04.1
RRDTool 1.7.2
SNMP 5.8
===========================================

I got quiet the same problem, the mail is sent using the test button (from alert → alert transport → orange button) but it is not working/triggering when i associated it in a “Alert Rules” → “transports”

A followup on mine. A Warning level alert did trigger this morning for an environmental device but no Criticals have gone off even when I purposefully powered down a switch. My test transport button also fails with a general error.

2023-09-13_11-25-17

LibreNMS | 23.8.2-42-g49d66fa31 (2023-09-14T00:10:37-04:00) - the same issue.

I created Dummy and Syslog transport. Both have the same issue.

i finally make it works, adding the default transport template from docs in a new alert template.
I thought the default template will be apply as default template but not, i have to add it manually.

LibreNMS | 23.9.0 (2023-09-15T09:05:55-04:00) - works! But click on the test button still shows the “Test mail failed - general error”.

Thank you Tony!

Alerts seem to be functioning properly! As dlesel said I still get an error on the test button but it goes through without issue. Thanks everybody!

I have same issue. Happened the same time as OP.
As i understand, people in this thread only checked the situation, when there is custom email transport created and assigned to alert rule?

What about global default mail transport? Should it work after fix?

I have configured only default one, and set it to issue alerts only to admins (general alert settings). Alerts do not come through.

I tested with custom mail transport and indeed it works.

Should i debug my case further? If so what should i check?
There is no errors in librenms.log
Running test-alert.php not giving any apparent errors. There is line added to event log “Issued recovery for rule … to transport ‘mail’” (same for none recovery).

Running test-alert.php shows this lines:
SQL[SELECT transport_id, transport_type, transport_name FROM alert_transports WHERE is_default=true [] 0.5ms]

Reporting disabled by user setting
:: Transport mail => SQL[select * from alert_transports where alert_transports.transport_id is null limit 1 [] 0.55ms]

Why it says “Reporting disabled by user setting” even though default email transport enabled?

Reporting is not related to alerting in any way.

It means there would have been an error reported, but error reporting is disabled.

So for completion sake I’ve installed LibreNMS on clean test server.
Everything done according to manual page. Apart from this.

Configured mail(smtp) in global settings.
Created default alert rules.
No custom transport created.

No notifications are coming through.
test-alert.php says “No configured transports”.
On my production server there is no indication here. It even adds record to event log “Issued…to transport ‘mail’…”

Adding transport with:
Contact Type: Role
Email:
Role: Admin
Default: Yes
Notifications start to work (on prod too).

Is this new default behavior? If so: should it be reflected in installation/configuration manual?
Previously you didn’t need to create default mail transport, it worked out of the box.