root / plugins / openwrt / snmp__memory_openwrt @ 17f78427
Historique | Voir | Annoter | Télécharger (2,05 ko)
| 1 |
#!/usr/bin/env perl |
|---|---|
| 2 |
# -*- perl -*- |
| 3 |
# vim: ft=perl |
| 4 |
|
| 5 |
=head1 NAME |
| 6 |
|
| 7 |
snmp__memory_openwrt - Munin plugin to monitor the memory usage of an OpenWrt |
| 8 |
device. |
| 9 |
|
| 10 |
=head1 APPLICABLE SYSTEMS |
| 11 |
|
| 12 |
OpenWrt devices which have snmpd installed. |
| 13 |
|
| 14 |
=head1 CONFIGURATION |
| 15 |
|
| 16 |
As a rule SNMP plugins need site specific configuration. The default |
| 17 |
configuration (shown here) will only work on insecure sites/devices. |
| 18 |
|
| 19 |
[snmp_*] |
| 20 |
env.version 2 |
| 21 |
env.community public |
| 22 |
|
| 23 |
In general SNMP is not very secure at all unless you use SNMP version |
| 24 |
3 which supports authentication and privacy (encryption). But in any |
| 25 |
case the community string for your devices should not be "public". |
| 26 |
|
| 27 |
Please see 'perldoc Munin::Plugin::SNMP' for further configuration |
| 28 |
information. |
| 29 |
|
| 30 |
=head1 INTERPRETATION |
| 31 |
|
| 32 |
The total and used memory on the system. |
| 33 |
|
| 34 |
=head1 MIB INFORMATION |
| 35 |
|
| 36 |
This plugin requires support for the HOST-RESOURCES-MIB (RFC 2790). It |
| 37 |
reports the contents of the hrStorageSize and hrStorageUsed OIDs. |
| 38 |
|
| 39 |
=head1 MAGIC MARKERS |
| 40 |
|
| 41 |
#%# family=snmpauto |
| 42 |
#%# capabilities=snmpconf |
| 43 |
|
| 44 |
=head1 BUGS |
| 45 |
|
| 46 |
None known. |
| 47 |
|
| 48 |
=head1 AUTHOR |
| 49 |
|
| 50 |
Copyright (C) 2017 Hanson Wong |
| 51 |
|
| 52 |
Based on snmp__memory_openwrt (C) 2008 J.M.Roth |
| 53 |
|
| 54 |
=head1 LICENSE |
| 55 |
|
| 56 |
GPLv2. |
| 57 |
|
| 58 |
=cut |
| 59 |
|
| 60 |
use strict; |
| 61 |
use Munin::Plugin::SNMP; |
| 62 |
|
| 63 |
if (defined $ARGV[0] and $ARGV[0] eq 'snmpconf') {
|
| 64 |
print "require 1.3.6.1.2.1.25.2.3.1.5.1\n"; |
| 65 |
print "require 1.3.6.1.2.1.25.2.3.1.6.1\n"; |
| 66 |
exit 0; |
| 67 |
} |
| 68 |
|
| 69 |
if (defined $ARGV[0] and $ARGV[0] eq "config") {
|
| 70 |
my ($host) = Munin::Plugin::SNMP->config_session(); |
| 71 |
|
| 72 |
print "host_name $host\n" unless ($host eq 'localhost'); |
| 73 |
print <<'EOC'; |
| 74 |
graph_title Memory usage |
| 75 |
graph_args --base 1000 -l 0 |
| 76 |
graph_vlabel kB |
| 77 |
graph_category memory |
| 78 |
graph_info This graph shows total and used memory on the host. |
| 79 |
memsize.label total |
| 80 |
memused.label used |
| 81 |
memsize.info The total memory. |
| 82 |
memused.info The memory in use. |
| 83 |
memsize.draw LINE1 |
| 84 |
memused.draw LINE2 |
| 85 |
EOC |
| 86 |
exit 0; |
| 87 |
} |
| 88 |
|
| 89 |
my $session = Munin::Plugin::SNMP->session(); |
| 90 |
print "memsize.value ", $session->get_single('1.3.6.1.2.1.25.2.3.1.5.1'), "\n";
|
| 91 |
print "memused.value ", $session->get_single('1.3.6.1.2.1.25.2.3.1.6.1'), "\n";
|
