Pathologically Eclectic Rubbish Lister | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Hello vikas330, Let's take the questions one by one: <FS having more than 80% utilization>: The link that I provided you (Perl script to monitor disk space and send an email) provides you the ability to set your own utilization limit. Sample of code based on description from link:
In your case you can set the value to 20 instead of 10, this will mean that if the disk utilization will reach 80% then an email will be sent to you. <need to check FS on mutliple machines>: Regarding the multiple machines, here you could have to options. First and simplest option, apply this script on all machines you want to check the FS utilization on a cron tab as described on the link. Sample of description from link:
By doing so each machine will email you separately in case that you have exceeded 80% utilization. In case that this is not what you really want to have as I suspect, then you need to do a bit of coding. I would write a script that can ssh on all machines and apply df -h, df -P or install the Filesys::DiskSpace which I find extremely useful and retrieve the data and compare them based on your threshold value (e.g. 80%). I prefer to use the module Net::OpenSSH::Parallel which can create multiple parallel ssh connections and retrieve all data. I have some samples of codes into an old question of mine (Best module to execute administrator commands on external operating systems (Linux)) where you will find samples of code for (Net::Telnet, Net::SSH, Net::OpenSSH and Net::SSH::Perl) if I remember correctly all will do your task executing bash commands remotely through ssh and telnet. In case of multiple machines you can create a simple loop where you ssh each machine separately and and collect data separately. As I said as up to you to play around and see what fits your criteria and how much you want to code. Regarding the tabular format hippo provided you multiple links where you can read and implement. Hope this is a more complete answer to your question.
Seeking for Perl wisdom...on the process of learning...not there...yet!
In reply to Re^3: multiple machines disk space alert
by thanos1983
|
|