Merge pull request #4448 from crcro/app-ups-nut-update1

app: ups-nut update 1
This commit is contained in:
Neil Lathwood
2016-09-24 18:29:25 +01:00
committed by GitHub
6 changed files with 24 additions and 17 deletions

View File

@ -31,5 +31,8 @@ $unit_text = 'Percent';
$ups_nut = rrd_name($device['hostname'], array('app', 'ups-nut', $app['app_id']));
if (rrdtool_check_rrd_exists($ups_nut)) {
$rrd_filename = $ups_nut;
} else {
echo "file missing: $rrd_filename";
}
require 'includes/graphs/generic_simplex.inc.php';

View File

@ -31,5 +31,8 @@ $unit_text = 'Percent';
$ups_nut = rrd_name($device['hostname'], array('app', 'ups-nut', $app['app_id']));
if (rrdtool_check_rrd_exists($ups_nut)) {
$rrd_filename = $ups_nut;
} else {
echo "file missing: $rrd_filename";
}
require 'includes/graphs/generic_simplex.inc.php';

View File

@ -17,6 +17,7 @@
* @link http://librenms.org
* @copyright 2016 crcro
* @author Cercel Valentin <crc@nuamchefazi.ro>
*
*/
require 'includes/graphs/common.inc.php';
@ -27,9 +28,12 @@ $colour_area = 'EEEEEE';
$colour_line = '36393D';
$colour_area_max = 'FFEE99';
$graph_max = 0;
$unit_text = 'Seconds';
$unit_text = 'Minutes';
$ups_nut = rrd_name($device['hostname'], array('app', 'ups-nut', $app['app_id']));
if (rrdtool_check_rrd_exists($ups_nut)) {
$rrd_filename = $ups_nut;
} else {
echo "file missing: $rrd_filename";
}
require 'includes/graphs/generic_simplex.inc.php';

View File

@ -17,6 +17,7 @@
* @link http://librenms.org
* @copyright 2016 crcro
* @author Cercel Valentin <crc@nuamchefazi.ro>
*
*/
require 'includes/graphs/common.inc.php';
@ -33,7 +34,6 @@ $addarea = 1;
$transparency = 33;
$rrd_filename = rrd_name($device['hostname'], array('app', 'ups-nut', $app['app_id']));
$array = array(
'battery_low' => array('descr' => 'Low','colour' => '630606',),
'battery_voltage' => array('descr' => 'Current','colour' => '50C150',),
);

View File

@ -17,21 +17,17 @@
* @link http://librenms.org
* @copyright 2016 crcro
* @author Cercel Valentin <crc@nuamchefazi.ro>
*
*/
global $config;
//NET-SNMP-EXTEND-MIB::nsExtendOutLine.\"ups-nut\"
$ups_model = snmp_get($device, '.1.3.6.1.4.1.8072.1.3.2.4.1.2.7.117.112.115.45.110.117.116.5', '-Oqv');
$ups_serial = snmp_get($device, '.1.3.6.1.4.1.8072.1.3.2.4.1.2.7.117.112.115.45.110.117.116.6', '-Oqv');
$ups_details = $ups_model.' (SN:'.$ups_serial.')';
$graphs = array(
'ups-nut_remaining' => 'Remaining time: '.$ups_details,
'ups-nut_load' => 'Load: '.$ups_details,
'ups-nut_voltage_battery' => 'Battery voltage: '.$ups_details,
'ups-nut_charge' => 'Charge: '.$ups_details,
'ups-nut_voltage_input' => 'Input voltage: '.$ups_details,
'ups-nut_remaining' => 'Remaining time: ',
'ups-nut_load' => 'Load: ',
'ups-nut_voltage_battery' => 'Battery voltage: ',
'ups-nut_charge' => 'Charge: ',
'ups-nut_voltage_input' => 'Input voltage: ',
);
foreach ($graphs as $key => $text) {

View File

@ -17,6 +17,7 @@
* @link http://librenms.org
* @copyright 2016 crcro
* @author Cercel Valentin <crc@nuamchefazi.ro>
*
*/
//NET-SNMP-EXTEND-MIB::nsExtendOutputFull."ups-nut"
@ -27,7 +28,7 @@ $ups_nut = snmp_get($device, $oid, '-Oqv');
echo ' '.$name;
list ($charge, $bat_low, $remaining, $bat_volt, $model, $serial, $input_vol, $line_vol, $load) = explode("\n", $ups_nut);
list ($charge, $battery_low, $remaining, $bat_volt, $input_volt, $line_volt, $load) = explode("\n", $ups_nut);
$rrd_name = array('app', $name, $app_id);
$rrd_def = array(
@ -42,11 +43,11 @@ $rrd_def = array(
$fields = array(
'charge' => $charge,
'battery_low' => $bat_low,
'time_remaining' => $remaining,
'battery_low' => $battery_low,
'time_remaining' => $remaining/60,
'battery_voltage' => $bat_volt,
'input_voltage' => $input_vol,
'nominal_voltage' => $line_vol,
'input_voltage' => $line_volt,
'nominal_voltage' => $input_volt,
'load' => $load,
);