Email Alerts Not Working

Hi,

I am new to LibreNMS and trying to send email alerts via SMTP
test transport button on Global Settings page seems to work fine
without any error but i do not receive any email.

Can anyone please suggest what could be the issue.

Check the eventlog for the device, it logs sending alerts there.

You can also click Capture in the cog menu for a device (on the right hand side), select alerts and run that. It will give you some info back such as would any alerts actually trigger an alert and what contacts would have received them.

Thank you for your reply. In the eventlog i am getting below error:

Could not issue recovery for rule ‘Port status up/down’ to transport ‘mail’ Error: You must provide at least one recipient email address.

Below is the output from device alert, transport and contact mail both are defined, do we need to define email address somewhere else?

Rule name: Port status up/down
Alert rule: %macros.port_down = "1"
Alert query: SELECT * FROM ports WHERE (ports.device_id = ?) && ( ( ( ports.ifOperStatus = “down” && ports.ifAdminStatus != “down” && ( ( ports.deleted = 0 && ports.ignore = 0 && ports.disabled = 0 ) ) ) ) = “1”)
Rule match: no match

Rule name: Devices up/down
Alert rule: %macros.device_down = "1"
Alert query: SELECT * FROM devices WHERE (devices.device_id = ?) && ( ( ( devices.status = 0 && ( ( devices.disabled = 0 && devices.ignore = 0 ) ) ) ) = “1”)
Rule match: no match

Rule name: Device rebooted
Alert rule: %devices.uptime < “300” && %macros.device = "1"
Alert query: SELECT * FROM devices WHERE (devices.device_id = ?) && (devices.uptime < “300” && ( ( devices.disabled = 0 && devices.ignore = 0 ) ) = “1”)
Rule match: no match

Rule name: BGP Session down
Alert rule: %bgpPeers.bgpPeerState != “established” && %macros.device_up = "1"
Alert query: SELECT * FROM bgpPeers,devices WHERE (( devices.device_id = bgpPeers.device_id ) && bgpPeers.device_id = ?) && (bgpPeers.bgpPeerState != “established” && ( ( devices.status = 1 && ( ( devices.disabled = 0 && devices.ignore = 0 ) ) ) ) = “1”)
Rule match: no match

Rule name: BGP Session established
Alert rule: %bgpPeers.bgpPeerFsmEstablishedTime < “300” && %bgpPeers.bgpPeerState = “established” && %macros.device_up = "1"
Alert query: SELECT * FROM bgpPeers,devices WHERE (( devices.device_id = bgpPeers.device_id ) && bgpPeers.device_id = ?) && (bgpPeers.bgpPeerFsmEstablishedTime < “300” && bgpPeers.bgpPeerState = “established” && ( ( devices.status = 1 && ( ( devices.disabled = 0 && devices.ignore = 0 ) ) ) ) = “1”)
Rule match: no match

Rule name: Port utilisation over threshold
Alert rule: %macros.port_usage_perc >= “80” && %macros.port_up = “1” && %macros.port = "1"
Alert query: SELECT * FROM ports WHERE (ports.device_id = ?) && ( ( ( ( ports.ifInOctets_rate*8 ) / ports.ifSpeed ) *100 ) >= “80” && ( ( ports.ifOperStatus = “up” && ports.ifAdminStatus = “up” && ( ( ports.deleted = 0 && ports.ignore = 0 && ports.disabled = 0 ) ) ) ) = “1” && ( ( ports.deleted = 0 && ports.ignore = 0 && ports.disabled = 0 ) ) = “1”)
Rule match: no match

Rule name: Sensor over limit
Alert rule: %sensors.sensor_current > %sensors.sensor_limit && %sensors.sensor_alert = “1” && %macros.device_up = "1"
Alert query: SELECT * FROM sensors,devices WHERE (( devices.device_id = sensors.device_id ) && sensors.device_id = ?) && (sensors.sensor_current > sensors.sensor_limit && sensors.sensor_alert = “1” && ( ( devices.status = 1 && ( ( devices.disabled = 0 && devices.ignore = 0 ) ) ) ) = “1”)
Rule match: no match

Rule name: Sensor under limit
Alert rule: %sensors.sensor_current < %sensors.sensor_limit_low && %sensors.sensor_alert = “1” && %macros.device_up = "1"
Alert query: SELECT * FROM sensors,devices WHERE (( devices.device_id = sensors.device_id ) && sensors.device_id = ?) && (sensors.sensor_current < sensors.sensor_limit_low && sensors.sensor_alert = “1” && ( ( devices.status = 1 && ( ( devices.disabled = 0 && devices.ignore = 0 ) ) ) ) = “1”)
Rule match: no match

Rule name: Service up/down
Alert rule: %services.service_status != “0” && %macros.device_up = "1"
Alert query: SELECT * FROM services,devices WHERE (( devices.device_id = services.device_id ) && services.device_id = ?) && (services.service_status != “0” && ( ( devices.status = 1 && ( ( devices.disabled = 0 && devices.ignore = 0 ) ) ) ) = “1”)
Rule match: no match

Found 1 contacts to send alerts to.
NOC<[email protected]>

Found 1 transports to send alerts to.
Transport: mail

Is NOC<[email protected]> set as the default email in your config? Can you screenshot your Alert settings from the first section.

Sure, below is the screenshot from settings.

I’m not sure what else to suggest. It works for me although my settings are slightly different (mail instead of smtp) and I don’t have read only users set although that makes no difference as you have default contact only set anyway.

Hi Iaf,

I resolved the issue with test transport, it was the issue with domain resolution earlier libre was relaying email to xyz.com instead of mail.xyz.com so i made changes in local dns to resolve the issue. Now i am getting email when i test transport from Global Settings but not receiving alerts on port up/down (default alerts are configured).

Can you suggest anything?

The capture output showed no match for any rule at the time of ss. It is possible that there is no rule matching now. do you know, for sure, there is a port down and libre is not seeing it?

It matches this Port Up/Down rule, check below output

Rule name: Devices up/down
Alert rule: %macros.device_down = "1"
Alert query: SELECT * FROM devices WHERE (devices.device_id = ?) && ( ( ( devices.status = 0 && ( ( devices.disabled = 0 && devices.ignore = 0 ) ) ) ) = “1” )
Rule match: no match

Rule name: Device rebooted
Alert rule: %devices.uptime < “300” && %macros.device = "1"
Alert query: SELECT * FROM devices WHERE (devices.device_id = ?) && (devices.uptime < “300” && ( ( devices.disabled = 0 && devices.ignore = 0 ) ) = “1” )
Rule match: no match

Rule name: Port status up/down
Alert rule: %macros.port_down = "1"
Alert query: SELECT * FROM ports WHERE (ports.device_id = ?) && ( ( ( ports.ifOperStatus = “down” && ports.ifAdminStatus != “down” && ( ( ports.deleted = 0 && ports.ignore = 0 && ports.disabled = 0 ) ) ) ) = “1” )
Rule match: matches

Rule name: Port utilisation over threshold
Alert rule: %macros.port_usage_perc >= “80” && %macros.port_up = “1” && %macros.port = "1"
Alert query: SELECT * FROM ports WHERE (ports.device_id = ?) && ( ( ( ( ports.ifInOctets_rate*8 ) / ports.ifSpeed ) *100 ) >= “80” && ( ( ports.ifOperStatus = “up” && ports.ifAdminStatus = “up” && ( ( ports.deleted = 0 && ports.ignore = 0 && ports.disabled = 0 ) ) ) ) = “1” && ( ( ports.deleted = 0 && ports.ignore = 0 && ports.disabled = 0 ) ) = “1” )
Rule match: no match

Found 1 contacts to send alerts to.
NOC[email protected]

Found 1 transports to send alerts to.
Transport: mail

This issue is resolved. NMS server was relaying email to wateen.com instead of mail.wateen.com.

I am trying to send email alart using gmail but failed. But I was success but not able to

Could not issue critical alert for rule ‘Port utilisation over threshold’ to transport ‘mail’ Error: Could not execute: /usr/sbin/sendmail

!

Please help on this.

You’ve selected to use sendmail, change it to smtp.