mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-21 18:41:03 +00:00
commit
3ac71f4c23
2 changed files with 79 additions and 24 deletions
|
@ -88,8 +88,8 @@ if ($ARGV[0] and $ARGV[0] eq "config") {
|
||||||
if (defined $response) {
|
if (defined $response) {
|
||||||
print "multigraph flash\n";
|
print "multigraph flash\n";
|
||||||
print "graph_args --base 1024 -l 0 --vertical-label Bytes --upper-limit " . ($response->{$sysFlashTotalOID} * 1024) . "\n";
|
print "graph_args --base 1024 -l 0 --vertical-label Bytes --upper-limit " . ($response->{$sysFlashTotalOID} * 1024) . "\n";
|
||||||
print "graph_title Flash disk usage\n";
|
print "graph_title Disk usage\n";
|
||||||
print "graph_category system\n";
|
print "graph_category disk\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";
|
||||||
|
@ -103,7 +103,7 @@ if ($ARGV[0] and $ARGV[0] eq "config") {
|
||||||
if (defined $response) {
|
if (defined $response) {
|
||||||
print "multigraph ram\n";
|
print "multigraph ram\n";
|
||||||
print "graph_args --base 1024 -l 0 --vertical-label Bytes --upper-limit " . ($response->{$sysRAMTotalOID} * 1024) . "\n";
|
print "graph_args --base 1024 -l 0 --vertical-label Bytes --upper-limit " . ($response->{$sysRAMTotalOID} * 1024) . "\n";
|
||||||
print "graph_title RAM usage\n";
|
print "graph_title Memory usage\n";
|
||||||
print "graph_category system\n";
|
print "graph_category system\n";
|
||||||
print "graph_info This graph shows the router's memory usage.\n";
|
print "graph_info This graph shows the router's memory usage.\n";
|
||||||
print "graph_order Total Used\n";
|
print "graph_order Total Used\n";
|
||||||
|
|
|
@ -33,7 +33,7 @@ reality. The stored values would need to be adjusted.
|
||||||
bytes to bits. Conversely, they do now need a CDEF to convert bits to bytes.
|
bytes to bits. Conversely, they do now need a CDEF to convert bits to bytes.
|
||||||
|
|
||||||
To reflect this aspect explicitely, the root graph's totals are named
|
To reflect this aspect explicitely, the root graph's totals are named
|
||||||
recv_bits and send_bits.
|
`recv_bits` and `send_bits`.
|
||||||
|
|
||||||
=head1 CONFIGURATION
|
=head1 CONFIGURATION
|
||||||
|
|
||||||
|
@ -45,6 +45,7 @@ configuration (shown here) will only work on insecure sites/devices:
|
||||||
env.community public
|
env.community public
|
||||||
env.ifTypeOnly ethernetCsmacd
|
env.ifTypeOnly ethernetCsmacd
|
||||||
env.stackedRoot 1
|
env.stackedRoot 1
|
||||||
|
env.stackedMax 0
|
||||||
|
|
||||||
In general SNMP is not very secure at all unless you use SNMP version
|
In general SNMP is not very secure at all unless you use SNMP version
|
||||||
3 which supports authentication and privacy (encryption). But in any
|
3 which supports authentication and privacy (encryption). But in any
|
||||||
|
@ -74,6 +75,28 @@ would normally be for VPNs. A minor horde of different interface types
|
||||||
are supposted, please see IANAifType-MIB (on your system or find with
|
are supposted, please see IANAifType-MIB (on your system or find with
|
||||||
Google) for a full list.
|
Google) for a full list.
|
||||||
|
|
||||||
|
=head2 MULTIPLE INSTANCES
|
||||||
|
|
||||||
|
It is possible to run multiple instances of the plugin for the same host. This
|
||||||
|
is most useful to generate separate views for groups of ifTypes (e.g.,
|
||||||
|
ethernetCsmacd, ieee82011, l2vlan, ...).
|
||||||
|
|
||||||
|
New instances should be symlinked to the script with an underscore-separated
|
||||||
|
suffix. A matching configuration file should be present to specify the required
|
||||||
|
ifTypes (or any other relevant parameters).
|
||||||
|
|
||||||
|
$ readlink /etc/munin/plugins/snmp_192.2.0.1_if_combined_vlan
|
||||||
|
/path/to/munin-contrib/plugins/snmp/snmp__if_combined
|
||||||
|
|
||||||
|
$ sudo cat /etc/munin/plugin-conf.d/snmp_192.2.0.1_if_combined_vlan
|
||||||
|
env.ifTypeOnly l2vlan
|
||||||
|
|
||||||
|
The suffix will be appended to the graph base name, e.g.,
|
||||||
|
`snmp_<HOST>_if_combined_<SUFFIX>` will generate the `snmp_if_combined_<SUFFIX>`
|
||||||
|
multigraph and associated series for the selected `<HOST>`.
|
||||||
|
|
||||||
|
=head2 STACKED ROOT GRAPH
|
||||||
|
|
||||||
The `stackedRoot` option determines whether the root summary graph shows the
|
The `stackedRoot` option determines whether the root summary graph shows the
|
||||||
traffic on each interface separately, or stacks them on top of one another to
|
traffic on each interface separately, or stacks them on top of one another to
|
||||||
show the total traffic through the device.
|
show the total traffic through the device.
|
||||||
|
@ -139,12 +162,18 @@ issue (compounded by the first) is that of wraparound. When one of the counters
|
||||||
wraps around, the sum jumps backwards. With a `min` set to 0, and other counters
|
wraps around, the sum jumps backwards. With a `min` set to 0, and other counters
|
||||||
having kept increasing, this looks like a huge increase the total counter.
|
having kept increasing, this looks like a huge increase the total counter.
|
||||||
Depending on the `max` (which should match the backplane bandwidth), this may
|
Depending on the `max` (which should match the backplane bandwidth), this may
|
||||||
not be correctly recognised as a spurious value, just reconded as valid.
|
not be correctly recognised as a spurious value, just recorded as valid.
|
||||||
|
|
||||||
There is no clear solution to this bug at the moment, save for trying to salvage
|
As a workaround, the `stackedMax` option is available. It will be set as the max
|
||||||
the data after the fact. This can be done my either clipping all values beyond a
|
values for the `send_bits` and `recv_bits` sum series, allowing to prevent
|
||||||
maximum (e.g., the known use of the switch, rather that its full backplane
|
overshoot. It should be set to around the expected maximum given the monitored
|
||||||
bandwith).
|
network, rather than the sum of the theoretical maxes of the interfaces. This is
|
||||||
|
a blunt tool that is not going to be very precise, but it should get rid of the
|
||||||
|
largest outliers, keeping the graphs useful.
|
||||||
|
|
||||||
|
Barring that, it should be possible to salvage the data after the fact. This can
|
||||||
|
be done my either clipping all values beyond a maximum (e.g., the known use of
|
||||||
|
the switch, rather that its full backplane bandwith).
|
||||||
|
|
||||||
RANGE='[0-9.]\+e+\(0[789]\|[1-9][0-9]\)' # Anything >=1e07
|
RANGE='[0-9.]\+e+\(0[789]\|[1-9][0-9]\)' # Anything >=1e07
|
||||||
rrdtool dump ${RRD_FILE} \
|
rrdtool dump ${RRD_FILE} \
|
||||||
|
@ -211,6 +240,14 @@ use strict;
|
||||||
use Munin::Plugin;
|
use Munin::Plugin;
|
||||||
use Munin::Plugin::SNMP;
|
use Munin::Plugin::SNMP;
|
||||||
|
|
||||||
|
my $scriptname='snmp_if_combined';
|
||||||
|
my @scriptname_components= split(/_/,$0);
|
||||||
|
my $instance = 'All interfaces';
|
||||||
|
if ($scriptname_components[-1] ne 'combined') {
|
||||||
|
$instance = $scriptname_components[-1];
|
||||||
|
$scriptname .= "_${instance}";
|
||||||
|
}
|
||||||
|
|
||||||
my $response;
|
my $response;
|
||||||
my $iface;
|
my $iface;
|
||||||
|
|
||||||
|
@ -246,6 +283,10 @@ my $stackedRoot = 0;
|
||||||
if (exists $ENV{'stackedRoot'}) {
|
if (exists $ENV{'stackedRoot'}) {
|
||||||
$stackedRoot = $ENV{'stackedRoot'};
|
$stackedRoot = $ENV{'stackedRoot'};
|
||||||
}
|
}
|
||||||
|
my $stackedMax = 0;
|
||||||
|
if (exists $ENV{'stackedMax'}) {
|
||||||
|
$stackedMax = $ENV{'stackedMax'};
|
||||||
|
}
|
||||||
|
|
||||||
my $sysDescr = '1.3.6.1.2.1.1.1.0';
|
my $sysDescr = '1.3.6.1.2.1.1.1.0';
|
||||||
my $sysLocation = '1.3.6.1.2.1.1.6.0';
|
my $sysLocation = '1.3.6.1.2.1.1.6.0';
|
||||||
|
@ -611,8 +652,8 @@ sub do_config_root {
|
||||||
|
|
||||||
print <<END;
|
print <<END;
|
||||||
|
|
||||||
multigraph snmp_if_combined
|
multigraph $scriptname
|
||||||
graph_title All interfaces traffic
|
graph_title $instance traffic
|
||||||
graph_args --base 1000
|
graph_args --base 1000
|
||||||
graph_vlabel bits in (-) / out (+) per \${graph_period}
|
graph_vlabel bits in (-) / out (+) per \${graph_period}
|
||||||
graph_category network
|
graph_category network
|
||||||
|
@ -622,8 +663,8 @@ END
|
||||||
print "graph_order";
|
print "graph_order";
|
||||||
my @ifs;
|
my @ifs;
|
||||||
foreach my $if (sort {$a <=> $b} keys %{$snmpinfo}) {
|
foreach my $if (sort {$a <=> $b} keys %{$snmpinfo}) {
|
||||||
print " recv$if=snmp_if_combined.$if.recv send$if=snmp_if_combined.$if.send";
|
print " recv$if=$scriptname.$if.recv send$if=$scriptname.$if.send";
|
||||||
push @ifs, "snmp_if_combined.$if";
|
push @ifs, "$scriptname.$if";
|
||||||
}
|
}
|
||||||
if ($stackedRoot) {
|
if ($stackedRoot) {
|
||||||
print " recv_bits send_bits";
|
print " recv_bits send_bits";
|
||||||
|
@ -676,11 +717,17 @@ send_bits.draw LINE1
|
||||||
send_bits.colour 000000
|
send_bits.colour 000000
|
||||||
send_bits.negative recv_bits
|
send_bits.negative recv_bits
|
||||||
END
|
END
|
||||||
|
if ($stackedMax > 0) {
|
||||||
|
print <<END;
|
||||||
|
recv_bits.max $stackedMax
|
||||||
|
send_bits.max $stackedMax
|
||||||
|
END
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print <<END;
|
print <<END;
|
||||||
multigraph snmp_if_combined_err
|
multigraph ${scriptname}_err
|
||||||
graph_title All interfaces errors
|
graph_title $instance errors
|
||||||
graph_args --base 1000
|
graph_args --base 1000
|
||||||
graph_vlabel errors in (-) / out (+) per \${graph_period}
|
graph_vlabel errors in (-) / out (+) per \${graph_period}
|
||||||
graph_category network
|
graph_category network
|
||||||
|
@ -688,7 +735,7 @@ END
|
||||||
|
|
||||||
print "graph_order";
|
print "graph_order";
|
||||||
foreach my $if (sort {$a <=> $b} keys %{$snmpinfo}) {
|
foreach my $if (sort {$a <=> $b} keys %{$snmpinfo}) {
|
||||||
print " recv$if=snmp_if_combined_err.$if.total_in send$if=snmp_if_combined_err.$if.total_out";
|
print " recv$if=${scriptname}_err.$if.total_in send$if=${scriptname}_err.$if.total_out";
|
||||||
}
|
}
|
||||||
print "\n";
|
print "\n";
|
||||||
|
|
||||||
|
@ -761,7 +808,7 @@ sub do_config_if {
|
||||||
$extrainfo .= " This is a '".$ifTypeByNum{$response}."' interface.";
|
$extrainfo .= " This is a '".$ifTypeByNum{$response}."' interface.";
|
||||||
|
|
||||||
print <<END;
|
print <<END;
|
||||||
multigraph snmp_if_combined.$if
|
multigraph $scriptname.$if
|
||||||
graph_title $alias traffic
|
graph_title $alias traffic
|
||||||
graph_info This graph shows traffic for the \"$alias\" network interface.$extrainfo
|
graph_info This graph shows traffic for the \"$alias\" network interface.$extrainfo
|
||||||
graph_args --base 1000
|
graph_args --base 1000
|
||||||
|
@ -778,7 +825,7 @@ send.negative recv
|
||||||
send.min 0
|
send.min 0
|
||||||
END
|
END
|
||||||
|
|
||||||
if ( defined($speed) ) {
|
if ( defined($speed) && $speed > 0) {
|
||||||
printf("recv.max %s\nsend.max %s\n", $speed, $speed);
|
printf("recv.max %s\nsend.max %s\n", $speed, $speed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -787,7 +834,7 @@ END
|
||||||
}
|
}
|
||||||
|
|
||||||
print <<END;
|
print <<END;
|
||||||
multigraph snmp_if_combined_err.$if
|
multigraph ${scriptname}_err.$if
|
||||||
graph_title $alias errors
|
graph_title $alias errors
|
||||||
graph_info This graph shows errors for the \"$alias\" network interface.$extrainfo
|
graph_info This graph shows errors for the \"$alias\" network interface.$extrainfo
|
||||||
graph_args --base 1000
|
graph_args --base 1000
|
||||||
|
@ -836,11 +883,11 @@ sub do_fetch_if {
|
||||||
if ($status != 1) {
|
if ($status != 1) {
|
||||||
# Interface is down
|
# Interface is down
|
||||||
print <<END;
|
print <<END;
|
||||||
multigraph snmp_if_combined.$if
|
multigraph $scriptname.$if
|
||||||
recv.value U
|
recv.value U
|
||||||
send.value U
|
send.value U
|
||||||
send.extinfo This interface is currently down.
|
send.extinfo This interface is currently down.
|
||||||
multigraph snmp_if_combined_err.$if
|
multigraph ${scriptname}_err.$if
|
||||||
errors_in.value U
|
errors_in.value U
|
||||||
errors_out.value U
|
errors_out.value U
|
||||||
discards_in.value U
|
discards_in.value U
|
||||||
|
@ -856,7 +903,7 @@ END
|
||||||
my $recv;
|
my $recv;
|
||||||
my $send;
|
my $send;
|
||||||
|
|
||||||
print "multigraph snmp_if_combined.$if\n";
|
print "multigraph $scriptname.$if\n";
|
||||||
|
|
||||||
$response = $snmpinfoX->{$if}->{ifHCInOctets} || $snmpinfo->{$if}->{ifInOctets};
|
$response = $snmpinfoX->{$if}->{ifHCInOctets} || $snmpinfo->{$if}->{ifInOctets};
|
||||||
$recv = defined($response) ? ($response * 8) : undef;
|
$recv = defined($response) ? ($response * 8) : undef;
|
||||||
|
@ -866,7 +913,7 @@ END
|
||||||
$send = defined($response) ? ($response * 8) : undef;
|
$send = defined($response) ? ($response * 8) : undef;
|
||||||
printf("send.value %s\n", $send || "U");
|
printf("send.value %s\n", $send || "U");
|
||||||
|
|
||||||
print "multigraph snmp_if_combined_err.$if\n";
|
print "multigraph ${scriptname}_err.$if\n";
|
||||||
|
|
||||||
my $errors = $snmpinfo->{$if}->{ifInErrors};
|
my $errors = $snmpinfo->{$if}->{ifInErrors};
|
||||||
my $discards = $snmpinfo->{$if}->{ifInDiscards};
|
my $discards = $snmpinfo->{$if}->{ifInDiscards};
|
||||||
|
@ -924,8 +971,16 @@ foreach my $if (sort {$a <=> $b} keys %{$snmpinfo}) {
|
||||||
$recv += ($recv_if || 0);
|
$recv += ($recv_if || 0);
|
||||||
$send += ($send_if || 0);
|
$send += ($send_if || 0);
|
||||||
}
|
}
|
||||||
|
if ($stackedMax > 0) {
|
||||||
|
if ($recv > $stackedMax) {
|
||||||
|
$recv = 'U';
|
||||||
|
}
|
||||||
|
if ($send > $stackedMax) {
|
||||||
|
$send = 'U';
|
||||||
|
}
|
||||||
|
}
|
||||||
if ($stackedRoot) {
|
if ($stackedRoot) {
|
||||||
print "multigraph snmp_if_combined\n";
|
print "multigraph $scriptname\n";
|
||||||
print "recv_bits.value $recv\n";
|
print "recv_bits.value $recv\n";
|
||||||
print "send_bits.value $send\n";
|
print "send_bits.value $send\n";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue