Operating System - HP-UX
1825771 Members
2047 Online
109687 Solutions
New Discussion

Want to determin the file system having more than or equal to 80% usage

 
SOLVED
Go to solution
Durvesh Mendhekar
Regular Advisor

Want to determin the file system having more than or equal to 80% usage

I want to determine the file system of equal to or greater than 80% usage by using bdf command how can i do it.
14 REPLIES 14
OFC_EDM
Respected Contributor
Solution

Re: Want to determin the file system having more than or equal to 80% usage

It tells you in the output.

Or do you mean you want to script an alert based on the bdf output?

Can you provide a sample of your bdf output?
The Devil is in the detail.
Steven E. Protter
Exalted Contributor

Re: Want to determin the file system having more than or equal to 80% usage

Shalom,

There are a number of scripts posted to itrc that will do this job, based on bdf output.

http://forums13.itrc.hp.com/service/forums/questionanswer.do?threadId=178514

This thread is the largest repsoitory.

Yes you will have to hunt a bit but that thread has the best selection.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Ivan Krastev
Honored Contributor

Re: Want to determin the file system having more than or equal to 80% usage

Something like that?

bdf /tmp/
Filesystem kbytes used avail %used Mounted on
/dev/vg00/lvol4 524288 215128 306848 41% /tmp


bdf /tmp/ | awk '/\//{print $5}'
41%


regards,
ivan
Durvesh Mendhekar
Regular Advisor

Re: Want to determin the file system having more than or equal to 80% usage

hi,

Thanks for the reply.
Is there any way rather using script.
Can i determine it by using the command like bdf and using any option with it.

Regards,
Durvesh
OFC_EDM
Respected Contributor

Re: Want to determin the file system having more than or equal to 80% usage

I attached a script I wrote called "dut" which i put in my path.

It uses the df -k command and was written on Tru64. May work on HP-UX.

Basically it displays mount points exceeding a threshold I control in the script. The DEFAULT is 85.

You can also manually assign a threshold when you run from prompt:

# dut 74

This would report any mount points exceeding 74%.

Cheers

(rename the script from dut.ksh to dut so it's easier to type at prompt)
The Devil is in the detail.
Ivan Krastev
Honored Contributor

Re: Want to determin the file system having more than or equal to 80% usage

There is no such feature in bdf - see the manual http://docs.hp.com/en/B3921-90010/bdf.1M.html

Tou should use a script to calculate that.

regards,
ivan
OFC_EDM
Respected Contributor

Re: Want to determin the file system having more than or equal to 80% usage

I just looked at the script after I posted it and an extra character seems to have found it's way in.

The first line looks like
#!/usr/bin/ksh#

it should be
#!/usr/bin/ksh

Cheers
The Devil is in the detail.
OFC_EDM
Respected Contributor

Re: Want to determin the file system having more than or equal to 80% usage

You may have to change the path to certain executables in the script.

Use the "which" command on your system to find out where they are.

such as
which awk
which grep


etc etc

The Devil is in the detail.
jenith christopher
Occasional Advisor

Re: Want to determin the file system having more than or equal to 80% usage

Hi,

This is the single line help you to get equal or more than 80%

#bdf | awk '{print $6,$5}' | awk '$2 >= 80'



REGARDS,
Jenith Christopher
Suraj K Sankari
Honored Contributor

Re: Want to determin the file system having more than or equal to 80% usage

Hi,

Please download this file (bdfmesg) from below link you will find this is a great tool written by Mr.Bill Hassell.

http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=1291639

Just give

#bdfmesg -P 80 ##to find all file system which is using 80 or more then 80

Like so many output you can take from bdfmesg

Many Thanks to Mr.Bill Hassell to create a nice and useful tool.

Suraj
VK2COT
Honored Contributor

Re: Want to determin the file system having more than or equal to 80% usage

Hello,

Others gave you lot of useful choices.

One more (an example when you want to look
for file systems that used more than 80% os
space:

# bdf -k | sed -e 's/%//g' | awk '$5 >= 80'

But be warned, such simple one-lineRs can
fail if the names of logical volumes (LVM)
or plexes (VxVM) are longer and wrap into
second line. In that case, you need a
smarter solution (see references in previous posts in the Forum).

Cheers,

VK2COT (amateur radio and Morse code
instructor since 1971)

VK2COT - Dusan Baljevic
James R. Ferguson
Acclaimed Contributor

Re: Want to determin the file system having more than or equal to 80% usage

Hi:

Everytime you see a pipe ('|') a new process is spawned. THe 'awk' utility as the ability to match regular expressions and to perform substitutions without resorting to pipes with 'grep' and 'sed'. For instance:

# bdf|awk '{sub("%","",$(NF-1));if ($(NF-1)>80) {print}}'

Regards!

...JRF...
OFC_EDM
Respected Contributor

Re: Want to determin the file system having more than or equal to 80% usage

James thanks for that last statement. My dut script is, I admit, very old.

I modified your statement to add the % back in for the print. As well as formatted it a bit so the output is easier to read.

df -k |awk '{sub("%","",$(NF-1));if ($(NF-1)>80) {printf "%-25s %-12s %-12s %-12s %-12s %s \n", $1, $2, $3, $4, $5, $6}}'

Cheers
The Devil is in the detail.
Durvesh Mendhekar
Regular Advisor

Re: Want to determin the file system having more than or equal to 80% usage

Hi,

Thank u all.

Regards,
Durvesh