Operating System - HP-UX
1757233 Members
2759 Online
108859 Solutions
New Discussion юеВ

Shell script to write to trace inode

 
SOLVED
Go to solution
Vishu
Trusted Contributor

Shell script to write to trace inode

Hi,

I have HP-UX 11.00. Please help in making a shell script, which i can place in crontab, by which if the inode size increases a certain limit i.e. 80%, we get an email for that. our hfs file system is /advance/dir. Also, plz tell if 'bdf -i' or 'sar -v' will help.

sorrow $ bdf -i /advance/dir
Filesystem kbytes used avail %used iused ifree %iuse Mounted on
/dev/vg05/lvol4 134256 4344 129912 3% 275 511725 0% /advance/dir


Thanks
8 REPLIES 8
James R. Ferguson
Acclaimed Contributor
Solution

Re: Shell script to write to trace inode

Hi Vishu:

Unlesss this filesystem is an HFS one, you don't need to worry about the number or utilization of inodes. For VxFS filesystems, new inodes will be added dynamically as needed.

Regards!

...JRF...
Vishu
Trusted Contributor

Re: Shell script to write to trace inode

Hi James,

Thanks for the reply. But my FS is HFS. i recently got one error in syslog saying "inode table is full". i just want to write a script which mails me whenever inodes go beyond a certain limit.

James R. Ferguson
Acclaimed Contributor

Re: Shell script to write to trace inode

Hi (again) Vishu:

> i recently got one error in syslog saying "inode table is full".

Then you need to increase the kernel's 'ninode' parameter. See:

http://docs.hp.com/en/7779/commonMisconfig.pdf

Regards!

...JRF...
Vishu
Trusted Contributor

Re: Shell script to write to trace inode

agreed James,

I already did that. But i wanted to further place a monitoring for other servers also, to trace the inode utilization. If you can help in it, that would be highly appreciable.

Thanks
James R. Ferguson
Acclaimed Contributor

Re: Shell script to write to trace inode

Hi Vishu:

Hi (again):

Monitoring the filesystem's inode utiliztion is not going to track the kernel's high water mark for open inodes. You can monitor the later with 'sar -v'. Try this:

#!/usr/bin/sh
VAL=$(sar -v 1 1|tail -1|awk 'END{split(NODE,a,"/");printf "%d\n",a[1]/a[2]*100};{NODE=$6}')
[ "${VAL}" -gt 80 ] && mailx -s "Inode Util at ${VAL}" root < /dev/null

Regards!

...JRF...
Vishu
Trusted Contributor

Re: Shell script to write to trace inode

Thanks James,

this is what i was looking for. Full points to you. Can you also give me the link to know the basic of scripting.

Thanks
James R. Ferguson
Acclaimed Contributor

Re: Shell script to write to trace inode

Hi Vishu:

> Can you also give me the link to know the basic of scripting.

There are many, many good books on this subject. I urge you to use the HP-UX Posix shell ('sh' in HP-UX) or the Korn ('ksh') shell. Linux users like to port Bash ('bash') to HP-UX and it is close but has its own idiosyncrasies. Whatever you do, do not use the brain-dead 'csh' (C-shell).

A useful overview is this:

http://www.docs.hp.com/en/B2355-90046/index.html

Don't forget the 'sh-posix' manpages:

http://www.docs.hp.com/en/B2355-60130/sh-posix.1.html

...and have a tour at this excellent site:

http://www.shelldorado.com/

Regards!

...JRF...
Steven E. Protter
Exalted Contributor

Re: Shell script to write to trace inode

Shalom,

A few book recommendations:

Posix Shell Scripting (to solve problems)
http://www.amazon.com/Shell-Scripting-Recipes-Problem-Solution-Approach/dp/1590594711/ref=sr_1_1?ie=UTF8&s=books&qid=1246410995&sr=8-1

Classic Shell Scripting
http://www.amazon.com/Classic-Shell-Scripting-Arnold-Robbins/dp/0596005954/ref=sr_1_3?ie=UTF8&s=books&qid=1246410995&sr=8-3

http://www.amazon.com/Mastering-Unix-Shell-Scripting-Administrators/dp/0470183012/ref=sr_1_4?ie=UTF8&s=books&qid=1246410995&sr=8-4

You will like them, in addition to the goodness that can be found at http://docs.hp.com

Good Luck.

Interesting thread.

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