Mar 19, 2004 #1 IThead MIS Sep 6, 2002 102 US Hi, Does anyone has any script that can check the disk usage by percentage? if any disk that is >90% (using df -k) will email an alert. Thanks
Hi, Does anyone has any script that can check the disk usage by percentage? if any disk that is >90% (using df -k) will email an alert. Thanks
Mar 25, 2004 #21 vgersh99 Programmer Jul 27, 2000 2,146 US strange error message....... Are you sure the 3 arguments you pass to 'CHK_FILE_SPC' function are quoted with single quotes with spaces between the arguments? What OS are you on? vlad +----------------------------+ | #include<disclaimer.h> | +----------------------------+ Upvote 0 Downvote
strange error message....... Are you sure the 3 arguments you pass to 'CHK_FILE_SPC' function are quoted with single quotes with spaces between the arguments? What OS are you on? vlad +----------------------------+ | #include<disclaimer.h> | +----------------------------+
Mar 26, 2004 1 #22 Ygor Programmer Feb 21, 2003 623 GB On hp-ux try using bdf instead of df. Upvote 0 Downvote
Mar 26, 2004 #23 TheDash MIS Mar 25, 2004 171 US Hi, The arguments are correct. CHK_FILE_SPC '/' '10' '%' The O/S is HP-UX 11.00 Thanks Upvote 0 Downvote
Mar 29, 2004 #25 Chacalinc Vendor Sep 2, 2003 2,043 US what is the line 14? could you post it? Upvote 0 Downvote
Mar 29, 2004 #26 TheDash MIS Mar 25, 2004 171 US Thanks for the response. The execution pauses for about 6 seconds before giveing this error Line 14 is export PATH=/usr/bin:/usr/sbin:/bin:/sbin:/usr/local/bin: Upvote 0 Downvote
Thanks for the response. The execution pauses for about 6 seconds before giveing this error Line 14 is export PATH=/usr/bin:/usr/sbin:/bin:/sbin:/usr/local/bin:
Mar 29, 2004 #27 PHV MIS Nov 8, 2002 53,708 FR And what happens if you add set -x in the beginning of the CHK_FILE_SPC function ? Hope This Help, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 Upvote 0 Downvote
And what happens if you add set -x in the beginning of the CHK_FILE_SPC function ? Hope This Help, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
Mar 30, 2004 #28 Chacalinc Vendor Sep 2, 2003 2,043 US I think the problem is here: LOW_WATER_MARK = $AMOUNT * 1024 AMOUNT is get from: export AMOUNT=`$DF $FILESYS | tail -1 | awk -v PERCENT=$2 '{print $2*PERCENT/100/1024}'` and it is resulting in a float number, not integer. Try the commands by hands. Upvote 0 Downvote
I think the problem is here: LOW_WATER_MARK = $AMOUNT * 1024 AMOUNT is get from: export AMOUNT=`$DF $FILESYS | tail -1 | awk -v PERCENT=$2 '{print $2*PERCENT/100/1024}'` and it is resulting in a float number, not integer. Try the commands by hands.
Mar 31, 2004 #29 Ygor Programmer Feb 21, 2003 623 GB On hp-ux try using bdf instead of df. Upvote 0 Downvote
Mar 31, 2004 #30 TheDash MIS Mar 25, 2004 171 US Sorry abt the delay. Ygor, gotta do this with df cmd only .. I will use bdf later.... Chacalinc, I verified.. it gives a float result. Now, I think LOW_WATER_MARK can't be defined as "integer". I tried "float" but it gives an error. PHV, set -x at the beginning of the CHK_FILE_SPC function gives + date +%m%d + export DATE=0331 + export TMP=/tmp/.chkfilspc.0331 + export PATH=/usr/bin:/usr/sbin:/bin:/sbin:/usr/local/bin: + hostname + export HOSTNAME=fddsms + export PROGRAM=temp.sh + export PAGE=/usr/local/bin/sendpage -n + export DF=df -k + set -x + CHK_FILE_SPC / 10 % + export FILESYS=/ + [ % = % ] + df -k / + tail -1 + awk -v PERCENT=10 {print $2*PERCENT/100/1024} + export AMOUNT=0 + typeset -i FREE_SPACE LOW_WATER_MARK + + df -k / + tail -1 + awk {print $3} temp.sh[15]: allocation: The specified number is not valid for this command. Line 15 is: export HOSTNAME=`hostname` Upvote 0 Downvote
Sorry abt the delay. Ygor, gotta do this with df cmd only .. I will use bdf later.... Chacalinc, I verified.. it gives a float result. Now, I think LOW_WATER_MARK can't be defined as "integer". I tried "float" but it gives an error. PHV, set -x at the beginning of the CHK_FILE_SPC function gives + date +%m%d + export DATE=0331 + export TMP=/tmp/.chkfilspc.0331 + export PATH=/usr/bin:/usr/sbin:/bin:/sbin:/usr/local/bin: + hostname + export HOSTNAME=fddsms + export PROGRAM=temp.sh + export PAGE=/usr/local/bin/sendpage -n + export DF=df -k + set -x + CHK_FILE_SPC / 10 % + export FILESYS=/ + [ % = % ] + df -k / + tail -1 + awk -v PERCENT=10 {print $2*PERCENT/100/1024} + export AMOUNT=0 + typeset -i FREE_SPACE LOW_WATER_MARK + + df -k / + tail -1 + awk {print $3} temp.sh[15]: allocation: The specified number is not valid for this command. Line 15 is: export HOSTNAME=`hostname`
Mar 31, 2004 #31 Ygor Programmer Feb 21, 2003 623 GB The problem is the format of df -k on hp-ux. Here's a demonstration.. $ export DF="df -k" $ export FILESYS=/ $ FREE_SPACE=`$DF $FILESYS | tail -1 | awk '{print $3}'` $ echo $FREE_SPACE allocation What you need to get the free space is the fourth field from bdf (or df -Pk)... $ export DF="[highlight]bdf[/highlight]" $ FREE_SPACE=`$DF $FILESYS | tail -1 | awk '{print [highlight]$4[/highlight]}'` $ echo $FREE_SPACE 54812 Upvote 0 Downvote
The problem is the format of df -k on hp-ux. Here's a demonstration.. $ export DF="df -k" $ export FILESYS=/ $ FREE_SPACE=`$DF $FILESYS | tail -1 | awk '{print $3}'` $ echo $FREE_SPACE allocation What you need to get the free space is the fourth field from bdf (or df -Pk)... $ export DF="[highlight]bdf[/highlight]" $ FREE_SPACE=`$DF $FILESYS | tail -1 | awk '{print [highlight]$4[/highlight]}'` $ echo $FREE_SPACE 54812