Filesystems using more than 75% capacity


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Filesystems using more than 75% capacity
# 1  
Old 03-30-2011
Error Filesystems using more than 75% capacity

i need to write a shell script for printing the list of filesystems whose disk utilization is more than 75%...i tried using df -h along with awk but cud'nt make the combination work.....Smilie
when we do df -h then the filesystems which are using more than 75% capacity shud be printed according to the requirement......please help me with it...thanks..Smilie
m working on ksh!!

Last edited by xtatic; 03-30-2011 at 03:19 AM..
# 2  
Old 03-30-2011
Try:
Code:
df -hP | awk '{x=$5;sub ("%","",x)}x>75'

# 3  
Old 03-30-2011
It looks work too with:
Code:
df -h | awk '$5>75'


or similar to bartus solution:
Code:
df -h | awk '{sub(/%/,"")}$5>75'



Hope it helps

Regards
# 4  
Old 03-30-2011
Thanks bartus11, i was unaware of the option -P hence came up with below..
Code:
df -h | awk '{if(NF==1){x=$0;getline;if(int($4)>75)print x,$0}else if($5>75) print}'


Last edited by michaelrozar17; 03-30-2011 at 04:44 AM..
# 5  
Old 03-31-2011
@bartus...it showing the following error
tc95air1(root)# ./script2
df: unknown option: P
Usage: df [-F FSType] [-abeghklntVvZ] [-o FSType-specific_options] [directory | block_device | resource]
awk: syntax error near line 1
awk: illegal statement near line 1


@michael: it's executing and givin the outputSmilie but the o/p seems to be wrongSmilie
tc95air1(root)# ./script1
Filesystem size used avail capacity Mounted on
/dev/dsk/c1t0d0s6 9.8G 724M 9.0G 8% /unused2

but when i run df -h the following records are shown
tc95air1(root)# df -h
Filesystem size used avail capacity Mounted on
/dev/dsk/c1t0d0s0 20G 8.8G 11G 46% /
/devices 0K 0K 0K 0% /devices
ctfs 0K 0K 0K 0% /system/contract
proc 0K 0K 0K 0% /proc
mnttab 0K 0K 0K 0% /etc/mnttab
swap 2.4G 2.1M 2.4G 1% /etc/svc/volatile
objfs 0K 0K 0K 0% /system/object
sharefs 0K 0K 0K 0% /etc/dfs/sharetab
fd 0K 0K 0K 0% /dev/fd
swap 2.4G 424K 2.4G 1% /tmp
swap 2.4G 40K 2.4G 1% /var/run
/dev/dsk/c1t0d0s5 9.8G 106M 9.6G 2% /unused1
/dev/dsk/c1t0d0s7 16G 1011M 15G 7% /export
/dev/dsk/c1t0d0s6 9.8G 724M 9.0G 8% /unused2
/dev/dsk/c1t0d0s3 9.8G 6.3G 3.4G 65% /voice1
/platform/sun4u-us3/lib/libc_psr/libc_psr_hwcap1.so.1
20G 8.8G 11G 46% /platform/sun4u-us3/lib/libc_psr.so.1
/platform/sun4u-us3/lib/sparcv9/libc_psr/libc_psr_hwcap1.so.1
20G 8.8G 11G 46% /platform/sun4u-us3/lib/sparcv9/libc_psr.so.1


the output doesn't match with the records as it's showing a file system with "8%" usage which is less than 75%Smilie.....please help me with this..
# 6  
Old 03-31-2011
Could you try the below..
Code:
df -h | awk '{if(NF==1){x=$0;getline;if(int($4)>75)print x,$0}else if(int($5)>75) print}'

# 7  
Old 03-31-2011
Quote:
Originally Posted by xtatic
@bartus...it showing the following error
tc95air1(root)# ./script2
df: unknown option: P
Usage: df [-F FSType] [-abeghklntVvZ] [-o FSType-specific_options] [directory | block_device | resource]
awk: syntax error near line 1
awk: illegal statement near line 1
Which Solaris version are you using?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

FS capacity

can anyone tell me how to reduce Fs capacity by using echo zero. (3 Replies)
Discussion started by: nkchand
3 Replies

2. AIX

Directories getting 100% capacity

I am new to using AIX but ive ran into issues with 100% full and then rebooting and having a socket error repeating over and over. My question is, what can I do besides just monitoring to ensure I dont run into these issues? Scripts? anything? Thanks (3 Replies)
Discussion started by: terry.berger
3 Replies

3. AIX

TSM capacity

Dears, The TSM storage that we have is already configured to backup some Application,directories & logs or let's say backup different path from 15 servers, I want to add more Items to be backuped by this storage, how to be confirmed if that possible or not? I mean how do we know the capacity of... (7 Replies)
Discussion started by: arm
7 Replies

4. AIX

how to find out disk capacity

Hi, I would like to know how to find out disk capacity if it is assigned from the storage as a lun. as per below command , I am unable to find out disk capacity. $ bash bash-3.00$ lspv hdisk1 0001579a7fa3c086 None $ lscfg -vl hdisk1 hdisk1 ... (8 Replies)
Discussion started by: manoj.solaris
8 Replies

5. Shell Programming and Scripting

Monitor capacity of directory

Good morning. I have been attempting to find a way to monitor the capacity of a directory so that when it reaches 80% or higher I can send an event. I was able to find a script that does this for the whole drive by I can not seem to figure out how to do this for just a single directory. ... (1 Reply)
Discussion started by: LRoberts
1 Replies

6. Solaris

tools for capacity planning

Hi All, What do you usually use for capacity planning tool on solaris 8 or later? Thanks in advance. (2 Replies)
Discussion started by: itik
2 Replies

7. AIX

capacity planning on aix

Hi All, What do you usually use for capacity planning on AIX? Any idea will do? Thanks in advance, itik (1 Reply)
Discussion started by: itik
1 Replies

8. AIX

How to increase capacity?

Hello everybody, is a very simple question how can I increase the capacity of a disk wich is on a DS4300?, I have done the procedure on the Storage Manager but the space is the same on the AIX (5.3) , what should I do to obtain the new ammount of disk space? (16 Replies)
Discussion started by: GermanSkull
16 Replies

9. UNIX for Dummies Questions & Answers

How to find filesystems crossed 90% capacity

Hi experts, How do i find which are the filesystems which has crossed 90% capacity in solaris box. thanks Shaan:) (4 Replies)
Discussion started by: shaan_dmp
4 Replies

10. Filesystems, Disks and Memory

how to find memory capacity.

Hi, In Sun solaris o/s how can i find the memory space available,Swap space. By giving df command i can get the disc space. I want RAM space & swap space. If anybody assist me.that is great. Thanks (2 Replies)
Discussion started by: Mar1006
2 Replies
Login or Register to Ask a Question