Sponsored Content
Top Forums Shell Programming and Scripting [Solved] File System Monitoring Script Post 302462741 by indrajit_renu on Friday 15th of October 2010 12:27:07 AM
Old 10-15-2010
Thanks for the quick help..I am able to get the output, but for not all file system

Bdf
Code:
wdkwe-root> bdf
Filesystem          kbytes    used   avail %used Mounted on
/dev/vg00/lvol3     819200  286136  528928   35% /
/dev/vg00/lvol1     298928   45856  223176   17% /stand
/dev/wdkwevg01/kwe_var
                   2097152    1614 1964573    0% /wdkwe/wms/var
/dev/wdkwevg01/kwe_opt
                   4194304 1744183 2320512   43% /wdkwe/wms/opt
/dev/wdkwevg01/kwe_opt_base
                   1536000  165186 1285191   11% /wdkwe/wms/opt/base
/dev/wdkwevg01/kwe_tmpi
                    524288    1229  490375    0% /wdkwe/tmpi
/dev/wdkwevg01/kwe_samba
                   1048576    1357  981774    0% /wdkwe/samba
/dev/wdkwevg01/kwe_log
                    524288    1229  490375    0% /wdkwe/log
/dev/wdkwevg01/kwe_links
                     65536    1118   60396    2% /wdkwe/links
/dev/wdkwevg01/kwe_home
                    262144    3652  244662    1% /wdkwe/home
/dev/vg00/lvol8    20480000 2992728 17350864   15% /var
/dev/vg00/lvol7    2097152 1521256  571416   73% /usr
/dev/vg00/lvol6     409600  125000  282440   31% /tmp
/dev/vg00/lvol5    3670016 3059912  605352   83% /opt
/dev/vg00/lvol4     212992  156056   56936   73% /home
/dev/wdkwevg01/proedi
                    786432  404331  360216   53% /home/proedi
/dev/vg00/app_common
                    327680  164373  153548   52% /app/common
/dev/vg00/informix  622592  296062  306174   49% /app/common/informix
/dev/wdkwevg01/kwe_log1
                   4194304  843840 3141092   21% /app/common/informix/logical/pkwe

I am using the below script:
Code:
#!/usr/bin/ksh
#
# SCRIPT: fs_mon_HP.ksh
# AUTHOR: Indrajit Bhagat
# DATE: 15-10-2010
# REV: 1.1.P
# PURPOSE: This script is used to monitor for full filesystems,
# which is defined as .exceeding. the FSMAX value.
# A message is displayed for all .full. filesystems.
#
# REV LIST:
#
# set -n # Uncomment to check syntax without any execution
# set -x # Uncomment to debug this script
#
##### DEFINE FILES AND VARIABLES HERE ####
FSMAX="50"              # Max. FS percentage value
export FSMAX
WORKFILE="/tmp/df.work"                 # Holds filesystem data
>$WORKFILE                              # Initialize to empty
OUTFILE="/tmp/df.outfile"                # Output display file
>$OUTFILE # Initialize to empty
THISHOST=`hostname` # Hostname of this machine
######## START OF MAIN #############

bdf | tail +2 |awk '{print $1, $5, $6}' > $WORKFILE
# Loop through each line of the file and compare column 2

while read FSDEVICE FSVALUE FSMOUNT
do
  FSVALUE=$(echo $FSVALUE | sed s/\%//g) # Remove the % sign typeset -i FSVALUE
  if [ $FSVALUE -gt $FSMAX ]
  then
       echo "$FSDEVICE mounted on $FSMOUNT is ${FSVALUE}%" \
       >> $OUTFILE
  fi
done < $WORKFILE # Feed the while loop from the bottom!!

if [[ -s $OUTFILE ]]
 then
    echo "\n Filesystem(s) above $FSMAX% full on $THISHOST\n"
    cat $OUTFILE
    print
fi

The output I am getting is:
Code:
wdkwe-root> sh testabcd
testabcd[32]: test: Specify a parameter with this command.
testabcd[32]: /wdkwe/wms/var: Syntax error
testabcd[32]: test: Specify a parameter with this command.
testabcd[32]: /wdkwe/wms/opt: Syntax error
testabcd[32]: test: Specify a parameter with this command.
testabcd[32]: /wdkwe/wms/opt/base: Syntax error
testabcd[32]: test: Specify a parameter with this command.
testabcd[32]: /wdkwe/tmpi: Syntax error
testabcd[32]: test: Specify a parameter with this command.
testabcd[32]: /wdkwe/samba: Syntax error
testabcd[32]: test: Specify a parameter with this command.
testabcd[32]: /wdkwe/log: Syntax error
testabcd[32]: test: Specify a parameter with this command.
testabcd[32]: /wdkwe/links: Syntax error
testabcd[32]: test: Specify a parameter with this command.
testabcd[32]: /wdkwe/home: Syntax error
testabcd[32]: test: Specify a parameter with this command.
testabcd[32]: /home/proedi: Syntax error
testabcd[32]: test: Specify a parameter with this command.
testabcd[32]: /app/common: Syntax error
testabcd[32]: test: Specify a parameter with this command.
testabcd[32]: /app/common/informix/logical/pkwe: Syntax error

 Filesystem(s) above 50% full on wdkwe

/dev/vg00/lvol7 mounted on /usr is 73%
/dev/vg00/lvol5 mounted on /opt is 83%
/dev/vg00/lvol4 mounted on /home is 73%


Please suggest how to resolve this error message..I am thinking for using printf to remove the above error. I want o/p of all file system which is exceding the threshold 50 %

Last edited by Scott; 10-15-2010 at 07:09 AM.. Reason: Please use code tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

file system monitoring script

Hi Does anyone know any website which contains examples of unix system monitoring scripts example? cheers (1 Reply)
Discussion started by: g-e-n-o
1 Replies

2. Shell Programming and Scripting

File monitoring script

Team, Attached 2 scripts for your validation(main script,mail script) Problem description: When its red it should wait for 10 seconds and then send a mail. If not red it should not send the mail i have done the below changes in the main script: if then if ... (4 Replies)
Discussion started by: whizkidash
4 Replies

3. Shell Programming and Scripting

Shell Script for monitoring File system.

Hi, need help to write one shell script to monitor UNIX file systems and if any changes happend like deletion of any file, adding new file, time stamp changed, permisson changed etc. Script need to send alert mail to defined person/mail id. I request someone to help me to create the... (1 Reply)
Discussion started by: vjauhari
1 Replies

4. Shell Programming and Scripting

ZFS file system - memory monitoring

I am working on a server where the 'root' user ZFS filesystem. Now when I do Top commands it says only 750M free .But when I count the actual memory utilized it comes only to 12 GB and the total size of the server is 32G. I think rest of the space is held up by ZFS file system. Is there a... (5 Replies)
Discussion started by: prasperl
5 Replies

5. Shell Programming and Scripting

system monitoring script

Hi, Does anyone have an example system monitoring script to monitor drives, memory, etc. Need a good example. Cheers Walnutpony (4 Replies)
Discussion started by: walnutpony123
4 Replies

6. Shell Programming and Scripting

Help with File Monitoring Script

I am getting errors when I try to run the script I just made, any suggestiongs would be helpful. Please be gentle, Im still a newbie and learning on the go at an entry level position. #!/usr/bin/ksh # PURPOSE: This script is going to view the top 10 largest home directory Folders, then go in each... (11 Replies)
Discussion started by: gkelly1117
11 Replies

7. UNIX for Dummies Questions & Answers

[Solved] Filesystem getting full. Need a monitoring script

Hi, I am new to shell scripting in unix HP-UX. I need to determine how much a perticular file system is full and if it goes over 80% it should notify through mail about which are the files which are greater than 1 GB size. I used df -k command it is showing the alloocated KB and the %used... (14 Replies)
Discussion started by: Soma Das
14 Replies

8. HP-UX

[Solved] Mount HP-UX File System in Windows 7

Hello, We just got a rx4640 that is running on: HP-UX B.11.31 U ia64 2426088954 unlimited-user license There is a plenty of space in it and we would like to use it for storage. I can access with ftp and place the files in there but i need to mount the file system in every PC that is running... (7 Replies)
Discussion started by: gjk
7 Replies

9. HP-UX

[Solved] Increase the file system size

Dear Friends, I would like to increase the size of a file system from 10GB to 15GB. System is runing on HP-UX 11.31. Please help in the matter. Regards, Bhagawati Pandey (3 Replies)
Discussion started by: BPANDEY
3 Replies

10. Shell Programming and Scripting

[Solved] Process dies when launched in system startup script

Good morning! I'm trying to add Maven to the system boot by the moment without success. Testing the operation of the script I realize that the process isn't persistent when the program is launched with the start option. ---- #Startup Script ---- #! /bin/sh # chkconfig: 345 99 1 #... (5 Replies)
Discussion started by: carpannav
5 Replies
All times are GMT -4. The time now is 10:52 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy