Health check report


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Health check report
# 1  
Old 02-18-2013
Health check report

Hi Team,

I am writing a small script in that I want collect all servers of /opt and /stage.

Below is my small script
Code:
#!/bin/ksh

#checking Media server opt_Disk_Space_logs

myclient=`cat media_server.txt`
> opt_logs.txt

printf " Server Name\tsize\tused\tavail\tcapacity\tMounted on\n"

for i in $myclient

do

j=`sudo xxxxxx $i df -h |egrep -i "/opt|/stage" | awk '{print $2, "\t", $3, "\t", $4, "\t", $5,"\t", $6}'`

printf "\n $j"
done
echo""
echo""

the output as below.
Code:
 Server Name    size    used    avail   capacity        Mounted on

 13G     7.8G    4.9G    62      /opt
300G     268G    32G     90      /stage

but I want, some more in depth means.
If column 62 is more than 90 I need warming message

Code:
a=90

echo "out of opt_out"
echo $opt_out
if [ "$opt_out" -ge "$a" ]

then
printf "%s\t WARNING NEED TO CHECK NOW /opt \n",$opt
else
printf "%s\tGood Required space\n",$opt
echo "$opt_out   Good Required space"
fi

I know the above script as some problem, it is not give any correct output

Please provide the exact script.. The out put should be as below..

AND also I am checking many server as

Code:
server 1

 13G     7.8G    4.9G    62      /opt     Good, Required space avilable
300G     268G    32G     90      /stage  WARNING NEED TO CHECK NOW


server 2 

 13G     7.8G    4.9G    62      /opt     Good, Required space avilable
300G     268G    32G     90      /stage  WARNING NEED TO CHECK NOW


.....

etc

# 2  
Old 02-18-2013
Did you do an intensive search in these fora? This question has been asked (and answered) n times...
Quote:
Please provide the exact script.. The out put should be as below...
You will be able to do it yourself!
# 3  
Old 02-18-2013
Hi Rudic,

Thanks for encouragement, At last I have did the script.

If you don't mind can you please help the small graphics here.

Code:
13G      7.8G    4.9G    62%     /opt           Good Required space
300G     268G    32G     90%     /stage                 WARNING NEED TO CHECK NOW

" Good Required space".... should be Yellow or blue
and

"WARNING NEED TO CHECK NOW" ... Should be Red color

Thanks for your help
# 4  
Old 02-18-2013
Something as described in the below link :

Code:
http://unix.stackexchange.com/questions/43408/printing-colored-text-using-echo

# 5  
Old 02-18-2013
Hi Mate,

is it possible the same color in awk program

Code:
print $j |awk '{print $1, "\t", $2 "\t", $3, "\t", $4,"\t", $5,"\t\t "\e[1;34m Good Required space\e[0m"}'

The out put like below.


awk: syntax error near line 1
awk: illegal statement near line 1
awk: syntax error near line 1
awk: illegal statement near line 1



---------- Post updated at 03:47 PM ---------- Previous update was at 03:38 PM ----------

It works by below link

Code:
http://www.bashguru.com/2010/01/shell-colors-colorizing-shell-scripts.html

Thanks all
# 6  
Old 02-18-2013
Using escape sequence in awk gives me this:
Code:
awk: warning: escape sequence `\e' treated as plain `e'

# 7  
Old 02-18-2013
Quote:
Originally Posted by bashi77
Hi Mate,

is it possible the same color in awk program
Yes, try this:

Code:
"\033[1;34m Good Required space\033[0m"

On Solaris use nawk or /usr/xpg4/bin/awk.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. AIX

AIX Health Check

Hi everyone, I am new to the Unix admin position, needed some help. My management wants to report how their over all AIX servers / environment is doing so far. I've been researching and found multiple commands to run on each LPAR, well I have few questions and also wanted to share the commands Im... (12 Replies)
Discussion started by: Adnans2k
12 Replies

2. Shell Programming and Scripting

Script to check the health of a database

need a script to check the health of a session server database. It must read the data base and send an alert if the database is unavailable. If its unavailable, we will want to bring down the database listener to force failover. can u guyz help me in doing this. what information do i need... (1 Reply)
Discussion started by: remo999
1 Replies

3. HP-UX

HP-UX Health Check

Hi Experts, I want to check health of hp-ux box. Basically I want to check if there are possibilities of network/memory/cpu bottleneck? Are there are any commands available other than glance in hp-ux for the same? (11 Replies)
Discussion started by: sai_2507
11 Replies

4. Shell Programming and Scripting

Health check script

There are 3 servers . I want to fire commands df -kh and mpstat -P ALL on those individual servers and retrieve particular values to genrate reports. This part is almost done. But i am facing issue when i need to compile the reports from all three servers on to one server in order to generate a... (1 Reply)
Discussion started by: pratikm23
1 Replies

5. AIX

AIX Health Check script

Hi Everyone, Can you please help me put together a aix health check script that will check the status of CPU,Memory,Adapter, Filesystems (threshold 80%) and Disks.Im thinking of deploying a script to gather the required data in all the 22 servers and probably send out a mail if anything needs... (3 Replies)
Discussion started by: R!C
3 Replies

6. Shell Programming and Scripting

Health check script

Hi, I have a server type(A group of AIX,HP-UX and Linux servers running with different appn) in which i need to do health check(memory,cpu,h/w etc). I am planning to automate the same. Please help me out in writing the same. Thanks Renjesh Raju (9 Replies)
Discussion started by: Renjesh
9 Replies

7. Solaris

sun server health check

do anybody has a procedure for daily weekley monthly health check for SUN server with solaris OS?? (5 Replies)
Discussion started by: mm00123
5 Replies

8. AIX

AIX Health Check

Hi All, I would like to know if there is a downloadable AIX health check script available from IBM that would print a report of a servers health status. I've been working on a number of Sun Solaris servers and Sun provide a sun checkup script which can give you an ORI figure as well as a list... (3 Replies)
Discussion started by: backslash
3 Replies

9. HP-UX

check health

Dear Gentelmen I need command for display to me the following statement: -battery state -The application if working or not -The cpu is working or not -The power supply is working or not -The Data base is workig or not (2 Replies)
Discussion started by: magasem
2 Replies
Login or Register to Ask a Question