1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-21 18:41:03 +00:00

[snmp__if_combined] Fix issue with extrainfo

It was not collected / shown in the right spot, resulting in incorrect
information being shown.

Signed-off-by: Olivier Mehani <shtrom@ssji.net>
This commit is contained in:
Olivier Mehani 2021-06-04 17:55:52 +10:00
parent 6bb4a57983
commit 57965df514

View file

@ -539,22 +539,6 @@ sub do_preprocess {
sub do_config_root {
my ($host, $version) = @_;
my $extrainfo="";
if (defined ($snmpinfoX->{0}->{ifHCInOctets})) {
# If we get an answer at the 64 bit OID then this switch
# supports the extended MIB
$extrainfo .= " This switch supports 64 bit byte counters and these are used by this plugin.";
} else {
# If not we only have a 32 bit counter and are lost.
$extrainfo .= " NOTE! This switch supports only 32 bit byte counters which makes the plugin unreliable and unsuitable for most 100Mb (or faster) interfaces, where bursts are expected to exceed 50Mbps. This means that for interfaces where much traffic is sent this plugin will report false thruputs and cannot be trusted.";
# unless perhaps the operator can get us snmp version 2c or 3?
$extrainfo .= " I notice that you use SNMP version 1 which does not support 64 bit quantities. You may get better results if you switch to SNMP version 2c or 3. Please refer to the plugin documentation."
if $version == 1;
}
print <<END;
multigraph snmp_if_combined
@ -562,7 +546,7 @@ graph_title All interfaces traffic
graph_args --base 1000
graph_vlabel bits in (-) / out (+) per \${graph_period}
graph_category network
graph_info This graph shows the total traffic for $host.$extrainfo
graph_info This graph shows the total traffic for $host.
END
print "graph_order";
@ -631,7 +615,22 @@ sub do_config_if {
my $warn = undef;
my $speed = 0;
my $extrainfo = "";
my $extrainfo="";
if (defined ($snmpinfoX->{$if}->{ifHCInOctets})) {
# If we get an answer at the 64 bit OID then this switch
# supports the extended MIB
$extrainfo .= " This switch supports 64 bit byte counters and these are used by this plugin.";
} else {
# If not we only have a 32 bit counter and are lost.
$extrainfo .= " NOTE! This switch supports only 32 bit byte counters which makes the plugin unreliable and unsuitable for most 100Mb (or faster) interfaces, where bursts are expected to exceed 50Mbps. This means that for interfaces where much traffic is sent this plugin will report false throughputs and cannot be trusted.";
# unless perhaps the operator can get us snmp version 2c or 3?
$extrainfo .= " I notice that you use SNMP version 1 which does not support 64 bit quantities. You may get better results if you switch to SNMP version 2c or 3. Please refer to the plugin documentation."
if $version == 1;
}
if (defined ($speed = $snmpinfoX->{$if}->{ifHighSpeed}) and $speed) {
# Speed in 1,000,000 bits per second
@ -644,19 +643,21 @@ sub do_config_if {
$extrainfo .= ' '.$textspeed if $textspeed;
} elsif (defined ($speed = $snmpinfo->{$if}->{ifSpeed}) and $speed) {
# Speed in bits pr. second
$warn = $speed*100/75;
$warn = $speed*100/75;
my $textspeed = scaleNumber($speed,'bps','',
'The interface speed is %.1f%s%s.');
my $textspeed = scaleNumber($speed,'bps','',
'The interface speed is %.1f%s%s.');
$extrainfo .= " ".$textspeed if $textspeed;
$extrainfo .= " ".$textspeed if $textspeed;
}
$response = $snmpinfo->{$if}->{ifType};
$extrainfo .= " This is a '".$ifTypeByNum{$response}."' interface.";
print <<END;
multigraph snmp_if_combined.$if
graph_title $alias traffic
graph_info This graph shows traffic for the \"$alias\" network interface.$extrainfo
graph_args --base 1000
graph_vlabel bits in (-) / out (+) per \${graph_period}
graph_category network
@ -682,6 +683,7 @@ END
print <<END;
multigraph snmp_if_combined_err.$if
graph_title $alias errors
graph_info This graph shows errors for the \"$alias\" network interface.$extrainfo
graph_args --base 1000
graph_vlabel errors in (-) / out (+) per \${graph_period}
graph_category network