I am quite new to LibreNMS wonderland and still figuring out lots of beautiful things and applying them to my environment.
Currently I am struggling about creating an alert rule for the following scenario;
I want to monitor the bandwidth of specific port on specific device. If it exceeds the defined amount for X amount of minutes, I want to issue an alert. I also want to re-issue this alert if it still persists after 30 minutes.
Device A
Port B of device A
If → PortB bandwidth usage is greater_than 2Gbps for X minutes, issue an alert
What I tried is;
Rule Name: High Bandwidth Usage
Rule(s): %devices.sysName = “myDevice” &&
%ports.ifHighSpeed >= "2000" &&
%ports.ifName = “sfp-sfpplus2”
Map to: myDeviceIP (ex 1.1.1.1)
Max: 1, Delay: 300, Interval: 1800
Is there anything am I missing? Do I need to specify something else like SQL query etc?
If I understand correctly; If I have 10G port, then %ports.ifHighSpeed willl always return 10G or current usage? So basically Port utilisation over threshold should fix my problem when I set percentage to 20% for 10G port?
Would the following Port utilisation over threshold work as intended then?;
Rule Name: High Bandwidth Usage
Rule(s): %devices.sysName = “myDevice” &&
%macros.port_usage_perc >= "20" &&
%macros.port_up &&
%ports.ifName = “sfp-sfpplus2”
Map to: myDeviceIP (ex 1.1.1.1)
Max: 1, Delay: 1800, Interval: 300
This returns me values like; 1359.41283 Mbps for Download for instance . I only want to show 1359.4 Mbps. So basicaly I want to round it but couldn’t find a way so far.
As mentioned above you can run php code in the alert templates. Try using the php function number_format() - this is what I use to round disk spaces on my disk space alert template, otherwise I would get about 10 decimal places.