In this code also if you add one more if condition before doing this calculation,
it will prevent these kind of error if future
if ($used){
my $monit_percentual = ( $avail / $avail+$used ) * 100 ;
my $final_used = $used / 1000 ;
my $final_avail = $avail / 1000 ;
print "$monit is a $fs_type filesystem who has $final_used space u
+sed (in MB) and $final_avail of avalible space (in MB too) \n" ;
#comparacion con el porcentaje de $monit_percentual
if ($monit_percentual < $warn) {
print "Less of the $warn % of the space of the filesystem
+$monit is avalible for use, consider uninstall unused software \n" ;
}
elsif ($monit_percentual eq $warn) {
print "Be carefull, exactly the $warn % of the space of $m
+onit is usable, consider uninstall unused software \n" ;
}
else {
print "There is a $monit_percentual % of avarible space of
+ the disk \n" ;
}
}else{
print "Some message\n";
}