#!/usr/bin/perl # Linux version! use strict; my $warning=$ARGV[0]; my $critical=$ARGV[1]; my @excludefilesystems=split(/,/,$ARGV[2]); my $hit=0; my $warn=''; my $crit=''; my $str=`df -h | awk 'NR > 1 {print}'`; while($str=~/^(\S+).*?[0-9.]+.*?[0-9.]+.*?[0-9.]+.*?([0-9.]+).*?(\/\S*).*?$/mg){ foreach my $i (@excludefilesystems){ if ($1 eq $i){ $hit=1; } } if ($hit==0){ if($2>=$critical){ $crit=$crit . "$3 $2% "; } if($2>=$warning){ $warn=$warn . "$3 $2% "; } } $hit=0; } if($crit){ print $crit; exit(2); } if($warn){ print $warn; exit(1); } print "Disk below threshold"; exit(0);