- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- How to monitor if my NPROC has been undersized in ...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-08-2007 12:20 AM
тАО10-08-2007 12:20 AM
I need to monitor the system (RHEL4-U5) so as to determine if the NPROC for the oracle user has been properly set.
In fact, I will need to gather resource usage data and plot a graph on its utilisation over a period of time. What is the best way to do so?
[root@server home]# grep -i nproc /etc/security/limits.conf
# - nproc - max number of processes
#@student hard nproc 20
#@faculty soft nproc 20
#@faculty hard nproc 50
#ftp hard nproc 0
oracle soft nproc 2047
oracle hard nproc 16384
[root@server home]#
Thanking you in advance for replies.
kind regards,
yogeeraj
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-08-2007 10:20 AM
тАО10-08-2007 10:20 AM
Re: How to monitor if my NPROC has been undersized in the /etc/security/limits.conf
http://oss.oetiker.ch/mrtg/doc/mrtg-reference.en.html
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-08-2007 11:43 AM
тАО10-08-2007 11:43 AM
Re: How to monitor if my NPROC has been undersized in the /etc/security/limits.conf
So, if you wanted to check all of the users defined in the limits.conf file;
I wrote the following script as a starting point. Here's an example run of user "john" running 2 processes and user "squid" running nothing:
> /tmp/get_procs
john:
hard 20
soft 10
actv 2
squid:
hard 18
soft 10
actv 0
If you want single line output:
> /tmp/get_procs -l
john: hard 20 soft 10 actv 2
squid: hard 18 soft 10 actv 0
If you want the above data usable for graphing in an Excel or Open Office spreadsheet, just put in "|" pipe delimiters, or "," commas (your preference) in the output instead of " " spaces.
Then, just put it in a cron job, accumulating the data into a file somewhere of your choosing. Of course, you'd need to log rotating tool to clean it up every day (See the HPUX Porting Archives).
The script has a dependency that you are consistent in the order of putting in soft and hard limits. Also, it doesn't work for the "grouping" function of the security file, because in your example, it looked like your just interested in user "oracle" at the time.
Here's whats in my security file:
john hard nproc 20
john soft nproc 10
squid hard nproc 18
squid soft nproc 10
Here's the bash script:
It's a bit klunky at points, and could be cleaned up, but it's what I could do in a hurry.
-----------------------------------------
#!/bin/bash
#
# get_procs - gets process info about items secured by /etc/security/limits.conf
#
# Args: if a "-l" is passed as the first argument, it returns a single line
# display per user defined in security file.
ONELINE=FALSE
if [ $# -gt 0 ]; then
if [ $1 = "-l" ]; then
ONELINE=TRUE
fi
fi
get_procs() {
if [ $ONELINE = "FALSE" ]; then
for i in `grep -v "^#" /etc/security/limits.conf | cut -d " " -f 1| sort | uniq`
do
echo $i:
cat /etc/security/limits.conf | grep "^${i}" | awk '{ print " "$2" "$4}'
echo " "actv `ps -eo user | grep $i| wc -l`
done
else
TMPFILE=/var/tmp/get_procs.$$
if [ -f $TMPFILE ] ; then
rm -f $TMPFILE || ( echo Error deleting $TMPFILE ; exit 1)
fi
for i in `grep -v "^#" /etc/security/limits.conf | cut -d " " -f 1| sort | uniq`
do
echo $i: > $TMPFILE|| ( echo Error creating $TMPFILE ; exit 2)
grep "^${i}" /etc/security/limits.conf | awk '{ print $2" "$4}' >> $TMPFILE
echo actv `ps -eo user |grep $i | wc -l` >> $TMPFILE
set `cat $TMPFILE`
echo $1 $2 $3 $4 $5 $6 $7 $8 $9
rm -f $TMPFILE || ( echo Error deleting $TMPFILE ; exit 3)
done
fi
}
get_procs
----
Hope that helps,
John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-09-2007 02:52 AM
тАО10-09-2007 02:52 AM
Re: How to monitor if my NPROC has been undersized in the /etc/security/limits.conf
It seems that I didn't quite answer your question - What else are you looking for? Do you need help with an example scripts for comma delimited? Cron example? Let us know.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-09-2007 02:40 PM
тАО10-09-2007 02:40 PM
SolutionWhat I did note however was that there is no 'soft' nproc limit. Both 'soft' and 'hard' references are hard (well, when spawning from 'bash').
Perhaps just graphing the output of the simple command:
ps -U oracle -ocmd= | wc -l
will suffice (You can use that command with MRTG as mentioned above).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-09-2007 05:24 PM
тАО10-09-2007 05:24 PM
Re: How to monitor if my NPROC has been undersized in the /etc/security/limits.conf
Sorry for this late feedback on your replies.
Our main concern is making sure that the NPROC has been properly set. Being rather "new" to the use of Linux at the Enterprise/Production level, my knowledge of resource monitoring at the OS level is rather limited. I thought there was some utility that would easily help me collect the required data.
In fact, i am already using NMON for monitoring of the server resources.
Well, plotting of the data into a meaningful graph using a particular tool is not really of the concern here.
I think "ps -U oracle -ocmd= | wc -l" as mentioned by Stuart will do for the moment ...unless there is something better...
thanking you all for your replies and also those who had a glance at my post too.
kind regards
yogeeraj