1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-22 02:51:03 +00:00

Added suggestion made by @sumpfralle

This commit is contained in:
Alejandro Suarez 2019-11-29 12:59:05 +01:00 committed by Lars Kruse
parent c04775f88b
commit 1acb0665e8
2 changed files with 15 additions and 15 deletions

View file

@ -2,7 +2,7 @@
# #
# Copyright (C) 2019 Alejandro Suarez (teconecta.es) # Copyright (C) 2019 Alejandro Suarez (teconecta.es)
# #
# Munin plugin to monitor Mikrotik routers RAM utilization. # Munin plugin to monitor Mikrotik routers Falsh disk utilization.
# Based on snmp__if_ plugin. # Based on snmp__if_ plugin.
# #
# This program is free software; you can redistribute it and/or # This program is free software; you can redistribute it and/or
@ -55,8 +55,8 @@ elsif (!defined($host))
die "# Error: couldn't understand what I'm supposed to monitor."; die "# Error: couldn't understand what I'm supposed to monitor.";
} }
my $sysRAMUsage = "1.3.6.1.2.1.25.2.3.1.6.131072"; my $sysFalshUsage = "1.3.6.1.2.1.25.2.3.1.6.131072";
my $sysRAMTotal = "1.3.6.1.2.1.25.2.3.1.5.131072"; my $sysFalshTotal = "1.3.6.1.2.1.25.2.3.1.5.131072";
my ($session, $error) = Net::SNMP->session( my ($session, $error) = Net::SNMP->session(
-hostname => $host, -hostname => $host,
@ -74,33 +74,33 @@ if (!defined ($session))
if ($ARGV[0] and $ARGV[0] eq "config") if ($ARGV[0] and $ARGV[0] eq "config")
{ {
print "host_name $host\n"; print "host_name $host\n";
if (!defined ($response = $session->get_request($sysRAMTotal))) if (!defined ($response = $session->get_request($sysFalshTotal)))
{ {
die "Croaking: " . $session->error(); die "Croaking: " . $session->error();
} }
# print "graph_args --base 1000 -r --lower-limit 0 --upper-limit 100\n"; print "graph_args --base 1024 -l 0 --vertical-label Bytes --upper-limit " . ($response->{$sysFalshTotal} * 1024) . "\n";
print "graph_args --base 1024 -l 0 --vertical-label Bytes --upper-limit " . ($response->{$sysRAMTotal} * 1024) . "\n";
print "graph_title Flash disk usage\n"; print "graph_title Flash disk usage\n";
print "graph_category system\n"; print "graph_category system\n";
print "graph_info This graph shows the router's flash disk usage.\n"; print "graph_info This graph shows the router's flash disk usage.\n";
print "graph_order Total Used\n"; print "graph_order Total Used\n";
print "graph_vlabel bytes\n"; print "graph_vlabel bytes\n";
print "sysRAMTotal.label Total Memory\n"; print "sysFalshTotal.label Total Memory\n";
print "sysRAMTotal.draw AREA\n"; print "sysFalshTotal.draw AREA\n";
print "sysRAMUsage.label Used Memory\n"; print "sysFalshUsage.label Used Memory\n";
print "sysRAMUsage.draw AREA\n"; print "sysFalshUsage.draw AREA\n";
exit 0; exit 0;
} }
if (defined ($response = $session->get_request(-varbindlist => [$sysRAMUsage, $sysRAMTotal]))) if (defined ($response = $session->get_request(-varbindlist => [$sysFalshUsage, $sysFalshTotal])))
{ {
print "sysRAMUsage.value ", $response->{$sysRAMUsage}*1024, "\n"; print "sysFalshUsage.value ", $response->{$sysFalshUsage}*1024, "\n";
print "sysRAMTotal.value ", $response->{$sysRAMTotal}*1024, "\n"; print "sysFalshTotal.value ", $response->{$sysFalshTotal}*1024, "\n";
} }
else else
{ {
print "sysRAMUsage.value U\n"; print "sysFalshUsage.value U\n";
print "sysFalshTotal.value U\n";
} }
# vim:syntax=perl # vim:syntax=perl

View file

@ -78,7 +78,6 @@ if ($ARGV[0] and $ARGV[0] eq "config")
{ {
die "Croaking: " . $session->error(); die "Croaking: " . $session->error();
} }
# print "graph_args --base 1000 -r --lower-limit 0 --upper-limit 100\n";
print "graph_args --base 1024 -l 0 --vertical-label Bytes --upper-limit " . ($response->{$sysRAMTotal} * 1024) . "\n"; print "graph_args --base 1024 -l 0 --vertical-label Bytes --upper-limit " . ($response->{$sysRAMTotal} * 1024) . "\n";
print "graph_title RAM usage\n"; print "graph_title RAM usage\n";
print "graph_category system\n"; print "graph_category system\n";
@ -101,6 +100,7 @@ if (defined ($response = $session->get_request(-varbindlist => [$sysRAMUsage, $s
else else
{ {
print "sysRAMUsage.value U\n"; print "sysRAMUsage.value U\n";
print "sysRAMTotal.value U\n";
} }
# vim:syntax=perl # vim:syntax=perl