2015-06-13 17:20:36 +02:00
|
|
|
<?php
|
|
|
|
|
|
2017-02-03 12:39:38 +00:00
|
|
|
echo 'RFC1628 ';
|
2015-06-13 17:20:36 +02:00
|
|
|
|
2017-03-12 20:55:13 +01:00
|
|
|
// Battery Status (Value : 1 unknown, 2 batteryNormal, 3 batteryLow, 4 batteryDepleted)
|
|
|
|
|
$state = snmp_get($device, "upsBatteryStatus.0", "-Ovqe", 'UPS-MIB');
|
|
|
|
|
if (is_numeric($state)) {
|
|
|
|
|
//Create State Index
|
|
|
|
|
$state_name = 'upsBatteryStatusState';
|
2017-09-19 14:12:04 -05:00
|
|
|
create_state_index(
|
|
|
|
|
$state_name,
|
2019-03-04 17:31:17 +00:00
|
|
|
[
|
|
|
|
|
['value' => 1, 'generic' => 3, 'graph' => 0, 'descr' => 'Unknown'],
|
|
|
|
|
['value' => 2, 'generic' => 0, 'graph' => 0, 'descr' => 'Normal'],
|
|
|
|
|
['value' => 3, 'generic' => 2, 'graph' => 0, 'descr' => 'Low'],
|
|
|
|
|
['value' => 4, 'generic' => 2, 'graph' => 0, 'descr' => 'Depleted'],
|
|
|
|
|
]
|
2017-09-19 14:12:04 -05:00
|
|
|
);
|
2017-03-12 20:55:13 +01:00
|
|
|
|
2017-10-02 10:08:02 -05:00
|
|
|
$sensor_index = 0;
|
2017-09-19 14:12:04 -05:00
|
|
|
discover_sensor(
|
|
|
|
|
$valid['sensor'],
|
|
|
|
|
'state',
|
|
|
|
|
$device,
|
|
|
|
|
'.1.3.6.1.2.1.33.1.2.1.0',
|
2017-10-02 10:08:02 -05:00
|
|
|
$sensor_index,
|
2017-09-19 14:12:04 -05:00
|
|
|
$state_name,
|
|
|
|
|
'Battery Status',
|
|
|
|
|
1,
|
|
|
|
|
1,
|
|
|
|
|
null,
|
|
|
|
|
null,
|
|
|
|
|
null,
|
|
|
|
|
null,
|
|
|
|
|
$state,
|
|
|
|
|
'snmp',
|
|
|
|
|
0
|
|
|
|
|
);
|
2017-03-12 20:55:13 +01:00
|
|
|
|
|
|
|
|
//Create Sensor To State Index
|
2017-10-02 10:08:02 -05:00
|
|
|
create_sensor_to_state_index($device, $state_name, $sensor_index);
|
2017-02-03 12:39:38 +00:00
|
|
|
}
|
2015-06-13 17:20:36 +02:00
|
|
|
|
2017-03-12 20:55:13 +01:00
|
|
|
// Output Source (Value : 1 other, 2 none, 3 normal, 4 bypass, 5 battery, 6 booster, 7 reducer)
|
|
|
|
|
$state = snmp_get($device, "upsOutputSource.0", "-Ovqe", 'UPS-MIB');
|
|
|
|
|
if (is_numeric($state)) {
|
|
|
|
|
//Create State Index
|
|
|
|
|
$state_name = 'upsOutputSourceState';
|
2017-09-19 14:12:04 -05:00
|
|
|
create_state_index(
|
|
|
|
|
$state_name,
|
2019-03-04 17:31:17 +00:00
|
|
|
[
|
|
|
|
|
['value' => 1, 'generic' => 3, 'graph' => 0, 'descr' => 'Other'],
|
|
|
|
|
['value' => 2, 'generic' => 3, 'graph' => 0, 'descr' => 'None'],
|
|
|
|
|
['value' => 3, 'generic' => 0, 'graph' => 0, 'descr' => 'Normal'],
|
|
|
|
|
['value' => 4, 'generic' => 2, 'graph' => 0, 'descr' => 'Bypass'],
|
|
|
|
|
['value' => 5, 'generic' => 2, 'graph' => 0, 'descr' => 'Battery'],
|
|
|
|
|
['value' => 6, 'generic' => 2, 'graph' => 0, 'descr' => 'Booster'],
|
|
|
|
|
['value' => 7, 'generic' => 2, 'graph' => 0, 'descr' => 'Reducer'],
|
|
|
|
|
]
|
2017-09-19 14:12:04 -05:00
|
|
|
);
|
2017-03-12 20:55:13 +01:00
|
|
|
|
2017-10-02 10:08:02 -05:00
|
|
|
$sensor_index = 0;
|
2017-09-19 14:12:04 -05:00
|
|
|
discover_sensor(
|
|
|
|
|
$valid['sensor'],
|
|
|
|
|
'state',
|
|
|
|
|
$device,
|
|
|
|
|
'.1.3.6.1.2.1.33.1.4.1.0',
|
2017-10-02 10:08:02 -05:00
|
|
|
$sensor_index,
|
2017-09-19 14:12:04 -05:00
|
|
|
$state_name,
|
|
|
|
|
'Output Source',
|
|
|
|
|
1,
|
|
|
|
|
1,
|
|
|
|
|
null,
|
|
|
|
|
null,
|
|
|
|
|
null,
|
|
|
|
|
null,
|
|
|
|
|
$state,
|
|
|
|
|
'snmp',
|
|
|
|
|
0
|
|
|
|
|
);
|
2017-03-12 20:55:13 +01:00
|
|
|
|
|
|
|
|
//Create Sensor To State Index
|
2017-10-02 10:08:02 -05:00
|
|
|
create_sensor_to_state_index($device, $state_name, $sensor_index);
|
2017-02-03 12:39:38 +00:00
|
|
|
}
|