WiFI Airos more Metrics

Hello,

i am trying to expant existing device metrics. I want to add connected clients (sta) signals and mac addresses into Librenms/OS/Airos.php to have this metrics by default on all devices.

I have added this lines to the bottom

  /**
     * Discover wireless STA signal strength using SNMP bulk walk.
     * This function will retrieve all signal strengths in the subtree.
     * @return array
     */
    public function discoverWirelessStaSignal()
    {
        $oid = '.1.3.6.1.4.1.41112.1.4.7.1.3'; // OID for STA signal
        $results = snmp2_walk($this->getDeviceIpAddress(), $this->getSnmpCommunity(), $oid);

        // Process the results and create WirelessSensor objects
        $sensorArray = [];
        foreach ($results as $key => $value) {
            // Convert $key to the OID format you want, e.g., append the last number.
            $sensorArray[] = new WirelessSensor('signal', $this->getDeviceId(), $key, 'airos', 1, 'STA Signal Strength');
        }

        return $sensorArray;
    }

    /**
     * Discover wireless STA MAC addresses using SNMP bulk walk.
     * This function will retrieve all MAC addresses in the subtree.
     * @return array
     */
    public function discoverWirelessStaMac()
    {
        $oid = '.1.3.6.1.4.1.41112.1.4.7.1.1'; // OID for STA MAC
        $results = snmp2_walk($this->getDeviceIpAddress(), $this->getSnmpCommunity(), $oid);

        // Process the results and create an array of MAC addresses
        $macArray = [];
        foreach ($results as $key => $value) {
            // Convert $key to the OID format you want if needed.
            // You may need to format or validate the MAC address in $value.
            $macArray[] = $value;
        }

        return $macArray;
    }

But i still cant see any info about this OIDs while i am polling the device.

Aby idea how to add new metrics for cpecific device OS?
ubntStaMac 1.3.6.1.4.1.41112.1.4.7.1.1
ubntStaMac 1.3.6.1.4.1.41112.1.4.7.1.1

Hi.
Looks like the file is the right one. So writing the functions is a good start, ensuring that they are called somewhere is even better.
The sensors you can use for wireless are here :

And for each type of sensor you have the Interface (for the object oriented code) to implement.

So pick the one that fits, and from there, you need to import the interface in the Airos.php file at the beginning :
use LibreNMS\Interfaces\Discovery\Sensors\WirelessRssiDiscovery;

And then write the function that is called whenever the interface is in use:

  • for RSSI, the interface file says :
namespace LibreNMS\Interfaces\Discovery\Sensors;

interface WirelessRssiDiscovery
{
    /**
     * Discover wireless RSSI (Received Signal Strength Indicator). This is in dBm. Type is rssi.
     * Returns an array of LibreNMS\Device\Sensor objects that have been discovered
     *
     * @return array
     */
    public function discoverWirelessRssi();
}

So the function to implement is discoverWirelessRssi. And that one is already implemented in Airos.php as you can see.

1 Like

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