From 57c5ffc085e1072f2f2eb93e5295b2fcddf0ccd949aaea7a7d5c8eee4d451bc5 Mon Sep 17 00:00:00 2001 From: Ruediger Oertel Date: Mon, 21 Dec 2020 16:59:33 +0000 Subject: [PATCH] - also check the speed - in active/failover warn if active interface does not have the maximum speed - in multi-active (rr,lacp) warn unless all interfaces run in maximum speed OBS-URL: https://build.opensuse.org/package/show/server:monitoring/monitoring-plugins-bonding?expand=0&rev=15 --- check_bonding.pl | 16 +++++++++++++++- monitoring-plugins-bonding.changes | 9 +++++++++ monitoring-plugins-bonding.spec | 4 ++-- 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/check_bonding.pl b/check_bonding.pl index 613f098..6fbfd80 100644 --- a/check_bonding.pl +++ b/check_bonding.pl @@ -54,6 +54,7 @@ sub read_proc_bond { $data->{'slaves'}->{$slave}->{'failure-count'} = $1 if /^Link Failure Count: (.+)$/; $data->{'slaves'}->{$slave}->{'actor-churn'} = $1 if /^Actor Churn State: (.+)$/; $data->{'slaves'}->{$slave}->{'partner-churn'} = $1 if /^Partner Churn State: (.+)$/; + $data->{'slaves'}->{$slave}->{'speed'} = $1 if /^Speed: (.+) Mbps$/; } } } @@ -71,6 +72,18 @@ sub check_bond { my $config_str; my $status = $data->{'status'}; if (defined $data->{'slaves'}) { + my $max_speed = 0; + foreach (keys %{$data->{'slaves'}}) { + $max_speed = $data->{'slaves'}->{$_}->{'speed'} if $data->{'slaves'}->{$_}->{'speed'} && $data->{'slaves'}->{$_}->{'speed'} > $max_speed; + } + if (defined $data->{'active'}) { + my $active_int = $data->{'active'}; + $error = 1 if $data->{'slaves'}->{$active_int}->{'speed'} && $data->{'slaves'}->{$active_int}->{'speed'} ne $max_speed; + } else { + foreach (keys %{$data->{'slaves'}}) { + $error = 1 if $data->{'slaves'}->{$_}->{'speed'} && $data->{'slaves'}->{$_}->{'speed'} ne $max_speed; + } + } foreach (keys %{$data->{'slaves'}}) { $status = "warn" if $data->{'slaves'}->{$_}->{'actor-churn'} && $data->{'slaves'}->{$_}->{'actor-churn'} eq "churned"; @@ -86,8 +99,9 @@ sub check_bond { $config_str = sprintf "$interface_name %s has no physical devices", $data->{'status'}; $error = 1; } - foreach (keys %{$data->{'slaves'}}) { + foreach (sort(keys %{$data->{'slaves'}})) { my $result = $data->{'slaves'}->{$_}->{'mii'}; + $result .= ", ".$data->{'slaves'}->{$_}->{'speed'}."Mbps" if $data->{'slaves'}->{$_}->{'speed'}; $result = "churned" if $data->{'slaves'}->{$_}->{'actor-churn'} && $data->{'slaves'}->{$_}->{'actor-churn'} ne 'none'; $result = "churned" if $data->{'slaves'}->{$_}->{'partner-churn'} diff --git a/monitoring-plugins-bonding.changes b/monitoring-plugins-bonding.changes index 975e042..17471ce 100644 --- a/monitoring-plugins-bonding.changes +++ b/monitoring-plugins-bonding.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Mon Dec 21 17:57:46 CET 2020 - ro@suse.de + +- also check the speed + - in active/failover warn if active interface does not + have the maximum speed + - in multi-active (rr,lacp) warn unless all interfaces + run in maximum speed + ------------------------------------------------------------------- Wed Oct 3 14:00:38 UTC 2018 - lars@linux-schulserver.de diff --git a/monitoring-plugins-bonding.spec b/monitoring-plugins-bonding.spec index b2230c8..d7b54a8 100644 --- a/monitoring-plugins-bonding.spec +++ b/monitoring-plugins-bonding.spec @@ -1,7 +1,7 @@ # # spec file for package monitoring-plugins-bonding # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -22,7 +22,7 @@ Release: 0 Summary: Nagios Network Bonding Check License: GPL-2.0-or-later OR Artistic-1.0 Group: System/Monitoring -Url: http://www.monitoringexchange.org/inventory/Check-Plugins/Operating-Systems/Linux/Network-Bonding +URL: http://www.monitoringexchange.org/inventory/Check-Plugins/Operating-Systems/Linux/Network-Bonding Source0: check_bonding.pl Source1: usr.lib.nagios.plugins.check_bonding Source2: nrpe-check_bonding