/usr/share/munin/plugins/snmp__uptime is in munin-node 1.4.6-3ubuntu3.4.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | #!/usr/bin/perl -w
# -*- cperl -*-
=head1 NAME
snmp__uptime - Munin plugin to retrive uptime information from a SNMP
device.
=head1 APPLICABLE SYSTEMS
Uptime should be supported by all SNMP devices that support SNMPv2 and
up (If I have understood the MIBs rightly :-)
=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 how long the device has been up. This is not the
same as uptime in percent as used in SLAs.
The day and week graphs for uptime are not very interesting - the
year, and perhaps the month graphs are more interesting. The year
graphs average number will show your devices average uptime the last
year (actually 400 days).
=head1 MIB INFORMATION
This plugin requires support for the DISMAN-EVENT-MIB authored by the
IETF Distributed Management Working Group. It reports the
contents of the sysUpTimeInstance OID.
=head1 MAGIC MARKERS
#%# family=snmpauto
#%# capabilities=snmpconf
=head1 VERSION
$Id: snmp__uptime.in 2431 2009-09-16 10:04:17Z janl $
=head1 BUGS
None known.
=head1 AUTHOR
Copyright (C) 2000-2009 by various authors.
Original Nagios plugin: Sébastien Barbereau.
Introduced to Munin in 2006 based on the Nagios plugin by: Andreas
Schuldei
In 2008 updated for Munin::Plugin::SNMP and documented by Nicolai
Langfeldt.
=head1 LICENSE
GPLv2 or (at your option) any later version.
=cut
use strict;
use Munin::Plugin::SNMP;
use vars qw($DEBUG);
$DEBUG = $ENV{'MUNIN_DEBUG'};
my $response;
if (defined $ARGV[0] and $ARGV[0] eq "snmpconf") {
print "require 1.3.6.1.2.1.1.3.0 [0-9]\n"; # Number
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 System Uptime
graph_args --base 1000 -l 0
graph_vlabel uptime in days
graph_category system
graph_info This graph shows the number of days that the the host is up and running so far.
uptime.label uptime
uptime.info The system uptime itself in days.
uptime.draw AREA
";
exit 0;
}
my $session = Munin::Plugin::SNMP->session(-translate =>
[ -timeticks => 0x0 ]);
my $uptime = $session->get_single (".1.3.6.1.2.1.1.3.0") || 'U';
print "Retrived uptime is '$uptime'\n" if $DEBUG;
if ($uptime ne 'U') {
$uptime /= 8640000;
}
print "uptime.value ", $uptime, "\n";
|