Add logic in the existing code
I have a existing perl script.
This is our space monitor script.
Current Function of the Script:
If any file system exceed 90% following action do as below:
Script will create a output file which contains any new file created in the system in last 24 hours and any file over 100 MB. This file will send via email to the defined users. And file will deleted from the the System via script.
Current FS in the script:
( '/', '/dev', '/opt', '/tmp', '/var', '/usr );
In addition to above we want to do as follows:
We want to add two mounted file system as /mnt/backup_1 & /mnt/backup_2 in the logic.
We want any /mnt/ server will trigger when its over 95%, rest of the FS should be same as before 90%.
We do not want to delete output file from the System. We also do not want to send whole output file via email, we want to send only notification via email which state that specific FS is over 90% or 95% and please check /home/wasadmin/space for the FSWatch.log.
I have attached script.
Please have a look at it.
It seems like the simplest way to modify the script is to take the body of the for loop and create a function that takes a filesystem name and a threshold value as parameters. Then create a second list of file systems and add a second loop for that list using the higher threshold.
Something like the following:
As far as sending the email. A quick google of "perl email" will provide lots of ways to do it.
|All times are GMT -5. The time now is 02:04 AM.|