mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
app-ups-nut update 1
This commit is contained in:
@@ -13,10 +13,14 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
|
* @version 1.1
|
||||||
* @package LibreNMS
|
* @package LibreNMS
|
||||||
* @link http://librenms.org
|
* @link http://librenms.org
|
||||||
* @copyright 2016 crcro
|
* @copyright 2016 crcro
|
||||||
* @author Cercel Valentin <crc@nuamchefazi.ro>
|
* @author Cercel Valentin <crc@nuamchefazi.ro>
|
||||||
|
*
|
||||||
|
* v1 - initial release
|
||||||
|
* v1.1 - changed description from seconds to minutes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require 'includes/graphs/common.inc.php';
|
require 'includes/graphs/common.inc.php';
|
||||||
@@ -27,7 +31,7 @@ $colour_area = 'EEEEEE';
|
|||||||
$colour_line = '36393D';
|
$colour_line = '36393D';
|
||||||
$colour_area_max = 'FFEE99';
|
$colour_area_max = 'FFEE99';
|
||||||
$graph_max = 0;
|
$graph_max = 0;
|
||||||
$unit_text = 'Seconds';
|
$unit_text = 'Minutes';
|
||||||
$ups_nut = rrd_name($device['hostname'], array('app', 'ups-nut', $app['app_id']));
|
$ups_nut = rrd_name($device['hostname'], array('app', 'ups-nut', $app['app_id']));
|
||||||
if (rrdtool_check_rrd_exists($ups_nut)) {
|
if (rrdtool_check_rrd_exists($ups_nut)) {
|
||||||
$rrd_filename = $ups_nut;
|
$rrd_filename = $ups_nut;
|
||||||
|
@@ -13,10 +13,14 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
|
* @version 1.1
|
||||||
* @package LibreNMS
|
* @package LibreNMS
|
||||||
* @link http://librenms.org
|
* @link http://librenms.org
|
||||||
* @copyright 2016 crcro
|
* @copyright 2016 crcro
|
||||||
* @author Cercel Valentin <crc@nuamchefazi.ro>
|
* @author Cercel Valentin <crc@nuamchefazi.ro>
|
||||||
|
*
|
||||||
|
* v1 - initial release
|
||||||
|
* v1.1 - removed the battery_low graph
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require 'includes/graphs/common.inc.php';
|
require 'includes/graphs/common.inc.php';
|
||||||
@@ -33,7 +37,6 @@ $addarea = 1;
|
|||||||
$transparency = 33;
|
$transparency = 33;
|
||||||
$rrd_filename = rrd_name($device['hostname'], array('app', 'ups-nut', $app['app_id']));
|
$rrd_filename = rrd_name($device['hostname'], array('app', 'ups-nut', $app['app_id']));
|
||||||
$array = array(
|
$array = array(
|
||||||
'battery_low' => array('descr' => 'Low','colour' => '630606',),
|
|
||||||
'battery_voltage' => array('descr' => 'Current','colour' => '50C150',),
|
'battery_voltage' => array('descr' => 'Current','colour' => '50C150',),
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -48,7 +51,7 @@ if (rrdtool_check_rrd_exists($rrd_filename)) {
|
|||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
echo "file missing: $rrd_filename";
|
echo "file missing: ".$rrd_filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
require 'includes/graphs/generic_v3_multiline_float.inc.php';
|
require 'includes/graphs/generic_v3_multiline_float.inc.php';
|
||||||
|
@@ -22,8 +22,8 @@
|
|||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
//NET-SNMP-EXTEND-MIB::nsExtendOutLine.\"ups-nut\"
|
//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_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.4', '-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_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.5', '-Oqv');
|
||||||
$ups_details = $ups_model.' (SN:'.$ups_serial.')';
|
$ups_details = $ups_model.' (SN:'.$ups_serial.')';
|
||||||
|
|
||||||
$graphs = array(
|
$graphs = array(
|
||||||
|
@@ -13,10 +13,16 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
|
* @version 1.1
|
||||||
* @package LibreNMS
|
* @package LibreNMS
|
||||||
* @link http://librenms.org
|
* @link http://librenms.org
|
||||||
* @copyright 2016 crcro
|
* @copyright 2016 crcro
|
||||||
* @author Cercel Valentin <crc@nuamchefazi.ro>
|
* @author Cercel Valentin <crc@nuamchefazi.ro>
|
||||||
|
*
|
||||||
|
* v1 - initial release
|
||||||
|
* v1.1 - removed battery_low value
|
||||||
|
* - corrected line nominal and input values
|
||||||
|
* - convert seconds to minutes on remaining uptime
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//NET-SNMP-EXTEND-MIB::nsExtendOutputFull."ups-nut"
|
//NET-SNMP-EXTEND-MIB::nsExtendOutputFull."ups-nut"
|
||||||
@@ -27,12 +33,11 @@ $ups_nut = snmp_get($device, $oid, '-Oqv');
|
|||||||
|
|
||||||
echo ' '.$name;
|
echo ' '.$name;
|
||||||
|
|
||||||
list ($charge, $bat_low, $remaining, $bat_volt, $model, $serial, $input_vol, $line_vol, $load) = explode("\n", $ups_nut);
|
list ($charge, $remaining, $bat_volt, $model, $serial, $input_volt, $line_volt, $load) = explode("\n", $ups_nut);
|
||||||
|
|
||||||
$rrd_name = array('app', $name, $app_id);
|
$rrd_name = array('app', $name, $app_id);
|
||||||
$rrd_def = array(
|
$rrd_def = array(
|
||||||
'DS:charge:GAUGE:600:0:100',
|
'DS:charge:GAUGE:600:0:100',
|
||||||
'DS:battery_low:GAUGE:600:0:100',
|
|
||||||
'DS:time_remaining:GAUGE:600:0:U',
|
'DS:time_remaining:GAUGE:600:0:U',
|
||||||
'DS:battery_voltage:GAUGE:600:0:U',
|
'DS:battery_voltage:GAUGE:600:0:U',
|
||||||
'DS:input_voltage:GAUGE:600:0:U',
|
'DS:input_voltage:GAUGE:600:0:U',
|
||||||
@@ -42,11 +47,10 @@ $rrd_def = array(
|
|||||||
|
|
||||||
$fields = array(
|
$fields = array(
|
||||||
'charge' => $charge,
|
'charge' => $charge,
|
||||||
'battery_low' => $bat_low,
|
'time_remaining' => $remaining/60,
|
||||||
'time_remaining' => $remaining,
|
|
||||||
'battery_voltage' => $bat_volt,
|
'battery_voltage' => $bat_volt,
|
||||||
'input_voltage' => $input_vol,
|
'input_voltage' => $line_volt,
|
||||||
'nominal_voltage' => $line_vol,
|
'nominal_voltage' => $input_volt,
|
||||||
'load' => $load,
|
'load' => $load,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user