Blogs Classifieds Downloads FlashChat Gallery Googlemap Invite Friends Links Projects Reviews Wiki
 


Welcome to the pSeries Tech Forums, our free peer-based support site for administrators, engineers and architects working with IBM pSeries servers and software.

You are currently viewing our site as a guest which gives you limited access to view most discussions, articles, tutorials and access our other free features. By joining our community you will be able to collaborate with administrators, engineers and architects charged with designing, delivering or maintaining IBM pSeries server environments.

Founded by a recognized IBM pSeries consultant and IBM Redbook author, pSeries Tech Forums was developed with the single mission of bringing IBM pSeries professionals together into a single self-help community.

Registration is fast, simple and absolutely free to all IT professionals with responsibility for or interest in IBM pSeries servers. We invite you to join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

Our Sponsors
Want to advertise?  


Reply
 
LinkBack Thread Tools
  #1  
Old July 25th, 2006
Gameline146's Avatar
Gameline146 Offline
Junior Member
 
Join Date: July 2006
Posts: 12
returning only percent used of drive on DF command

Greetings gents!

I am looking for a way to determine the % used of a specific volume.
using the df command shows me everything but i just need the percent used for a specific volme like /u01/help/me. I know i can get the one line by piping, but how would i extract that info?

I am basically looking to find this info so i can put it on the crontab and be notified when it exceeds a certain percentage.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2  
Old July 25th, 2006
alexisl's Avatar
alexisl Offline
Senior Member
 
Join Date: June 2006
Posts: 147
Re: returning only percent used of drive on DF command

You can specify a specific mount-point/file system with df like:

df -g /etc

but I am not sure if that is what you want.

You can also use the du command to get the amount of space used by a specific directory or file like:

du -gs /etc/security

but it doesn't give percentages.

The best thing that I can tell you is to write a script using the du command if you actually need the percentage of use for a file/directory.

PS in both cases above the -g option is for display in Gigabytes
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old July 25th, 2006
Gameline146's Avatar
Gameline146 Offline
Junior Member
 
Join Date: July 2006
Posts: 12
Re: returning only percent used of drive on DF command

right. I can get the du to show me the size, but ita lso shows the directory as well. if I want to simply capture the value of the size into a script to do analysis on, how do I do that?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old July 25th, 2006
alexisl's Avatar
alexisl Offline
Senior Member
 
Join Date: June 2006
Posts: 147
Re: returning only percent used of drive on DF command

I would write something like:

critical_level=1 #this is the level of use you are looking for in Gigabytes
use_level=`du -g /u01/help/me` #this gets the amount of use on the file specified

if [ $use_level <= $critical_level ]
then
mailx -s "Disk level critical" username@organization.com
fi
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old July 25th, 2006
FASherman's Avatar
FASherman Offline
IBM pSeries and Storage Architect
 
Join Date: May 2006
Posts: 240
Send a message via Yahoo to FASherman
Re: returning only percent used of drive on DF command

du | grep | awk
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


Fred Sherman
IBM pSeries and Storage Architect
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old July 25th, 2006
Gameline146's Avatar
Gameline146 Offline
Junior Member
 
Join Date: July 2006
Posts: 12
Re: returning only percent used of drive on DF command

here is the script
du -s /directory path | awk'
{
# load value from df command listing
#and comapre

if($1 > 6291456)
print "overload!"
[else
print "archiver ok"
]
}'
when executing i get this error:
crontab_archiver.shl[16]: awk^J{^J# load value from df command listing^J^Jif($1 > 6291456)^Jprint "overload!"^J[else^Jprint "archiver ok"^J]^J}: not found.


What am I doing wrong? If i just simply df and then sue awk to print $1, my return is the value i need.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7  
Old July 26th, 2006
steevojb's Avatar
steevojb Offline
Senior Member
 
Join Date: June 2006
Location: manchester, england
Posts: 185
Re: returning only percent used of drive on DF command

Hi There

TIMTOWTDI

du -s /directory/path | awk '
{
if ( $1 > 6291456 )
printf "overload!"
else
print "archiver OK"
}'


HTH

Steve
__________________
Take your time and think things through !!
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8  
Old July 26th, 2006
Gameline146's Avatar
Gameline146 Offline
Junior Member
 
Join Date: July 2006
Posts: 12
Re: returning only percent used of drive on DF command

what if instead of a message, i wanted to mail the results with a messsage of something like "current usage is x% of total" or something similar?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #9  
Old July 26th, 2006
alexisl's Avatar
alexisl Offline
Senior Member
 
Join Date: June 2006
Posts: 147
Re: returning only percent used of drive on DF command

the mailx -s command will do that

mailx -s "subject here" emailaddress < input file with message
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #10  
Old July 31st, 2006
Gameline146's Avatar
Gameline146 Offline
Junior Member
 
Join Date: July 2006
Posts: 12
Re: returning only percent used of drive on DF command

ok,

I tried some modifications to this and am getting some strange errors. I essentially want to build a file with the message that the size is too big, and send an email if the size is too large. The error I get is this:

Syntax Error The source line is 6.
The error context is
>>> else <<<
awk: 0602-502 The statement cannot be correctly parsed. The source line is 6.
Please remove log files to make space
Some parameters were not parsed.
Usage: no -h [tunable] | {-L [tunable]} | {-x [tunable]}
no [-p|-r] (-a | {-o tunable})
no [-p|-r] (-D | ({-d tunable} {-o tunable=value}))
NOTE:
1. The no commands can only be excuted by root.
2. -r, -p and -C flags must be placed at the beginning of the command line.
3. -r and -p are mutual exclusive.
4. Display (-a,-o option) and modification (-o option=value, -d option, -D) flags connot be mixed.
5. -D flag can not mixed with other modification (-o option=value, -d option) flags.


My original code is:

sendmail='no'
echo $Date > crontab_archiver.lis
echo "************************************************* " >> crontab_archiver.lis
du -s /path| awk '
{
if ( $1 > 6291456 )
printf "The archiver has exceeded capacity of x%." >> "crontab_archiver.lis"
sendmail ='yes'
else
print "archiver ok" >> "crontab_archiver.lis"
}'
echo "/n" >> crontab_archiver.lis
echo "Please remove log files to make space"
echo "********************************************* ***" >> crontab_archiver.lis
if $sendmail = 'yes'
then
echo mail -s "Archiver Overflow!" me@mail.com > crontab_archiver.lis
fi
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Bookmarks

These are the 100 most searched terms
Search Cloud
0042-001 0042-001 nim 0513-001 the system resource controller daemon is not active 0513-001 the system resource controller daemon is not active. 0514-061 0514-061 cannot find a child device 0514-061 cannot find a child device. 0516-787 0516-787 extendlv 0516-787 extendlv: maximum allocation for logical volume 110000ac aa00e1f3 aio aix aix aio aix freeware aixif_arp_dup_addr b150f22a b181fb53 ba010004 c1001020 d133c002 dacnone dcb47997 dlpar fcp_array_err6 fget_config gnu tar aix gsclvmd gtar aix hi yall hmc root password hmc vmware hscl05db ibm p6 ibm p6 520 libpopt aix libpopt.a libpopt.a(libpopt.so.0) is needed by rsync-2.6.2-1 migratelv mksysb navisphere agent nim server pseries pseriestech rsync aix sc_disk_err4 scan_error_chrp vio server websm xhost file ... powered by Simple Search Cloud


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Microsoft Windows 2003 Active Directory integration FASherman Tutorials 25 April 28th, 2008 07:14
VIOS and CD drive sharing mihha IBM PowerVM Editions 2 May 24th, 2007 03:02
How to share tape drive aus76pk pSeries - System p 3 February 28th, 2007 18:14
SCSI addresses and installing new tape drive dwagg pSeries - System p 2 February 22nd, 2007 08:04
lpar_netboot command sreenu341 Hardware Management Console 3 January 6th, 2007 09:23



Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Powered by vbWiki Pro 1.3 RC5. Copyright ©2006-2007, NuHit, LLC

vBulletin Skin developed by: vBStyles.com


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48