Patch for contrib/check_inodes.pl
Frank Wittig
fw at weisshuhn.de
Wed Dec 7 14:37:45 CET 2005
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 251 bytes
Desc: OpenPGP digital signature
URL: <https://www.monitoring-lists.org/archive/developers/attachments/20051207/322bd601/attachment.sig>
More information about the Developers
mailing list