2
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00
contrib-munin/plugins/openwrt/snmp__memory_openwrt

92 lines
2 KiB
Text
Raw Normal View History

2017-06-27 02:22:58 +02:00
#!/usr/bin/env perl
2017-06-26 08:26:52 +02:00
# -*- perl -*-
# vim: ft=perl
2008-08-05 09:13:09 +02:00
2017-06-26 08:26:52 +02:00
=head1 NAME
2008-08-05 09:13:09 +02:00
2017-06-26 08:26:52 +02:00
snmp__memory_openwrt - Munin plugin to monitor the memory usage of an OpenWrt
device.
2008-08-05 09:13:09 +02:00
2017-06-26 08:26:52 +02:00
=head1 APPLICABLE SYSTEMS
2008-08-05 09:13:09 +02:00
2017-06-26 08:26:52 +02:00
OpenWrt devices which have snmpd installed.
2008-08-05 09:13:09 +02:00
2017-06-26 08:26:52 +02:00
=head1 CONFIGURATION
2008-08-05 09:13:09 +02:00
2017-06-26 08:26:52 +02:00
As a rule SNMP plugins need site specific configuration. The default
configuration (shown here) will only work on insecure sites/devices.
2017-06-27 02:17:16 +02:00
[snmp_*]
env.version 2
2017-06-26 08:26:52 +02:00
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 total and used memory on the system.
=head1 MIB INFORMATION
This plugin requires support for the HOST-RESOURCES-MIB (RFC 2790). It
reports the contents of the hrStorageSize and hrStorageUsed OIDs.
=head1 MAGIC MARKERS
#%# family=snmpauto
#%# capabilities=snmpconf
=head1 BUGS
2008-08-05 09:13:09 +02:00
2017-06-26 08:26:52 +02:00
None known.
2008-08-05 09:13:09 +02:00
2017-06-26 08:26:52 +02:00
=head1 AUTHOR
Copyright (C) 2017 Hanson Wong
Based on snmp__memory_openwrt (C) 2008 J.M.Roth
=head1 LICENSE
GPLv2.
=cut
use strict;
use Munin::Plugin::SNMP;
if (defined $ARGV[0] and $ARGV[0] eq 'snmpconf') {
2017-06-27 02:17:16 +02:00
print "require 1.3.6.1.2.1.25.2.3.1.5.1\n";
print "require 1.3.6.1.2.1.25.2.3.1.6.1\n";
exit 0;
2008-08-05 09:13:09 +02:00
}
2017-06-26 08:26:52 +02:00
if (defined $ARGV[0] and $ARGV[0] eq "config") {
2017-06-27 02:17:16 +02:00
my ($host) = Munin::Plugin::SNMP->config_session();
2017-06-26 08:26:52 +02:00
2017-06-27 02:17:16 +02:00
print "host_name $host\n" unless ($host eq 'localhost');
print <<'EOC';
2017-06-26 08:26:52 +02:00
graph_title Memory usage
2008-08-05 09:13:09 +02:00
graph_args --base 1000 -l 0
graph_vlabel kB
graph_category memory
2008-08-05 09:13:09 +02:00
graph_info This graph shows total and used memory on the host.
memsize.label total
memused.label used
memsize.info The total memory.
memused.info The memory in use.
memsize.draw LINE1
memused.draw LINE2
2017-06-26 08:26:52 +02:00
EOC
2017-06-27 02:17:16 +02:00
exit 0;
2008-08-05 09:13:09 +02:00
}
2017-06-26 08:26:52 +02:00
my $session = Munin::Plugin::SNMP->session();
print "memsize.value ", $session->get_single('1.3.6.1.2.1.25.2.3.1.5.1'), "\n";
print "memused.value ", $session->get_single('1.3.6.1.2.1.25.2.3.1.6.1'), "\n";