Alert Rule for amount of devices down

Hi sir

Can Librenms count the device down and alert that then device down on specify amount??

Using Alert Rule or ??

Many Thanks!!

Alert rules are SQL so I guess, it could be possible.

I use Icinga2 so https://github.com/Linuxfabrik/monitoring-plugins/tree/main/check-plugins/librenms-alerts this check would be a option in my case.

Hi sir,

Thank you for your reply.

I tried override the SQL that count device which down and current amount of device down.

But I was not working.

It’s seem must place devices.device_id = ? in SQL and it triggered only one device alert.

My purpose is alert that over the specify amount of device down and alert dashboard show the alert rule.

It’s seem not solutions in Librenms.

Thank you for your help.

Many thanks.

:sweat_smile:

Currently alerts are device centric in LibreNMS.

Someone would need to contribute the code changes to allow other types of alerts (such as port centric or global).

1 Like

Thank you sir

I followed the guide that add rule of global rule.

It seems all device show in widget ‘ALERT’.

ex: 500 devices and 500 alert will show in widget ‘ALERT’

My purpose is only one alert message that ping down over specify amount in widget ALERT .

Is it possible execute SQL command without ‘devices.device_id = ?’ for Alert Rule or other ??

Many Thanks!!

:sweat_smile:

@SC_Huang As has been said, alerts are tied to a device, however as long as you tie the rule to a single device so you don’t get duplicates you could try doing:

SELECT * FROM devices WHERE (devices.device_id = ?) AND devices.device_id=1 AND (SELECT count(hostname) from devices where status=0) > 10;

In this, make sure device_id=1 is set to a device_id that exists otherwise this rule will fail (don’t remove this bit or the device_id=?). Then the > 10 is if you have more than 10 down devices, change this value as you see fit.

3 Likes

Thank you sir.

I will try it and report the results of this lab.

Many thanks.

:joy:

[quote=“laf, post:6, topic:22701”]
SELECT * FROM devices WHERE (devices.device_id = ?) AND devices.device_id=1 AND (SELECT count(hostname) from devices where status=0) > 10
[/quote

Hi Sir

It’s working.

I always confused the sql which devices.device_id = ? and select the device that the status is down.

Thank you very much!!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.