mirror of
https://github.com/munin-monitoring/contrib.git
synced 2018-11-08 00:59:34 +01:00
91 lines
2 KiB
Perl
Executable file
91 lines
2 KiB
Perl
Executable file
#!/usr/bin/env perl
|
|
# -*- perl -*-
|
|
# vim: ft=perl
|
|
|
|
=head1 NAME
|
|
|
|
snmp__memory_openwrt - Munin plugin to monitor the memory usage of an OpenWrt
|
|
device.
|
|
|
|
=head1 APPLICABLE SYSTEMS
|
|
|
|
OpenWrt devices which have snmpd installed.
|
|
|
|
=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 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
|
|
|
|
None known.
|
|
|
|
=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') {
|
|
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;
|
|
}
|
|
|
|
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 <<'EOC';
|
|
graph_title Memory usage
|
|
graph_args --base 1000 -l 0
|
|
graph_vlabel kB
|
|
graph_category memory
|
|
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
|
|
EOC
|
|
exit 0;
|
|
}
|
|
|
|
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";
|