I have used the code given and edited some parts and implemented the code in my servers . The code implemented was given below:
And i Got the output as below
I have achieved the goal , but there was some additional request requested by my leads, They want the output like the above but some little modifications required, thats is We got the output but They need the "Disk space report for" (with filesystem) sorted first and then the "no issues to report" these servers should come like " The list of servers which are not having issues are given below: " with the servernames below.
For example :
The list of servers thats not facing the space issue are:
vathpubs017
vathpubs018
So is there any possibilities to bring this output? Please help me .
Well done! But in your last request you are literally drowning in a glass of water, considering the long way you've already come up to this point with your script.
Your request can easily be implemented with something like this (pseudo code):
1) Log the list of servers with disk space issue to one file, say servers_with_issues.txt.
2) Log the list of servers without issues to a separate file, say servers_without_issues.txt.
In your script, and in the place that you want, first echo the legend "Servers with issues" and then cat the first file.
Then echo the legend "Servers without issues" and then cat the 2nd file.
The rest remains basically the same.
Good luck!
Yeah definitely i will use the ideas which you shared and i had an idea, but could you please let me know whether this will help for me..
In this below code :
I have redirected the echo part to the same text file "report010.txt" instead am planning to redirect it to a different file named "noissues.txt" and followed by this below code
How about this plan? Whether it will help me out to get the expected output
I'm not sure why you would want to duplicate the contents of report010.txt? Anyhow, you can collect all your logics into one awk script:
or, to do what presented just above, try
Also, please note that this line:
will echo the name of the host where you're running the script to the noissues.txt file, instead of saving the name of the server that is not experiencing disk space issues.
If I were you, I'd take note of all the suggestions that you've received in this thread and start from scratch. It should not be hard to do.
Hi,
I am new to shell scripting, and want to monitor disk space using shell script continously on server, which will shoot mail after crossing threshold limit
Please suggest.
Regards
Manoj (1 Reply)
Hi,
I need help in writing unix script for checking space of some directories on the system and also send an email when it reaches the threshold limit.
I have written the followng code;
#!/bin/ksh
ADMIN="me@somewhere.com"
# set alert level 80% is default
THRESHOLD=80
df | grep -E... (5 Replies)
when i check
/export directory of my machine gets filled up (85%) i removed some old logs. but after cleaning df -k command still shows that /export is still 85% full.
Is there a way to force df to reflect actual free space without rebooting? My machine is a production one and can't... (8 Replies)
Hi
This is my script for disk space monitoring
clear
if
then
echo "You must be root user to execute the script"
fi
ALERT_LEVEL=10
CONSUMPTION_LEVEL= `df -k | awk {'print $5'} | cut -d '%' -f1 | sed "1 d"`
for i in $CONSUMPTION_LEVEL
do
FILE_SYSTEM=`df -k | awk {'print $1'} |... (3 Replies)
HI ...
I am New to the Unix...I am trying to write a script to check the disk space.
But i am not able to write it.
I know the command to check the disk space df -k,but unable to write the script..Can any body help me...
Thanks in advance... (3 Replies)
Hi Experts.
I had 100% disk full , even though i have removed 2 GB space still dbf command shows 100%.
How to rectify that. Appreciate your prompt help. Thanks (1 Reply)
Hello,
Can someone please tell me which command to use to determine the available disk space on a given disk device?
I have to write a shell script that compresses files and stores them in a specific location but I am not sure how "conservative" I should be?
Thanks in advance!
Al. (4 Replies)
I know I have posted this question before, but I still just don't understand how to determine disk space. This server is an IBM RS6000 running on AIX version 4.2.1.
I in essence need to know the following if anyone can assist me.
1) I need to know how many drives are configured in the... (2 Replies)
Hi
I'm trying to install gcc and the installation program tells me that I'm out of disk space! I have just installed the os (using the default settings for partitions and sizes) and have only installed apache on the machine. Can it really be out of disk space already?
How do I check how much... (4 Replies)