Need help to create Alert rules with OR operator

Hi All,
I am working on a fresh install of Librenms. And I myself am very new to Librenms. I added the devices and added alerts from macros. These are working okay. I need to know how to add OR or | | operator in the alert rules .

Sayyed

The only way to use OR or || is using a macro. Post the rule you are trying to make maybe we can help ya out.

Hi Kevin, Thanks for quick reply .

here is the rule on previous server. I want to have it on the new server.

%ports.port_descr_descr ~ “ISP ASxxx” || %ports.port_descr_descr ~ “Description” || %ports.port_descr_descr ~ “ISP ASXXX” && %macros.port_in_usage_perc > “70”

I dont’ know how to bring in the || operator.

Just create that as a macro and then use the macro in the rule itself.

Have a look at the docs and give it a try.

Where exactly I can go to create a macro. I know its a silly questions . But I should be honest. I know some basics of linux. but not sure about Librenms.

I have seen some posts where people were talking about config.php file. There are few config.ph files in librenms arleady. I dont know which one to edit.

you make your macro in config.php its usally located in opt/librenms

From the docs.
https://docs.librenms.org/#Alerting/Macros/

Hi Kevin,

I have made the change . as below.
$config[‘alert’][‘macros’][‘rule’][‘EBOX_BGP’] = ‘%bgpPeers.bgpPeerFsmEstablishedTime < “300” && %bgpPeers.bgpPeerState = “established” &&(%bgpPeers.bgpPeerRemoteAs = 1299 && || %bgpPeers.bgpPeerRemoteAs = 174 &&)’;

Is it going to work in background , OR still need to make some rule to get it working. Aslo , if it’s going to show up in alert rule configuration ; where can I see it ???

Hi Kevin,

I can see the rule in Global settings. Now only one question , is it going to work from here itself or I need to enable it or call it somewhere ???

You need to create the rule now and specify that macro.EBOX_BGP as the entity, equals 1

If you would like to use OR in alert rules still. We have a new UI for you to test: https://github.com/librenms/librenms/pull/8293