sar -v -2 29|awk '($8 ~ /[0-9][0-9]*\/[0-9][0-9]/)
I don't understand fully your requirement about the filename and the 30 minutes, but I assume that this should be handled by the script started by cron.
Main Topics
Browse All Topics
Hi
Our B11.11 PA-RISC (with 4GB RAM) limits for nfile and ninode (& possibly nproc)
have been hit lately, so we have just increased them and would like a script to monitor
if these new values' are being eaten up by runaway processes as sar below shows:
10:04:37 text-sz ov proc-sz ov inod-sz ov file-sz ov
10:04:57 N/A N/A 577/1620 0 1867/1988 0 3315/3339 0
10:05:02 N/A N/A 578/1620 0 1869/1988 0 3323/3339 22
So in above's readings, 3315 and 3323 are dangerous levels which could
have hit nfile limit of 3339 that resulted in our users unable to retrieve data
(users use IE to access a Wintel webserver and this webserver retrieves
data from our HP-UX Oracle Filenet server)
So I'll need a script that will email/alert me if it utilization exceeds 65% of current limits.
The Shell script will do the following (this script will run every minute from cron) :
sar -v 2 29
(every 2 sec for 29 times, did not want to do 30 times to prevent race condition ie
before next script starts)
if utilized value exceeds 65% for each of the nfile, ninode, nproc, email me to alert
Hope it will not chew a lot of CPU resource for running sar so frequently
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
sar -v -2 29|awk '($8 ~ /[0-9][0-9]*\/[0-9][0-9]/)
I don't understand fully your requirement about the filename and the 30 minutes, but I assume that this should be handled by the script started by cron.
Hi,
Got the following error when executed the "sar" line provided :
sar: illegal option -- 2
usage: sar [-ubdycwaqvmAMPS][-o file] [-p psetid] t [n]
sar [-ubdycwaqvmAMPS][-s hh:mm][-e hh:mm][-i ss][-p psetid][-f file]
What I meant earlier is to ensure I don't keep getting emails too frequently when the
threshold is exceeded, so if it's exceeded for 2 hrs, just get 4 email alerts, instead of
every few seconds or minutes
Business Accounts
Answer for Membership
by: sunhuxPosted on 2009-05-22 at 20:36:28ID: 24456614
Btw, the script needs to have condition such that if it has alerted me via email, it should wait
30 minutes before it next alert me so that I don't get too many emails.
But when it exceeded 65%, would like it to continue to log the sar output with time+date
stamp into a file.
Btw, I'll only need to monitor nproc and nfile (leave out the ninode) :
10:05:02 N/A N/A 578/1620 0 1869/1988 0 3323/3339 22
^ ^