mirror of
				https://github.com/librenms/librenms.git
				synced 2024-10-07 16:52:45 +00:00 
			
		
		
		
	Add PoE state to Netonix devices
Allow for non-numeric states. state_descr must match what is returned by the device.
This commit is contained in:
		@@ -1,9 +1,11 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
$sensors = dbFetchRows('SELECT * FROM `sensors` WHERE `sensor_class` = ? AND device_id = ? ORDER BY `poller_type`, `sensor_oid`, `sensor_index`', array($sensor_class, $device['device_id']));
 | 
			
		||||
 | 
			
		||||
if ($sensor_class == 'state') {
 | 
			
		||||
    $sensors = dbFetchRows('SELECT * FROM `sensors` LEFT JOIN `sensors_to_state_indexes` ON sensors_to_state_indexes.sensor_id = sensors.sensor_id LEFT JOIN state_indexes ON state_indexes.state_index_id = sensors_to_state_indexes.state_index_id WHERE `sensor_class` = ? AND device_id = ? ORDER BY `poller_type`, `sensor_oid`, `sensor_index`', array($sensor_class, $device['device_id']));
 | 
			
		||||
    $sensors = dbFetchRows('SELECT * FROM `sensors` LEFT JOIN `sensors_to_state_indexes` ON sensors_to_state_indexes.sensor_id = sensors.sensor_id LEFT JOIN state_indexes ON state_indexes.state_index_id = sensors_to_state_indexes.state_index_id WHERE `sensor_class` = ? AND device_id = ? ORDER BY `poller_type`, `sensor_index`+0, `sensor_oid`', array($sensor_class, $device['device_id']));
 | 
			
		||||
}
 | 
			
		||||
else {
 | 
			
		||||
    $sensors = dbFetchRows('SELECT * FROM `sensors` WHERE `sensor_class` = ? AND device_id = ? ORDER BY `poller_type`, `sensor_oid`, `sensor_index`', array($sensor_class, $device['device_id']));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
if (count($sensors)) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user