From 859a598b6f8f368cf7a101b1a19e6a04dac267808c85e24bcfad229406ed2855 Mon Sep 17 00:00:00 2001 From: Ruediger Oertel Date: Thu, 12 Jul 2018 11:05:33 +0000 Subject: [PATCH] - do also check for churned state on lacp interfaces and warn OBS-URL: https://build.opensuse.org/package/show/server:monitoring/monitoring-plugins-bonding?expand=0&rev=9 --- check_bonding.pl | 20 ++++++++++++++++++-- monitoring-plugins-bonding.changes | 5 +++++ monitoring-plugins-bonding.spec | 4 ++-- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/check_bonding.pl b/check_bonding.pl index 603eea8..904c738 100644 --- a/check_bonding.pl +++ b/check_bonding.pl @@ -52,6 +52,8 @@ sub read_proc_bond { while (($_ = ||"") !~ /^$/) { $data->{'slaves'}->{$slave}->{'mii'} = $1 if /^MII Status: (.+)$/; $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: (.+)$/; } } } @@ -67,17 +69,31 @@ sub check_bond { return (0, "Unable to read bond information") unless $data; my $error = 0; my $config_str; + my $status = $data->{'status'}; + if (defined $data->{'slaves'}) { + foreach (keys %{$data->{'slaves'}}) { + $status = "warn" if $data->{'slaves'}->{$_}->{'actor-churn'} + && $data->{'slaves'}->{$_}->{'actor-churn'} eq "churned"; + $status = "warn" if $data->{'slaves'}->{$_}->{'partner-churn'} + && $data->{'slaves'}->{$_}->{'partner-churn'} eq "churned"; + } + } if (defined $data->{'active'}) { $config_str = sprintf "$interface_name %s on %s: members =", $data->{'status'}, $data->{'active'} ; } elsif (defined $data->{'slaves'}) { - $config_str = sprintf "$interface_name %s: members =", $data->{'status'}; + $config_str = sprintf "$interface_name %s: members =", $status; } else { $config_str = sprintf "$interface_name %s has no physical devices", $data->{'status'}; $error = 1; } foreach (keys %{$data->{'slaves'}}) { - $config_str.= " $_ (" . $data->{'slaves'}->{$_}->{'mii'} . ")"; + my $result = $data->{'slaves'}->{$_}->{'mii'}; + $result = "churned" unless $data->{'slaves'}->{$_}->{'actor-churn'} eq 'none'; + $result = "churned" unless $data->{'slaves'}->{$_}->{'partner-churn'} eq 'none'; + $config_str.= " $_ (" . $result . ")"; $error = 1 unless $data->{'slaves'}->{$_}->{'mii'} eq 'up'; + $error = 1 unless $data->{'slaves'}->{$_}->{'actor-churn'} eq 'none'; + $error = 1 unless $data->{'slaves'}->{$_}->{'partner-churn'} eq 'none'; $error = 2 if ($data->{'status'} ne 'up'); } return $error, $config_str; diff --git a/monitoring-plugins-bonding.changes b/monitoring-plugins-bonding.changes index 93c380f..a2ebad2 100644 --- a/monitoring-plugins-bonding.changes +++ b/monitoring-plugins-bonding.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Thu Jul 12 13:04:59 CEST 2018 - ro@suse.de + +- do also check for churned state on lacp interfaces and warn + ------------------------------------------------------------------- Fri Apr 21 15:00:43 CEST 2017 - ro@suse.de diff --git a/monitoring-plugins-bonding.spec b/monitoring-plugins-bonding.spec index 0205e7f..adbca11 100644 --- a/monitoring-plugins-bonding.spec +++ b/monitoring-plugins-bonding.spec @@ -1,7 +1,7 @@ # # spec file for package monitoring-plugins-bonding # -# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -20,7 +20,7 @@ Name: monitoring-plugins-bonding Version: 0.002 Release: 0 Summary: Nagios Network Bonding Check -License: GPL-2.0+ or Artistic-1.0 +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 Source0: check_bonding.pl