mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
feature: new app: ups-nut (#4386)
* app: ups-nut * newline ... * removed code from another pr * added battery charge status * added battery charge status * be happy travis... * added UPS-nut to Applications
This commit is contained in:
@@ -21,6 +21,7 @@ Different applications support a variety of ways collect data: by direct connect
|
||||
1. [Raspberry PI](#raspberry-pi) - SNMP extend
|
||||
1. [TinyDNS/djbdns](#tinydns-aka-djbdns) - Agent
|
||||
1. [Unbound](#unbound) - Agent
|
||||
1. [UPS-nut](#ups-nut) - SNMP extend
|
||||
1. [Agent Setup](#agent-setup)
|
||||
|
||||
|
||||
@@ -307,6 +308,21 @@ Restart your unbound after changing the configuration,v erify it is working by r
|
||||
|
||||
|
||||
|
||||
### UPS-nut
|
||||
A small shell script that exports nut ups status.
|
||||
|
||||
##### SNMP Extend
|
||||
1. Copy the [ups nut](https://github.com/librenms/librenms-agent/blob/master/snmp/ups-nut.sh) to `/opt/` (or any other suitable location) on your PI host.
|
||||
2. Make the script executable (chmod +x /opt/ups-nut.sh)
|
||||
3. Edit your snmpd.conf file (usually /etc/snmp/snmpd.conf) and add:
|
||||
```
|
||||
extend ups-nut /opt/ups-nut.sh
|
||||
```
|
||||
4. Restart snmpd on your host
|
||||
5. On the device page in Librenms, edit your host and check the `UPS nut` under the Applications tab.
|
||||
|
||||
|
||||
|
||||
Agent Setup
|
||||
-----------
|
||||
|
||||
|
@@ -88,6 +88,9 @@ function nicecase($item)
|
||||
case 'dhcp-stats':
|
||||
return 'DHCP Stats';
|
||||
|
||||
case 'ups-nut':
|
||||
return 'UPS nut';
|
||||
|
||||
default:
|
||||
return ucfirst($item);
|
||||
}
|
||||
|
35
html/includes/graphs/application/ups-nut_charge.inc.php
Normal file
35
html/includes/graphs/application/ups-nut_charge.inc.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @package LibreNMS
|
||||
* @link http://librenms.org
|
||||
* @copyright 2016 crcro
|
||||
* @author Cercel Valentin <crc@nuamchefazi.ro>
|
||||
*/
|
||||
|
||||
require 'includes/graphs/common.inc.php';
|
||||
|
||||
$scale_min = 0;
|
||||
$ds = 'charge';
|
||||
$colour_area = 'EEEEEE';
|
||||
$colour_line = 'FF3300';
|
||||
$colour_area_max = 'FFEE99';
|
||||
$graph_max = 0;
|
||||
$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;
|
||||
}
|
||||
require 'includes/graphs/generic_simplex.inc.php';
|
35
html/includes/graphs/application/ups-nut_load.inc.php
Normal file
35
html/includes/graphs/application/ups-nut_load.inc.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @package LibreNMS
|
||||
* @link http://librenms.org
|
||||
* @copyright 2016 crcro
|
||||
* @author Cercel Valentin <crc@nuamchefazi.ro>
|
||||
*/
|
||||
|
||||
require 'includes/graphs/common.inc.php';
|
||||
|
||||
$scale_min = 0;
|
||||
$ds = 'load';
|
||||
$colour_area = 'EEEEEE';
|
||||
$colour_line = 'FF3300';
|
||||
$colour_area_max = 'FFEE99';
|
||||
$graph_max = 0;
|
||||
$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;
|
||||
}
|
||||
require 'includes/graphs/generic_simplex.inc.php';
|
35
html/includes/graphs/application/ups-nut_remaining.inc.php
Normal file
35
html/includes/graphs/application/ups-nut_remaining.inc.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @package LibreNMS
|
||||
* @link http://librenms.org
|
||||
* @copyright 2016 crcro
|
||||
* @author Cercel Valentin <crc@nuamchefazi.ro>
|
||||
*/
|
||||
|
||||
require 'includes/graphs/common.inc.php';
|
||||
|
||||
$scale_min = 0;
|
||||
$ds = 'time_remaining';
|
||||
$colour_area = 'EEEEEE';
|
||||
$colour_line = '36393D';
|
||||
$colour_area_max = 'FFEE99';
|
||||
$graph_max = 0;
|
||||
$unit_text = 'Seconds';
|
||||
$ups_nut = rrd_name($device['hostname'], array('app', 'ups-nut', $app['app_id']));
|
||||
if (rrdtool_check_rrd_exists($ups_nut)) {
|
||||
$rrd_filename = $ups_nut;
|
||||
}
|
||||
require 'includes/graphs/generic_simplex.inc.php';
|
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @package LibreNMS
|
||||
* @link http://librenms.org
|
||||
* @copyright 2016 crcro
|
||||
* @author Cercel Valentin <crc@nuamchefazi.ro>
|
||||
*/
|
||||
|
||||
require 'includes/graphs/common.inc.php';
|
||||
|
||||
$scale_min = 0;
|
||||
$colours = 'mixed';
|
||||
$unit_text = 'Volts';
|
||||
$unitlen = 10;
|
||||
$bigdescrlen = 15;
|
||||
$smalldescrlen = 15;
|
||||
$dostack = 0;
|
||||
$printtotal = 0;
|
||||
$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',),
|
||||
);
|
||||
|
||||
$i = 0;
|
||||
|
||||
if (rrdtool_check_rrd_exists($rrd_filename)) {
|
||||
foreach ($array as $ds => $vars) {
|
||||
$rrd_list[$i]['filename'] = $rrd_filename;
|
||||
$rrd_list[$i]['descr'] = $vars['descr'];
|
||||
$rrd_list[$i]['ds'] = $ds;
|
||||
$rrd_list[$i]['colour'] = $vars['colour'];
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
echo "file missing: $rrd_filename";
|
||||
}
|
||||
|
||||
require 'includes/graphs/generic_v3_multiline_float.inc.php';
|
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @package LibreNMS
|
||||
* @link http://librenms.org
|
||||
* @copyright 2016 crcro
|
||||
* @author Cercel Valentin <crc@nuamchefazi.ro>
|
||||
*/
|
||||
|
||||
require 'includes/graphs/common.inc.php';
|
||||
|
||||
$scale_min = 0;
|
||||
$colours = 'mixed';
|
||||
$unit_text = 'Volts';
|
||||
$unitlen = 10;
|
||||
$bigdescrlen = 15;
|
||||
$smalldescrlen = 15;
|
||||
$dostack = 0;
|
||||
$printtotal = 0;
|
||||
$addarea = 1;
|
||||
$transparency = 33;
|
||||
$rrd_filename = rrd_name($device['hostname'], array('app', 'ups-nut', $app['app_id']));
|
||||
$array = array(
|
||||
'input_voltage' => array('descr' => 'Input','colour' => '630606',),
|
||||
'nominal_voltage' => array('descr' => 'Nominal','colour' => '50C150',),
|
||||
);
|
||||
|
||||
$i = 0;
|
||||
|
||||
if (rrdtool_check_rrd_exists($rrd_filename)) {
|
||||
foreach ($array as $ds => $vars) {
|
||||
$rrd_list[$i]['filename'] = $rrd_filename;
|
||||
$rrd_list[$i]['descr'] = $vars['descr'];
|
||||
$rrd_list[$i]['ds'] = $ds;
|
||||
$rrd_list[$i]['colour'] = $vars['colour'];
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
echo "file missing: $rrd_filename";
|
||||
}
|
||||
|
||||
require 'includes/graphs/generic_v3_multiline_float.inc.php';
|
114
html/includes/graphs/generic_v3_multiline_float.inc.php
Normal file
114
html/includes/graphs/generic_v3_multiline_float.inc.php
Normal file
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
require 'includes/graphs/common.inc.php';
|
||||
|
||||
if ($width > '500') {
|
||||
$descr_len = $bigdescrlen;
|
||||
} else {
|
||||
$descr_len = $smalldescrlen;
|
||||
}
|
||||
|
||||
if ($printtotal === 1) {
|
||||
$descr_len += '2';
|
||||
$unitlen += '2';
|
||||
}
|
||||
|
||||
$unit_text = str_pad(truncate($unit_text, $unitlen), $unitlen);
|
||||
|
||||
if ($width > '500') {
|
||||
$rrd_options .= " COMMENT:'".substr(str_pad($unit_text, ($descr_len + 10)), 0, ($descr_len + 10))."Now Min Max Avg\l'";
|
||||
if ($printtotal === 1) {
|
||||
$rrd_options .= " COMMENT:'Total '";
|
||||
}
|
||||
$rrd_options .= " COMMENT:'\l'";
|
||||
} else {
|
||||
$rrd_options .= " COMMENT:'".substr(str_pad($unit_text, ($descr_len + 10)), 0, ($descr_len + 10))."Now Min Max Avg\l'";
|
||||
}
|
||||
|
||||
foreach ($rrd_list as $rrd) {
|
||||
if ($rrd['colour']) {
|
||||
$colour = $rrd['colour'];
|
||||
} else {
|
||||
if (!$config['graph_colours'][$colours][$colour_iter]) {
|
||||
$colour_iter = 0;
|
||||
}
|
||||
|
||||
$colour = $config['graph_colours'][$colours][$colour_iter];
|
||||
$colour_iter++;
|
||||
}
|
||||
|
||||
$ds = $rrd['ds'];
|
||||
$filename = $rrd['filename'];
|
||||
|
||||
$descr = rrdtool_escape($rrd['descr'], $descr_len);
|
||||
$id = 'ds'.$i;
|
||||
|
||||
$rrd_options .= ' DEF:'.$rrd['ds'].$i.'='.$rrd['filename'].':'.$rrd['ds'].':AVERAGE ';
|
||||
|
||||
if ($simple_rrd) {
|
||||
$rrd_options .= ' CDEF:'.$rrd['ds'].$i.'min='.$rrd['ds'].$i.' ';
|
||||
$rrd_options .= ' CDEF:'.$rrd['ds'].$i.'max='.$rrd['ds'].$i.' ';
|
||||
} else {
|
||||
$rrd_options .= ' DEF:'.$rrd['ds'].$i.'min='.$rrd['filename'].':'.$rrd['ds'].':MIN ';
|
||||
$rrd_options .= ' DEF:'.$rrd['ds'].$i.'max='.$rrd['filename'].':'.$rrd['ds'].':MAX ';
|
||||
}
|
||||
|
||||
if ($_GET['previous']) {
|
||||
$rrd_options .= ' DEF:'.$i.'X='.$rrd['filename'].':'.$rrd['ds'].':AVERAGE:start='.$prev_from.':end='.$from;
|
||||
$rrd_options .= ' SHIFT:'.$i."X:$period";
|
||||
$thingX .= $seperatorX.$i.'X,UN,0,'.$i.'X,IF';
|
||||
$plusesX .= $plusX;
|
||||
$seperatorX = ',';
|
||||
$plusX = ',+';
|
||||
}
|
||||
|
||||
if ($printtotal === 1) {
|
||||
$rrd_options .= ' VDEF:tot'.$rrd['ds'].$i.'='.$rrd['ds'].$i.',TOTAL';
|
||||
}
|
||||
|
||||
$g_defname = $rrd['ds'];
|
||||
if (is_numeric($multiplier)) {
|
||||
$g_defname = $rrd['ds'].'_cdef';
|
||||
$rrd_options .= ' CDEF:'.$g_defname.$i.'='.$rrd['ds'].$i.','.$multiplier.',*';
|
||||
$rrd_options .= ' CDEF:'.$g_defname.$i.'min='.$rrd['ds'].$i.'min,'.$multiplier.',*';
|
||||
$rrd_options .= ' CDEF:'.$g_defname.$i.'max='.$rrd['ds'].$i.'max,'.$multiplier.',*';
|
||||
} elseif (is_numeric($divider)) {
|
||||
$g_defname = $rrd['ds'].'_cdef';
|
||||
$rrd_options .= ' CDEF:'.$g_defname.$i.'='.$rrd['ds'].$i.','.$divider.',/';
|
||||
$rrd_options .= ' CDEF:'.$g_defname.$i.'min='.$rrd['ds'].$i.'min,'.$divider.',/';
|
||||
$rrd_options .= ' CDEF:'.$g_defname.$i.'max='.$rrd['ds'].$i.'max,'.$divider.',/';
|
||||
}
|
||||
|
||||
if (isset($text_orig) && $text_orig) {
|
||||
$t_defname = $rrd['ds'];
|
||||
} else {
|
||||
$t_defname = $g_defname;
|
||||
}
|
||||
|
||||
if ($i && ($dostack === 1)) {
|
||||
$stack = ':STACK';
|
||||
}
|
||||
|
||||
$rrd_options .= ' LINE2:'.$g_defname.$i.'#'.$colour.":'".$descr."'$stack";
|
||||
if ($addarea === 1) {
|
||||
$rrd_options .= ' AREA:'.$g_defname.$i.'#'.$colour.$transparency.":''$stack";
|
||||
}
|
||||
$rrd_options .= ' GPRINT:'.$t_defname.$i.':LAST:%6.2lf%s GPRINT:'.$t_defname.$i.'min:MIN:%6.2lf%s';
|
||||
$rrd_options .= ' GPRINT:'.$t_defname.$i.'max:MAX:%6.2lf%s GPRINT:'.$t_defname.$i.":AVERAGE:'%6.2lf%s\\n'";
|
||||
|
||||
if ($printtotal === 1) {
|
||||
$rrd_options .= ' GPRINT:tot'.$rrd['ds'].$i.":%6.2lf%s'".rrdtool_escape($total_units)."'";
|
||||
}
|
||||
|
||||
$rrd_options .= " COMMENT:'\\n'";
|
||||
}//end foreach
|
||||
|
||||
if ($_GET['previous'] == 'yes') {
|
||||
if (is_numeric($multiplier)) {
|
||||
$rrd_options .= ' CDEF:X='.$thingX.$plusesX.','.$multiplier.',*';
|
||||
} elseif (is_numeric($divider)) {
|
||||
$rrd_options .= ' CDEF:X='.$thingX.$plusesX.','.$divider.',/';
|
||||
} else {
|
||||
$rrd_options .= ' CDEF:X='.$thingX.$plusesX;
|
||||
}
|
||||
$rrd_options .= ' HRULE:0#555555';
|
||||
}
|
@@ -104,6 +104,14 @@ $graphs['freeswitch'] = array(
|
||||
'callsOut',
|
||||
);
|
||||
|
||||
$graphs['ups-nut'] = array(
|
||||
'remaining',
|
||||
'load',
|
||||
'voltage_battery',
|
||||
'charge',
|
||||
'voltage_input',
|
||||
);
|
||||
|
||||
print_optionbar_start();
|
||||
|
||||
echo "<span style='font-weight: bold;'>Apps</span> » ";
|
||||
|
55
html/pages/device/apps/ups-nut.inc.php
Normal file
55
html/pages/device/apps/ups-nut.inc.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @package LibreNMS
|
||||
* @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,
|
||||
);
|
||||
|
||||
foreach ($graphs as $key => $text) {
|
||||
$graph_type = $key;
|
||||
$graph_array['height'] = '100';
|
||||
$graph_array['width'] = '215';
|
||||
$graph_array['to'] = $config['time']['now'];
|
||||
$graph_array['id'] = $app['app_id'];
|
||||
$graph_array['type'] = 'application_'.$key;
|
||||
|
||||
echo '<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">'.$text.'</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="row">';
|
||||
include 'includes/print-graphrow.inc.php';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
}
|
54
includes/polling/applications/ups-nut.inc.php
Normal file
54
includes/polling/applications/ups-nut.inc.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @package LibreNMS
|
||||
* @link http://librenms.org
|
||||
* @copyright 2016 crcro
|
||||
* @author Cercel Valentin <crc@nuamchefazi.ro>
|
||||
*/
|
||||
|
||||
//NET-SNMP-EXTEND-MIB::nsExtendOutputFull."ups-nut"
|
||||
$name = 'ups-nut';
|
||||
$app_id = $app['app_id'];
|
||||
$oid = '.1.3.6.1.4.1.8072.1.3.2.3.1.2.7.117.112.115.45.110.117.116';
|
||||
$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);
|
||||
|
||||
$rrd_name = array('app', $name, $app_id);
|
||||
$rrd_def = array(
|
||||
'DS:charge:GAUGE:600:0:100',
|
||||
'DS:battery_low:GAUGE:600:0:100',
|
||||
'DS:time_remaining:GAUGE:600:0:U',
|
||||
'DS:battery_voltage:GAUGE:600:0:U',
|
||||
'DS:input_voltage:GAUGE:600:0:U',
|
||||
'DS:nominal_voltage:GAUGE:600:0:U',
|
||||
'DS:load:GAUGE:600:0:100'
|
||||
);
|
||||
|
||||
$fields = array(
|
||||
'charge' => $charge,
|
||||
'battery_low' => $bat_low,
|
||||
'time_remaining' => $remaining,
|
||||
'battery_voltage' => $bat_volt,
|
||||
'input_voltage' => $input_vol,
|
||||
'nominal_voltage' => $line_vol,
|
||||
'load' => $load,
|
||||
);
|
||||
|
||||
$tags = compact('name', 'app_id', 'rrd_name', 'rrd_def');
|
||||
data_update($device, 'app', $tags, $fields);
|
Reference in New Issue
Block a user