From aaa9b2d55aaf3826519ec7aac16375f356328e5f Mon Sep 17 00:00:00 2001 From: Tomas Edwardsson Date: Sun, 16 Oct 2011 17:35:58 +0000 Subject: [PATCH] Changed buildarch and allowed for both 32 and 64bit execution --- check_disks.pl/trunk/check_disks.pl | 16 +++++++++++++--- .../trunk/nagios-okplugin-check_disks.spec | 8 ++++++-- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/check_disks.pl/trunk/check_disks.pl b/check_disks.pl/trunk/check_disks.pl index 8bd142f..f6e3753 100755 --- a/check_disks.pl/trunk/check_disks.pl +++ b/check_disks.pl/trunk/check_disks.pl @@ -131,6 +131,8 @@ use strict; my ($opt_c, $opt_w, $opt_h, $opt_i,$opt_f,$opt_s,$opt_u,$opt_H,$opt_C,$opt_v, $opt_html, $opt_srvperf, $opt_r, $opt_R); +$ENV{'PATH'} = "/usr/lib/nagios/plugins:/usr/lib64/nagios/plugins:/usr/local/libexec:/usr/libexec:/usr/local/nagios/libexec"; + $opt_u = "nagios"; # Utilisateur pour connexion nrpe $opt_i = ""; $opt_w = "10"; # Valeur par defaut de warning @@ -198,16 +200,24 @@ my $args; #Si on est en local inutile de faire du nrpe if($opt_H ne "localhost" and $opt_H ne "127.0.0.1") { #$cmd = "ssh $opt_u\@$opt_H '$cmd'"; - $cmd = "/usr/lib/nagios/plugins/check_nrpe -H $opt_H -c get_disks"; + $cmd = "check_nrpe -H $opt_H -c get_disks"; #$cmd = "cat /tmp/df"; #print "$cmd"; } # Envoi commande et renseignement Hashage %disks my @output = `$cmd`; +my $ret = $?; + +if ($ret == -1) { + print "Could not find " . (split(' ', $cmd))[0] . "\n"; + exit $EXIT_CODES{'UNKNOWN'}; +} + +$ret >>= 8; # 2010/02/25 palli@ok.is : Check if $cmd ran successfully -if ($? > 0) { - print "Failed to execute $cmd : @output\n"; +if ($ret > 0) { + print "Failed to execute $cmd: " . join("\n", @output) . "\n"; exit $EXIT_CODES{'UNKNOWN'} ; } # diff --git a/check_disks.pl/trunk/nagios-okplugin-check_disks.spec b/check_disks.pl/trunk/nagios-okplugin-check_disks.spec index c195856..822a246 100644 --- a/check_disks.pl/trunk/nagios-okplugin-check_disks.spec +++ b/check_disks.pl/trunk/nagios-okplugin-check_disks.spec @@ -3,14 +3,15 @@ Summary: A Nagios plugin to check disks via NRPE Name: nagios-okplugin-check_disks Version: AUTOVERSION -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv2+ Group: Applications/System URL: http://opensource.is/trac/wiki/check_disks Source0: http://opensource.ok.is/trac/browser/nagios-plugins/check_eva/releases/nagios-okplugin-check_disks-%{version}.tar.gz -Requires: nagios-plugins +Requires: nagios-plugins-nrpe BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Packager: Pall Sigurdsson +BuildArch: noarch @@ -39,5 +40,8 @@ rm -rf %{buildroot} %{_libdir}/nagios/plugins/check_disks.pl %changelog +* Sun Oct 16 2011 Tomas Edwardsson 0.1-2 +- Fixed dependencies and build arch + * Mon Mar 1 2010 Pall Sigurdsson 0.1-1 - Initial packaging