fix: Change rfc1628 'state' (est. runtime and on battery) to runtime (#6158)

* fix: Change rfc1628 'state' (est. runtime and on battery) to runtime

* Fix up the graph error ( : in ds name).
Change seconds on battery to minutes so the value is in minutes

* wrong scale for limits

* Don't use snmp_walk
This commit is contained in:
Tony Murray 2017-03-12 16:44:24 -05:00 committed by Neil Lathwood
parent 9c43fbd76b
commit 4ae4847a60
2 changed files with 54 additions and 2 deletions

View File

@ -1,8 +1,8 @@
<?php
$scale_min = '0';
require 'includes/graphs/common.inc.php';
$rrd_options .= " COMMENT:' Last Max\\n'";
$sensor['sensor_descr_fixed'] = substr(str_pad($sensor['sensor_descr'], 28), 0, 28);
$rrd_options .= " COMMENT:' Last Max\\n'";
$sensor['sensor_descr_fixed'] = rrdtool_escape($sensor['sensor_descr'], 32);
$rrd_options .= " DEF:sensor=$rrd_filename:sensor:AVERAGE";
$rrd_options .= " LINE1.5:sensor#cc0000:'".$sensor['sensor_descr_fixed']."'";
$rrd_options .= ' GPRINT:sensor:LAST:%3.0lfMin';

View File

@ -0,0 +1,52 @@
<?php
echo 'RFC1628 ';
// UPS-MIB::upsSeconsOnBattery
$secs_on_battery_oid = '.1.3.6.1.2.1.33.1.2.2.0';
$secs_on_battery = snmp_get($device, $secs_on_battery_oid, '-Oqv');
if (is_numeric($secs_on_battery)) {
discover_sensor(
$valid['sensor'],
'runtime',
$device,
$secs_on_battery_oid,
100,
'rfc1628',
'Time on battery',
60,
1,
0,
0,
1,
2,
$secs_on_battery
);
}
// UPS-MIB::upsEstimatedMinutesRemaining
$est_battery_time_oid = ".1.3.6.1.2.1.33.1.2.3.0";
$est_battery_time = snmp_get($device, $est_battery_time_oid, '-Ovq');
if (is_numeric($est_battery_time)) {
discover_sensor(
$valid['sensor'],
'runtime',
$device,
$est_battery_time_oid,
200,
'rfc1628',
'Estimated battery time remaining',
1,
1,
5,
10,
null,
10000,
$est_battery_time
);
}
unset($secs_on_battery, $secs_on_battery_oid, $est_battery_time, $est_battery_time_oid);