#!/usr/bin/perl -w # -*- cperl -*- # vim: ft=perl =head1 NAME snmp__syno_ups - Munin plugin to retrieve various information of the UPS attached to a Synology NAS. =head1 APPLICABLE SYSTEMS Any Synology NAS device which provides the synoUPS MIB. =head1 CONFIGURATION As a rule SNMP plugins need site specific configuration. The default configuration (shown here) will only work on insecure sites/devices. [snmp_*] env.version 2 env.community public In general SNMP is not very secure at all unless you use SNMP version 3 which supports authentication and privacy (encryption). But in any case the community string for your devices should not be "public". Please see 'perldoc Munin::Plugin::SNMP' for further configuration information. =head1 INTERPRETATION The plugin reports the following stats about the UPS attached: - Load in % - Charge in % =head1 MIB INFORMATION This plugin requires support for the synoUPS MIB by Synology. =head1 MAGIC MARKERS #%# family=snmpauto #%# capabilities=snmpconf =head1 VERSION $Id$ =head1 BUGS None known. =head1 AUTHOR Copyright (C) 2015 Thomas Arthofer =head1 LICENSE GPLv2 or (at your option) any later version. =cut use strict; use Munin::Plugin::SNMP; if (defined $ARGV[0] and $ARGV[0] eq "snmpconf") { print "require 1.3.6.1.4.1.6574.4.3.1.1.0 [0-9]\n"; # Charge print "require 1.3.6.1.4.1.6574.4.2.12.1.0 [0-9]\n"; # Load exit 0; } if (defined $ARGV[0] and $ARGV[0] eq "config") { my ($host) = Munin::Plugin::SNMP->config_session(); print "host_name $host\n" unless $host eq 'localhost'; print "graph_title UPS graph_args --base 1000 -l 0 graph_vlabel Status of UPS graph_category system graph_info This graph shows the status of the attached UPS. charge.label Charge charge.info Charge status of battery. charge.draw LINE2 load.label Load load.info Load on the UPS "; exit 0; } my $session = Munin::Plugin::SNMP->session(-translate => [ -timeticks => 0x0 ]); my $charge = $session->get_single (".1.3.6.1.4.1.6574.4.3.1.1.0") || 'ERROR'; $charge = unpack "f", reverse pack "H*", $charge; my $load = $session->get_single (".1.3.6.1.4.1.6574.4.2.12.1.0") || 'ERROR'; $load = unpack "f", reverse pack "H*", $load; print "Retrived charge '$charge'\n" if $Munin::Plugin::SNMP::DEBUG; print "Retrived load '$load'\n" if $Munin::Plugin::SNMP::DEBUG; print "charge.value ", $charge, "\n"; print "load.value ", $load, "\n";