I’m trying to alert on Arista power supply and fan status. I enabled the Entity State discovery and polling modules for the Arista devieces, and my alerts looks like so:
PSU
Rule: entPhysical.entPhysicalClass = "powersupply" AND entityState.entStateOper != 3
SQL: SELECT * FROM devices,entityState,entPhysical WHERE (devices.device_id = ? AND devices.device_id = entityState.device_id AND devices.device_id = entPhysical.device_id) AND entPhysical.entPhysicalClass = "powersupply" AND entityState.entStateOper != 3
Fan
Rule: entPhysical.entPhysicalClass = "fan" AND entityState.entStateOper != 3
SQL: SELECT * FROM devices,entityState,entPhysical WHERE (devices.device_id = ? AND devices.device_id = entityState.device_id AND devices.device_id = entPhysical.device_id) AND entPhysical.entPhysicalClass = "fan" AND entityState.entStateOper != 3
When I run the SQL queries directly, I get a ton of duplicate entries of false positives
MariaDB [librenms]> SELECT * FROM devices,entityState,entPhysical WHERE (devices.device_id = 2 AND devices.device_id = entityState.device_id AND devices.device_id = entPhysical.device_id) AND entPhysical.entPhysicalClass = "powersupply" AND entityState.entStateOper != 3;
...
...
...
146 rows in set (0.004 sec)
MariaDB [librenms]
A LIMIT 2
sanitized snippet from that output is below:
MariaDB [librenms]> SELECT * FROM devices,entityState,entPhysical WHERE (devices.device_id = 2 AND devices.device_id = entityState.device_id AND devices.device_id = entPhysical.device_id) AND entPhysical.entPhysicalClass = "powersupply" AND entityState.entStateOper != 3 LIMIT 2;
+-----------+---------------------+--------------+--------------+------+----------------+-----------+-----------+----------+----------------------------------+----------+----------------------------------+------------+---------+------+-----------+---------+---------+--------------+------------+-----------------------------------------------+-----------------------------------------------------------------------------------+------------+---------+-----------------+----------+-------------+------------+--------+---------------+--------+----------+--------+--------------+---------------------+---------------------+-----------------------+---------------------------+---------------------+---------------------+---------------------+---------+---------+-------------+------------+--------------+----------------------+-------+-----------------------+-----------+----------------+-----------------+-----------+----------------+---------------------+---------------+--------------+---------------+---------------+-----------------+----------------+-----------+------------------+------------------+------------------+-----------------+------------------------+------------------------+------------------------+------------------+--------------------+------------------+----------------------+-----------------------+----------------------+------------------------+-------------------------+--------------------+---------+
| device_id | inserted | hostname | sysName | ip | overwrite_ip | community | authlevel | authname | authpass | authalgo | cryptopass | cryptoalgo | snmpver | port | transport | timeout | retries | snmp_disable | bgpLocalAs | sysObjectID | sysDescr | sysContact | version | hardware | features | location_id | os | status | status_reason | ignore | disabled | uptime | agent_uptime | last_polled | last_poll_attempted | last_polled_timetaken | last_discovered_timetaken | last_discovered | last_ping | last_ping_timetaken | purpose | type | serial | icon | poller_group | override_sysLocation | notes | port_association_mode | max_depth | disable_notify | entity_state_id | device_id | entPhysical_id | entStateLastChanged | entStateAdmin | entStateOper | entStateUsage | entStateAlarm | entStateStandby | entPhysical_id | device_id | entPhysicalIndex | entPhysicalDescr | entPhysicalClass | entPhysicalName | entPhysicalHardwareRev | entPhysicalFirmwareRev | entPhysicalSoftwareRev | entPhysicalAlias | entPhysicalAssetID | entPhysicalIsFRU | entPhysicalModelName | entPhysicalVendorType | entPhysicalSerialNum | entPhysicalContainedIn | entPhysicalParentRelPos | entPhysicalMfgName | ifIndex |
+-----------+---------------------+--------------+--------------+------+----------------+-----------+-----------+----------+----------------------------------+----------+----------------------------------+------------+---------+------+-----------+---------+---------+--------------+------------+-----------------------------------------------+-----------------------------------------------------------------------------------+------------+---------+-----------------+----------+-------------+------------+--------+---------------+--------+----------+--------+--------------+---------------------+---------------------+-----------------------+---------------------------+---------------------+---------------------+---------------------+---------+---------+-------------+------------+--------------+----------------------+-------+-----------------------+-----------+----------------+-----------------+-----------+----------------+---------------------+---------------+--------------+---------------+---------------+-----------------+----------------+-----------+------------------+------------------+------------------+-----------------+------------------------+------------------------+------------------------+------------------+--------------------+------------------+----------------------+-----------------------+----------------------+------------------------+-------------------------+--------------------+---------+
| 2 | 2020-08-12 14:54:27 | 7280sr-1.lab | 7280sr-1.lab | ��9e | 192.168.57.101 | NULL | authPriv | *** | ******************************** | SHA | ******************************** | AES | v3 | 161 | udp | NULL | NULL | 0 | 65001 | .1.3.6.1.4.1.30065.1.3011.7280.3735.48.2878.6 | Arista Networks EOS version 4.23.2F running on an Arista Networks DCS-7280SR-48C6 | NULL | 4.23.2F | DCS-7280SR-48C6 | NULL | NULL | arista_eos | 1 | | 0 | 0 | 883534 | 0 | 2020-08-21 16:38:38 | NULL | 4.97 | 11.40 | 2020-08-21 16:31:29 | 2020-08-21 16:38:38 | 0.31 | | network | JPE19362365 | arista.svg | 0 | 0 | NULL | 1 | 0 | 0 | 1656 | 2 | 5817 | 2020-08-11 11:17:25 | 2 | 1 | 3 | 80 | 4 | 6065 | 2 | 100711000 | PowerSupply1 | powerSupply | | | | | | | true | PWR-500-DC-F | zeroDotZero | L101T800R6APP | 100710000 | 1 | ARTESYN | NULL |
| 2 | 2020-08-12 14:54:27 | 7280sr-1.lab | 7280sr-1.lab | ��9e | 192.168.57.101 | NULL | authPriv | *** | ******************************** | SHA | ******************************** | AES | v3 | 161 | udp | NULL | NULL | 0 | 65001 | .1.3.6.1.4.1.30065.1.3011.7280.3735.48.2878.6 | Arista Networks EOS version 4.23.2F running on an Arista Networks DCS-7280SR-48C6 | NULL | 4.23.2F | DCS-7280SR-48C6 | NULL | NULL | arista_eos | 1 | | 0 | 0 | 883534 | 0 | 2020-08-21 16:38:38 | NULL | 4.97 | 11.40 | 2020-08-21 16:31:29 | 2020-08-21 16:38:38 | 0.31 | | network | JPE19362365 | arista.svg | 0 | 0 | NULL | 1 | 0 | 0 | 1658 | 2 | 5819 | 2020-08-13 16:54:20 | 2 | 1 | 3 | 80 | 4 | 6065 | 2 | 100711000 | PowerSupply1 | powerSupply | | | | | | | true | PWR-500-DC-F | zeroDotZero | L101T800R6APP | 100710000 | 1 | ARTESYN | NULL |
+-----------+---------------------+--------------+--------------+------+----------------+-----------+-----------+----------+----------------------------------+----------+----------------------------------+------------+---------+------+-----------+---------+---------+--------------+------------+-----------------------------------------------+-----------------------------------------------------------------------------------+------------+---------+-----------------+----------+-------------+------------+--------+---------------+--------+----------+--------+--------------+---------------------+---------------------+-----------------------+---------------------------+---------------------+---------------------+---------------------+---------+---------+-------------+------------+--------------+----------------------+-------+-----------------------+-----------+----------------+-----------------+-----------+----------------+---------------------+---------------+--------------+---------------+---------------+-----------------+----------------+-----------+------------------+------------------+------------------+-----------------+------------------------+------------------------+------------------------+------------------+--------------------+------------------+----------------------+-----------------------+----------------------+------------------------+-------------------------+--------------------+---------+
2 rows in set (0.002 sec)
MariaDB [librenms]>
Looks like unique entityState.entity_state_id
and entityState.entPhysical_id
are the culprits due to them being non-unique? In that case, what’s the move here? Create a discovery YAML to make them the same as entPhysical.entPhysical_id
? Or not? If so, I was looking at some examples based on what I found here: ENTITY-STATE-MIB.entPhysicalDescr - add description field to allow matching and alerting including some other YAMLs in /opt/librenms/includes/definitions/discovery
but I’m really lost on what all the available options for those files are, and the docs at https://docs.librenms.org/Developing/Sensor-State-Support/#example don’t really give any suggestions to clue-lacking people like me on how the files are supposed to work or what their capabilities are.
Any help would be greatly appreciated.