| Current File : //usr/local/nagios/libexec/check_inodes.pl |
#!/usr/bin/perl
@out = `df -i`;
$warn = shift||80;
$crit = shift||90;
$status = "";
$retcode = 0;
foreach $line (@out){
chomp($line);
$line =~ s/\s+/ /g;
(undef,undef,undef,undef,$usage,$path) = split(/ /,$line);
next if $path eq "Mounted";
$usage =~ s/\%//g;
if ($usage > $warn and $usage < $crit and $retcode eq 0) {
$status .= "$path filesystem WARNING: inode usage = $usage \% - ";
$retcode = 1;
}
if ($usage > $crit) {
$status .= "$path filesystem CRITICAL:; inode usage = $usage \% - ";
$retcode = 2;
}
}
$status = "All filesystems normal" if $retcode eq 0;
print $status;
exit($retcode);