Units fill column Bandwidth Traffic Alert

When I want to fill in the column in ports.ifOutOctets_rate and ports.ifInOctets_rate , what units should I fill in, is it mb/kb/b?


because I want an alert notification when traffic exceeds 150Mbps, and is the rule I created right or wrong?

I believe ports.ifOutOctets_rate and ports.ifInOctets_rate is calculated in Bps (Bytes per second).

in my alert rule i * it by 8 to convert it to Bits to be aligned with the ifSpeed value which is calculated in bits/s.

can i see your alert rule sir? thanks for the answer :pray:

For sure, use my rule mainly for my WAN ports so i know if im reaching potential congestion on one of my sites. My rule is different to what you’re trying to do as mine is based off percentage of the port speed to trigger if 90%+. The ifSpeed is determined by the interface description parsing i have configured against the interface on each router (Interface Description Parsing - LibreNMS Docs) and then uses the SQL rule below:

SELECT * FROM devices,ports WHERE (devices.device_id = ? AND devices.device_id = ports.device_id) AND (ports.ifOperStatus = “up” && ports.ifAdminStatus = “up” && (ports.deleted = 0 && ports.ignore = 0 && ports.disabled = 0)) = 1 AND (((SELECT IF(ports.ifOutOctets_rate>ports.ifInOctets_rate, ports.ifOutOctets_rate, ports.ifInOctets_rate)*8) / ports.ifSpeed)*100) >= 90

I just have that as an Advanced Override SQL rule against the alert. I could go deeper and pin the rule against it against the WAN Port Group which i have set against all my WAN ports but majority of my LAN ports operate at 1G so they never trigger 90% anyway.

1 Like

Totally untested but try adding this to config.php then use the new macro in your rule:

$config['alert']['macros']['rule']['port_usage_out'] = "(%ports.ifOutOctets_rate*8)/1000/1000";

Then you can do macros.port_usage_out Greater than or equal to 150

if you need in direction then you can just add another macro but replace out/Out with in/In

2 Likes