lausser / check_nwc_health

nwc = network component. This plugin checks lots of aspects of routers, switches, wlan controllers, firewalls,.....
http://labs.consol.de/nagios/check_nwc_health
GNU General Public License v2.0
147 stars 87 forks source link

critical/warning threshold for interface-usage not being multiplied by maxInputRate/maxOutputRate #269

Open seferovic opened 3 years ago

seferovic commented 3 years ago

Hi,

first of all - @lausser thank you for this great piece of software. We are using it to monitor most of our network infrastructure... although we are using it in this manner, we stumbled upon a behavior that is (probably) not expected. The thresholds are not being calculated properly.

/usr/lib64/nagios/plugins/check_nwc_health -h | grep Rev
check_nwc_health $Revision: 8.1.0.1 $ [http://labs.consol.de/nagios/check_nwc_health]
lsb_release -a
LSB Version:    :core-4.1-amd64:core-4.1-noarch
Distributor ID: RedHatEnterprise
Description:    Red Hat Enterprise Linux release 8.3 (Ootpa)
Release:        8.3
Codename:       Ootpa

This behavior exists accross different target systems and SNMP versions (Cisco switch, Cisco Router and CheckPoint Firewall were tested over SNMPv2 and SNMPv3).

[OK] Case 1 - getting interface-usage with no thresholds - defaults are 80% and 90% for usage and as percentage of maxSpeed

/usr/lib64/nagios/plugins/check_nwc_health '--alias' 'eth10' '--authpassword' '***' '--authprotocol' '***' '--hostname' '***' '--mode' 'interface-usage' '--name' '***' '--privpassword' '***' '--privprotocol' '***' '--protocol' '***' '--username' '***'
OK - interface Broadcom Inc. and subsidiaries NetXtreme BCM5719 Gigabit Ethernet PCIe 4 (alias eth10) usage is in:0.00% (23276.34bit/s) out:0.00% (3254.24bit/s) | 'Broadcom Inc. and subsidiaries NetXtreme BCM5719 Gigabit Ethernet PCIe 4_usage_in'=0.00%;80;90;0;100 'Broadcom Inc. and subsidiaries NetXtreme BCM5719 Gigabit Ethernet PCIe 4_usage_out'=0.00%;80;90;0;100 'Broadcom Inc. and subsidiaries NetXtreme BCM5719 Gigabit Ethernet PCIe 4_traffic_in'=23276.34;800000000;900000000;0;1000000000 'Broadcom Inc. and subsidiaries NetXtreme BCM5719 Gigabit Ethernet PCIe 4_traffic_out'=3254.24;800000000;900000000;0;1000000000

As expected the thresholds are used for the usage and as a percentage of traffic_in/_out...

OK - interface Broadcom Inc. and subsidiaries NetXtreme BCM5719 Gigabit Ethernet PCIe 4 (alias eth10) usage is in:0.00% (23276.34bit/s) out:0.00% (3254.24bit/s) | 'Broadcom Inc. and subsidiaries NetXtreme BCM5719 Gigabit Ethernet PCIe 4_usage_in'=0.00%;80;90;0;100 'Broadcom Inc. and subsidiaries NetXtreme BCM5719 Gigabit Ethernet PCIe 4_usage_out'=0.00%;80;90;0;100 'Broadcom Inc. and subsidiaries NetXtreme BCM5719 Gigabit Ethernet PCIe 4_traffic_in'=23276.34;800000000;900000000;0;1000000000 'Broadcom Inc. and subsidiaries NetXtreme BCM5719 Gigabit Ethernet PCIe 4_traffic_out'=3254.24;800000000;900000000;0;1000000000

[FAILED] Case 2 - getting interface-usage with one or more thresholds set does not multiply the traffic perf data with set threshold

/usr/lib64/nagios/plugins/check_nwc_health '--alias' 'eth10' '--authpassword' '***' '--authprotocol' '***' '--hostname' '***' '--mode' 'interface-usage' '--name' '***' '--privpassword' '***' '--privprotocol' '***' '--protocol' '***' '--username' '***' --warning 50
OK - interface Broadcom Inc. and subsidiaries NetXtreme BCM5719 Gigabit Ethernet PCIe 4 (alias eth10) usage is in:0.00% (26852.92bit/s) out:0.00% (3230.77bit/s) | 'Broadcom Inc. and subsidiaries NetXtreme BCM5719 Gigabit Ethernet PCIe 4_usage_in'=0.00%;50;90;0;100 'Broadcom Inc. and subsidiaries NetXtreme BCM5719 Gigabit Ethernet PCIe 4_usage_out'=0.00%;50;90;0;100 'Broadcom Inc. and subsidiaries NetXtreme BCM5719 Gigabit Ethernet PCIe 4_traffic_in'=26852.92;50;900000000;0;1000000000 'Broadcom Inc. and subsidiaries NetXtreme BCM5719 Gigabit Ethernet PCIe 4_traffic_out'=3230.77;50;900000000;0;1000000000

OK - interface Broadcom Inc. and subsidiaries NetXtreme BCM5719 Gigabit Ethernet PCIe 4 (alias eth10) usage is in:0.00% (26852.92bit/s) out:0.00% (3230.77bit/s) | 'Broadcom Inc. and subsidiaries NetXtreme BCM5719 Gigabit Ethernet PCIe 4_usage_in'=0.00%;50;90;0;100 'Broadcom Inc. and subsidiaries NetXtreme BCM5719 Gigabit Ethernet PCIe 4_usage_out'=0.00%;50;90;0;100 'Broadcom Inc. and subsidiaries NetXtreme BCM5719 Gigabit Ethernet PCIe 4_traffic_in'=26852.92;50;900000000;0;1000000000 'Broadcom Inc. and subsidiaries NetXtreme BCM5719 Gigabit Ethernet PCIe 4_traffic_out'=3230.77;50;900000000;0;1000000000

Bold marked threshold should IMHO be transformed to 500000000 according to the check_nwc_health.pl

    my ($inwarning, $incritical) = $self->get_thresholds(
        metric => $self->{ifDescr}.'_usage_in',
    );
    $self->set_thresholds(
        metric => $self->{ifDescr}.'_traffic_in',
        warning => $self->{maxInputRate} / 100 * $inwarning,
        critical => $self->{maxInputRate} / 100 * $incritical
    );
    $self->add_perfdata(
        label => $self->{ifDescr}.'_traffic_in',
        value => $self->{inputRate},
        uom => $self->opts->units =~ /^(B|KB|MB|GB|TB)$/ ? $self->opts->units : undef,
        places => 2,
        min => 0,
        max => $self->{maxInputRate},
    );
    my ($outwarning, $outcritical) = $self->get_thresholds(
        metric => $self->{ifDescr}.'_usage_out',
    );
    $self->set_thresholds(
        metric => $self->{ifDescr}.'_traffic_out',
        warning => $self->{maxOutputRate} / 100 * $outwarning,
        critical => $self->{maxOutputRate} / 100 * $outcritical,
    );
    $self->add_perfdata(
        label => $self->{ifDescr}.'_traffic_out',
        value => $self->{outputRate},
        uom => $self->opts->units =~ /^(B|KB|MB|GB|TB)$/ ? $self->opts->units : undef,
        places => 2,
        min => 0,
        max => $self->{maxOutputRate},
    );

Any thoughs on this? Did we misunterstood the threshold parameters?

Thank you in advance!