Wireless device alert rule - link utilization

Hi all,

I’m having a hard time wrapping my head around how to craft a particularly complex/weird alert rule, if it’s even possible.

We have a number of Ubiquiti AirFiber devices deployed across our network and I’d like to be able to craft a rule that will alert us when a given device is over 85% of available capacity. Unfortunately, the devices do not appear to self-report a utilization figure through SNMP. That would be too easy, I suppose.

The issue I’m running into is that available capacity is dynamic depending on environmental conditions, so I can’t just compare throughput to a fixed number. I need to compare two values from completely separate tables within libre and I’m not sure if this is even doable?

For a given device, I need to compare eth0 ifInOctets_rate*8 with the airfiber TX rate, and vice versa (outoctetsrate with RX rate). The AirFiber devices report traffic throughput on an interface that it names eth0 which has a defined “speed” of 10mbit/sec; as the connection is asymmetrical, I can’t even go in and manually tweak the “speed” as this would prevent us from being notified about congestion in the lower-bandwidth direction.

I can retrieve the TX/RX rates thus;

wireless_sensors.sensor_type = “airos-tx” && wireless_sensors.sensor_class = “rate” provides TX rate in bits/s
wireless_sensors.sensor_type = “airos-rx” && wireless_sensors.sensor_class = “rate” provides RX rate in bits/s

I don’t seem to be able to retrieve the rate number with a single line item (something along the lines of %wireless_sensors.airos-tx.rate?) due to the way wireless sensor information is stored; Here’s where I run into a wall, as my understanding of how the macro/alert system works is tenuous at best, so I don’t know where to go next, or if what I’m trying to do is even achievable.

Could someone help me out with creating a macro or series of macros that will return the current percentage utilization of this AirFiber link, if this is even doable? If I can get to the point where I can retrieve current capacity of the link and compare it to throughput on eth0, I should be able to get the rest of the way myself

A sanitized poller run for this device can be found here: https://pastebin.com/LEbty9b2 in case that’s of any use.

Thanks in advance for the help; if I’m entirely on my own or this would require major changes to a polling module please feel free to tell me to shove off, I’m just at a loss here.

The biggest thing with this is you need to know the links capacity to work out a % - do you know this?

Sort of. The link capacity is dynamic and varies from device to device and update to update, but it’s retrievable via wireless_sensors as I mentioned in my original post.

Tx Capacity: 22588160 bps
RRD[update /opt/librenms/rrd/172.20.34.11/wireless-sensor-rate-airos-tx-1.rrd N:22588160]
[RRD Disabled]SQL[UPDATE `wireless_sensors` set `sensor_prev` ='22755800',`sensor_current` 
='22588160',`lastupdate` =NOW() WHERE `sensor_id` = '9']
Rx Capacity: 55816960 bps
RRD[update /opt/librenms/rrd/172.20.34.11/wireless-sensor-rate-airos-rx-1.rrd N:55816960]
[RRD Disabled]SQL[UPDATE `wireless_sensors` set `sensor_prev` ='61950700',`sensor_current` 
='55816960',`lastupdate` =NOW() WHERE `sensor_id` = '10']

These two values are the current available TX and RX bandwidths, with current utilization retrievable via eth0 bits in and eth0 bits out. AirFiber devices are always transmitting at full speed regardless of utilization & send meaningless data in all frames that aren’t utilized; as such, these values are actual available throughput.

/usr/bin/snmpget -v1 -c COMMUNITY -OQUs -m UBNT-AirFIBER-MIB -M /opt/librenms/mibs:/opt/librenms/mibs/ubnt udp:HOSTNAME:161 rxCapacity.1 txCapacity.1 txoctetsAll.1 rxoctetsAll.1

This snmpget command will pull current capacity in bits/sec, and also what I believe is total octets transmitted/received since reboot (which might be useful? I don’t believe this is being stored currently)

Comparing values from two separate poller modules seems somewhat difficult, especially when I don’t seem to be able to retrieve available capacity with a single line (I’m sure I’m missing something obvious here)

I don’t think this is possible, it would need updates to the wireless sensor to store the index and correlating ‘type’ i.e interface for us to then alerts to match the sensor to the port and do the calculation. I’m not even sure how possible that is overall :frowning:

I was afraid you’d say that :frowning:

I can think of a couple of potential ways this could be resolved, but none of them are simple and i’m not sure they’re even possible. I’ll make a plugin or make my own little webpage for this - thanks much for the help :slight_smile:

Is this still not possible? Has anyone found another way of achieving what @aholmes wanted to do?