Hello community, here is the log from the commit of package nagios-plugins-bonding for openSUSE:Factory checked in at 2013-01-20 08:05:24 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/nagios-plugins-bonding (Old) and /work/SRC/openSUSE:Factory/.nagios-plugins-bonding.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "nagios-plugins-bonding", Maintainer is "" Changes: -------- New Changes file: --- /dev/null 2013-01-09 19:40:42.352580873 +0100 +++ /work/SRC/openSUSE:Factory/.nagios-plugins-bonding.new/nagios-plugins-bonding.changes 2013-01-20 08:05:24.000000000 +0100 @@ -0,0 +1,18 @@ +------------------------------------------------------------------- +Wed Jul 4 21:29:19 UTC 2012 - l...@linux-schulserver.de + +- specfile cleanup +- added apparmor profile +- recommend apparmor-profiles +- fix license (GPL or Artistic) + +------------------------------------------------------------------- +Sun May 6 01:24:55 UTC 2012 - l...@linux-schulserver.de + +- use nagios-rpm-macros + +------------------------------------------------------------------- +Fri Mar 12 15:22:59 UTC 2010 - l...@linux-schulserver.de + +- initial version 0.002 + New: ---- check_bonding.pl nagios-plugins-bonding.changes nagios-plugins-bonding.spec usr.lib.nagios.plugins.check_bonding ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ nagios-plugins-bonding.spec ++++++ # # spec file for package nagios-plugins-bonding # # Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed # upon. The license for this file, and modifications and additions to the # file, is the same license as for the pristine package itself (unless the # license for the pristine package is not an Open Source License, in which # case the license is the MIT License). An "Open Source License" is a # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. # Please submit bugfixes or comments via http://bugs.opensuse.org/ # Name: nagios-plugins-bonding Version: 0.002 Release: 1 License: GPL-2.0+ or Artistic-1.0 Summary: Nagios Network Bonding Check Url: http://www.monitoringexchange.org/inventory/Check-Plugins/Operating-Systems/Linux/Network-Bonding Group: System/Monitoring Source0: check_bonding.pl Source1: usr.lib.nagios.plugins.check_bonding BuildRequires: nagios-rpm-macros Recommends: apparmor-profiles # nagios can execute the script with embedded perl Recommends: perl BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildArch: noarch %description This script attempts to read the proc interface to the Linux kernel bonding driver, and determine if the bonded interfaces are optimal. It will warn if any of the enslaved devices are not 'up' (exit 1), and if any bonded interfaces are not active at all (exit 2). This script is suitable for feeding to NRPE for Nagios (or similar) to check. %prep %build %install install -D -m755 %{SOURCE0} %{buildroot}%{nagios_plugindir}/check_bonding install -D -m644 %{SOURCE1} %{buildroot}%{_sysconfdir}/apparmor.d/usr.lib.nagios.plugins.check_bonding %clean rm -rf %{buildroot} %files %defattr(-,root,root) # avoid build dependecy of nagios - own the dirs %dir %{nagios_libdir} %dir %{nagios_plugindir} %{nagios_plugindir}/check_bonding %dir %{_sysconfdir}/apparmor.d %config(noreplace) %{_sysconfdir}/apparmor.d/usr.lib.nagios.plugins.check_bonding %changelog ++++++ check_bonding.pl ++++++ #!/usr/bin/perl use warnings; use strict; use Getopt::Long; my $VERSION = '0.002'; my $options = { 'procnet' => '/proc/net', }; sub version { print "$VERSION\n"; } sub help { my $name = $1 if $0 =~ /\/([^\/]+)$/; print <<FOO; $name [ --procnet <dir> ] [ --hel p ] [ --version ] --procnet <dir> - Direcotry where proc/net lives, normally /proc/net --help - help (this screen) --version - get version information This script attempts to read the proc interface to the Linux kernel bonding driver, and determine if the bonded interfaces are optimal. It will wanr if any of the enslaved devices are not 'up' (exit 1), and if any bonded interfaces are not active at all (exit 2). This script is suitable for feeding to NRPE for Nagios (or similar) to check. This script is distributed under the Artistic and Gnu Public Licences. Version: $VERSION. (c) 2004 Fotango Limited. http://opensource.fotango.com/. Written by James Bromberger <jbromberger_AT_fotango.com> FOO } sub read_proc_bond { my $file = shift; return unless -r $file; open F, $file or die "Cannot read $file"; my $data; while (<F>) { $data->{'version'} = $1 if /^Ethernet Channel Bonding Driver: (.+)$/; $data->{'mode'} = $1 if /^Bonding Mode: (.+)$/; $data->{'primary'} = $1 if /^Primary Slave: (.+)$/; $data->{'active'} = $1 if /^Currently Active Slave: (.+)$/; $data->{'status'} = $1 if /^MII Status: (\S+)$/; $data->{'polling'} = $1 if /^MII Polling Interval \(ms\): (\S+)$/; $data->{'up-delay'} = $1 if /^Up Delay \(ms\): (\S+)$/; $data->{'down-delay'} = $1 if /^Down Delay \(ms\): (\S+)$/; if (/^Slave Interface: (.+)$/) { my $slave = $1; while (($_ = <F>||"") !~ /^$/) { $data->{'slaves'}->{$slave}->{'mii'} = $1 if /^MII Status: (.+)$/; $data->{'slaves'}->{$slave}->{'failure-count'} = $1 if /^Link Failure Count: (.+)$/; } } } close F; return $data; } sub check_bond { my $file = shift; my $interface_name = shift; my $data = read_proc_bond($file); return (0, "Unable to read bond information") unless $data; my $error = 0; my $config_str; 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'}; } else { $config_str = sprintf "$interface_name %s has no physical devices", $data->{'status'}; $error = 1; } foreach (keys %{$data->{'slaves'}}) { $config_str.= " $_ (" . $data->{'slaves'}->{$_}->{'mii'} . ")"; $error = 1 unless $data->{'slaves'}->{$_}->{'mii'} eq 'up'; $error = 2 if ($data->{'status'} ne 'up'); } return $error, $config_str; } sub find_bonds { my $dir = shift; return unless -r $dir; # $dir = '/proc/net'; my $bonds; if (-r "$dir/bonding") { opendir D, "$dir/bonding" or die "Cannot open dir: $dir/bonding"; map {$bonds->{$_} = "$dir/bonding/$_"} grep /^bond/, readdir D; closedir D; } opendir D, "$dir" or die "Cannot open dir: $dir"; map {$bonds->{$_} = "$dir/$_/info" if -r "$dir/$_/info"} grep /^bond/, readdir D; closedir D; my $err = 0; my $message; foreach (keys %{$bonds}) { my ($this_error, $this_message) = check_bond($bonds->{$_}, $_); $err = $this_error if $this_error; $message.= $this_message . " "; } if (not $message) { $message = "No bond information found"; $err = 1; } print "$message\n"; exit $err; } GetOptions($options, "procnet=s", "help", "version"); if(defined $options->{'help'}) { help(); exit; } elsif (defined $options->{'version'}) { version(); exit; } find_bonds($options->{'procnet'}); ++++++ usr.lib.nagios.plugins.check_bonding ++++++ #include <tunables/global> /usr/lib/nagios/plugins/check_bonding { #include <abstractions/base> #include <abstractions/perl> /proc/*/net/ r, /proc/*/net/bonding/ r, /proc/*/net/bonding/* r, /usr/bin/perl ix, } -- To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org For additional commands, e-mail: opensuse-commit+h...@opensuse.org