[Nagios-devel] Patch for contrib/check_inodes.pl

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Guest

[Nagios-devel] Patch for contrib/check_inodes.pl

Post by Guest »

This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enig2A2E73DA031B75FB31127365
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

Hello List!

check_inodes ist broken since several versions of nagios-plugins (I
downloaded the sources yesterday).
This check does not initialize variables using the my statement.
Therefore this check fails to execute. (The perl wrapper uses -T flag)

This patch should be applied:

--- begin of patch --------------------

diff -Naur nagios-plugins-1.4.2/contrib/check_inodes.pl
nagios-plugins-1.4.2.wwk/contrib/check_inodes.pl
--- nagios-plugins-1.4.2/contrib/check_inodes.pl 2002-04-18
23:59:26.000000000 +0200
+++ nagios-plugins-1.4.2.wwk/contrib/check_inodes.pl 2005-12-07
12:13:19.000000000 +0100
@@ -8,12 +8,12 @@
#
#
##############################################################################

-$filesystem = $ARGV[0];
-$warnpercent = $ARGV[1];
-$critpercent = $ARGV[2];
+my $filesystem = $ARGV[0];
+my $warnpercent = $ARGV[1];
+my $critpercent = $ARGV[2];

#------Find out what kind of syntax to expect
-$systype=`uname`;
+my $systype=`uname`;
chomp($systype);

#------Make sure we got called with the right number of arguments
@@ -26,7 +26,7 @@
}#end if

#------This gets the data from the df command
-$inputline = `df -i $filesystem|grep -v "Filesystem"`;
+my $inputline = `df -i $filesystem|grep -v "Filesystem"`;

#------replaces all spaces with a single :, that way we can use split
$inputline =~ y/ /:/s;
@@ -35,13 +35,14 @@
#------(at least mine do). This way I can use this plugin on all my hosts
#------if neither of these work, add your own in, or if you've got one that
#------just flat out reports something different...well...perl is your
friend.
+my $ipercent;
SWITCH: {
if ($systype eq "Linux") {
- ($fs,$inodes,$iused,$ifree,$ipercent,$mntpt) = split(/:/,$inputline);
+ $ipercent = (split(/:/,$inputline))[4];
last SWITCH;
}#end if
if ($systype eq "AIX") {
- ($fs,$blks,$free,$percentused,$iused,$ipercent,$mntpt) =
split(/:/,$inputline);
+ $ipercent = (split(/:/,$inputline))[5];
last SWITCH;
}#end if
}#end switch

--- end of patch --------------------

Greetings,
Frank Wittig

--------------enig2A2E73DA031B75FB31127365
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iD8DBQFDluWsx6tzaD9P7mkRAqZfAJ9B30dDx6DQPp1R3FTPBVcntaKw4wCeOUV8
17+i2c/3xUqtSxKfXeg/dc0=
=AYea
-----END PGP SIGNATURE-----

--------------enig2A2E73DA031B75FB31127365--





This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
Locked