Space Monitoring option


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Space Monitoring option
# 1  
Old 06-04-2009
Space Monitoring option

Code:
thrld=`bdf /u01/|grep u01|awk {'print $5'}|sed 's/'%'//'`
thrld1=`bdf /u12/|grep u02|awk {'print $5'}|sed 's/'%'//'`
ch=""

echo "------------------"
echo "                  "
echo "------------------"
echo "1)/u01"
echo "2)/u12"
echo " Please select : \c"
read ch

case "$ch" in
"1")echo $thrld;;
"2")echo $thrld1;;
esac

if [ $ch -gt 95 ];then
echo "Exceed Threshold!"
echo "Send SMS alert? Y/N: \c"
read ans
if [ $ans = Y -o $ans = y ];then
   SMS 00000000 "Alert!! /u01= $LIST%"
 elif [ $ans = N -o $ans = n ];then
   echo "No SMS send!"
else
  echo "Wrong answer. Type Y or N"
fi
     else
echo "Within Capacity Threshold"
fi

#END

Please help me with this,

I want to have either one from 2 menu to choose.But it's not working as the output is same.
The other problem, when input other than Y or N,the script will return back to start not exit. How can I do that? Thanks
# 2  
Old 06-04-2009
Bug Health check script..

Hi,

you can use this health check script which gives you a details stats of your systems.

#!/bin/sh

DATE=`date +%Y%m%d`
HOME=/home/healthcheck/samba_hcreport


printf " --------------------------------------------------------\n" >> $HOME.$DATE
printf " File Name : Live Production Server `hostname` \n" >> $HOME.$DATE
printf " Author : Siddhesh K \n" >> $HOME.$DATE
printf " Description : Displays Information on SAMBA Server\n" >> $HOME.$DATE
printf " Last Modified : `date +%m/%d/%y` \n" >> $HOME.$DATE
printf " ---------------------------------------------------------\n" >> $HOME.$DATE

printf "\n\n################### DISK USAGE #######################\n\n" >> $HOME.$DATE
df -h >> $HOME.$DATE

printf "\n\n##################### MEMORY USAGE ###################\n\n" >> $HOME.$DATE
free -m >> $HOME.$DATE

printf "\n\n############### SERVER UPTIME & AVERAGE LOAD #############\n\n" >> $HOME.$DATE
uptime >> $HOME.$DATE

printf "\n\n############### ROUTING INFORMATION ##################\n\n" >> $HOME.$DATE
netstat -nr >> $HOME.$DATE

printf "\n\n################### USERS HAVING UID=0 ###############\n\n" >> $HOME.$DATE
awk -F: '$3 == 0 { print $1 }' /etc/passwd >> $HOME.$DATE

printf "\n\n################# USERS HAVING GID=0 #################\n\n" >> $HOME.$DATE
awk -F: '$4 == 0 { print $1 }' /etc/passwd >> $HOME.$DATE

printf "\n\n################# MOUNTED FILE-SYSTEM #####################\n\n" >> $HOME.$DATE
mount >> $HOME.$DATE

printf "\n\n############## PROCESS/SERVICES RUNNING ON SEREVER #############\n\n" >> $HOME.$DATE
top -b -n 1 >> $HOME.$DATE

mail -s "Health Check Completed For SAMBA On $DATE" s.khavnekar@gmail.com \ < $HOME.$DATE

I think this should solve your problem...Smilie
# 3  
Old 06-04-2009
Hi ,

Insted of echoing just assign value to ch in case : like below
case "$ch" in
"1") ch=$thrld;;
"2") ch=$thrld1;;
esac

Hope this will solve your probs

Regards
Arpit
# 4  
Old 06-04-2009
Hi Sidd
Thank you for the reply. But it not works like the way I want Smilie

Hi Arpit,
It give error "ksh: ch: not found". Any other suggestion?thx
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Solaris 10 & 11 ZFS Space Monitoring

Hi Folks! Its been a while since I worked with ZFS but basically, I need to monitor free space for Solaris 10 & 11 systems (with & without zones) I am hoping that any space commands only need to be run from the global zone (to simplify matters) However, I'm not not sure if there are exceptions... (2 Replies)
Discussion started by: GazinLincoln
2 Replies

2. Solaris

Unrecognized option: sparc-sun-Solaris2.10/bin/as: unrecognized option `-m32'

Hi, I installed some packages required by an app built with python. But when I try python setup.py install, I get the following error: /opt/csw/lib/gcc/sparc-sun-solaris2.10/5.2.0/../../../../sparc-sun-solaris2.10/bin/as: unrecognized option `-m32' Could anyone tell me what's wrong... (4 Replies)
Discussion started by: Kimkun
4 Replies

3. Shell Programming and Scripting

Help needed to create a UNIX Space monitoring script

Hi All, Its urgent.. pls help me out.. I want to create a KSH which should generate a report with the list of users and the files larger than 5 GB created by them in a direcorty and send autogenerated e-mail to them. my input would be users list,directory path and the file size (say 5 GB) ... (11 Replies)
Discussion started by: anman0523
11 Replies

4. Shell Programming and Scripting

AWK FS with ignore space option

Hi, i have in a situation to get the variables which are having a "|" delimiter and each variable may or may not have spaces, so how can i skip the spaces on the string and print the string as it is. For example: line = "|Hello world|Hello|Hi Guys| read x y z <<<$(echo "$line" | awk -F"|"... (5 Replies)
Discussion started by: tprabhaker
5 Replies

5. Shell Programming and Scripting

Disk Space Monitoring Script - OLD and NEW

It's the old thread "Disk Space Monitoring Script", modified for UNIX This is the new code: df -k | awk ' { if ( int($4) > 90) {subject = $1 " More than 90% disk usage. Used: " $4 email = "email@test.com" print subject cmd = "mailx -s \"" subject "\" " email cmd | getline... (4 Replies)
Discussion started by: dungureanu
4 Replies

6. Shell Programming and Scripting

recently introduced to the newer option for find...does an older option exist?

To find all the files in your home directory that have been edited in some way since the last tar file, use this command: find . -newer backup.tar.gz Is anyone familiar with an older solution? looking to identify files older then 15mins across several directories. thanks, manny (2 Replies)
Discussion started by: mr_manny
2 Replies

7. Infrastructure Monitoring

Open Source Monitoring and Overlapping IP Space

I'm faced with standing up an open source NMS and am deep into Zenoss Core. I'm evaluating distributed collectors that will be deployed behind a customer NAT/Firewall. Cool, this works. What if the customer IP space overlaps with an existing customer IP space? From a management perspective Zenoss... (0 Replies)
Discussion started by: Radar
0 Replies

8. Fedora

"integer expression expected" error with drive space monitoring script

Hi guys, I am still kinda new to Linux. Script template I found on the net and adapted for our environment: #!/bin/sh #set -x ADMIN="admin@mydomain.com" ALERT=10 df -H | grep -vE '^Filesystem|tmpfs|cdrom' | awk '{ print $5 " " $1 }' | while read output; do #echo $output ... (2 Replies)
Discussion started by: wbdevilliers
2 Replies

9. Shell Programming and Scripting

option followed by : taking next option if argument missing with getopts

Hi all, I am parsing command line options using getopts. The problem is that mandatory argument options following ":" is taking next option as argument if it is not followed by any argument. Below is the script: while getopts :hd:t:s:l:p:f: opt do case "$opt" in -h|-\?)... (2 Replies)
Discussion started by: gurukottur
2 Replies

10. Shell Programming and Scripting

Disk Space Monitoring Script

#!/bin/bash # Disk Space Monitoring for more than 95 % # and Sending Alerts by Mail if ; then `df -k |awk '$5 > 95 {print $1 " ----------- " $5}' |mailx -s "More than 95% disk usage in DEV" email@test.com'; else exit 0 fi I get the... (8 Replies)
Discussion started by: sriram003
8 Replies
Login or Register to Ask a Question