Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Some help with my project:

by 0uts1de (Initiate)
on Jan 17, 2017 at 09:39 UTC ( [id://1179728]=note: print w/replies, xml ) Need Help??


in reply to Some help with my project:

I read both comments and the problem was that the module FileSys::DiskSpace is quite old and abandoned as sayed toolic, and is not able to read modern filesystems as ext4 or ext3, i am using now the Sys::Filesystem module to do the same work, and for the moment is working.

Thanks both for the replies

Replies are listed 'Best First'.
Re^2: Some help with my project:
by madtoperl (Hermit) on Jan 17, 2017 at 13:24 UTC
    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"; }
      my $monit_percentual = (  $avail  /  $avail+$used  ) * 100 ;

      "it will prevent these kind of error if future"

      If you want to prevent errors be aware of perlop "Operator precedence and associativity".

      use strict; use warnings; my $avail = 1; my $used = 1; my $testa = ( $avail / $avail + $used ) * 100; my $testb = ( $avail / ( $avail + $used ) ) * 100; print "testa: $testa\ntestb: $testb\n";

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1179728]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2024-04-17 06:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found