1<?php 2 3echo 'RFC1628 '; 4 5// Battery Status (Value : 1 unknown, 2 batteryNormal, 3 batteryLow, 4 batteryDepleted) 6$state = snmp_get($device, 'upsBatteryStatus.0', '-Ovqe', 'UPS-MIB'); 7if (is_numeric($state)) { 8 //Create State Index 9 $state_name = 'upsBatteryStatusState'; 10 create_state_index( 11 $state_name, 12 [ 13 ['value' => 1, 'generic' => 3, 'graph' => 0, 'descr' => 'Unknown'], 14 ['value' => 2, 'generic' => 0, 'graph' => 0, 'descr' => 'Normal'], 15 ['value' => 3, 'generic' => 2, 'graph' => 0, 'descr' => 'Low'], 16 ['value' => 4, 'generic' => 2, 'graph' => 0, 'descr' => 'Depleted'], 17 ] 18 ); 19 20 $sensor_index = 0; 21 discover_sensor( 22 $valid['sensor'], 23 'state', 24 $device, 25 '.1.3.6.1.2.1.33.1.2.1.0', 26 $sensor_index, 27 $state_name, 28 'Battery Status', 29 1, 30 1, 31 null, 32 null, 33 null, 34 null, 35 $state, 36 'snmp', 37 0 38 ); 39 40 //Create Sensor To State Index 41 create_sensor_to_state_index($device, $state_name, $sensor_index); 42} 43 44// Output Source (Value : 1 other, 2 none, 3 normal, 4 bypass, 5 battery, 6 booster, 7 reducer) 45$state = snmp_get($device, 'upsOutputSource.0', '-Ovqe', 'UPS-MIB'); 46if (is_numeric($state)) { 47 //Create State Index 48 $state_name = 'upsOutputSourceState'; 49 create_state_index( 50 $state_name, 51 [ 52 ['value' => 1, 'generic' => 3, 'graph' => 0, 'descr' => 'Other'], 53 ['value' => 2, 'generic' => 3, 'graph' => 0, 'descr' => 'None'], 54 ['value' => 3, 'generic' => 0, 'graph' => 0, 'descr' => 'Normal'], 55 ['value' => 4, 'generic' => 1, 'graph' => 0, 'descr' => 'Bypass'], 56 ['value' => 5, 'generic' => 2, 'graph' => 0, 'descr' => 'Battery'], 57 ['value' => 6, 'generic' => 2, 'graph' => 0, 'descr' => 'Booster'], 58 ['value' => 7, 'generic' => 2, 'graph' => 0, 'descr' => 'Reducer'], 59 ] 60 ); 61 62 $sensor_index = 0; 63 discover_sensor( 64 $valid['sensor'], 65 'state', 66 $device, 67 '.1.3.6.1.2.1.33.1.4.1.0', 68 $sensor_index, 69 $state_name, 70 'Output Source', 71 1, 72 1, 73 null, 74 null, 75 null, 76 null, 77 $state, 78 'snmp', 79 0 80 ); 81 82 //Create Sensor To State Index 83 create_sensor_to_state_index($device, $state_name, $sensor_index); 84} 85