RE: Thread Usage of a specific process

"PEOPLES, MICHAEL P (ATTSI)" <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <C038F8186F9F1E4D8F7C0FDAB3317B1205EE6AC0@misout7msgusr7c.ugd.att.com>
If there's something you didn't understand, let me know.  There are lots
of things I don't understand about SNMP, and it's frustrating when I'm
offered superficial or confusing advice.  

I'm happy to share my limited, hard-won experience with you.

As an experiment, do the following:

- Make a backup copy of your snmpd.conf file.
- Write a script that will produce the thread count for some process.
- Insert the following line into your snmpd.conf file (the script
reference is just an example):

	exec .1.3.6.1.4.1.2021.250.1.1 threadCount
/usr/local/bin/threadCount.ksh

   You should replace "/usr/local/bin/threadCount.ksh"
- Restart the snmp agent on the system
- From your monitoring system, or any other system that can make an
snmpget poll to the system, issue the following command:

	snmpget -c public -v 2c myhost.me.com
.1.3.6.1.4.1.2021.250.1.1.101.1

  In the example above, you will need to check and/or replace the
community string "public", version "2c", and host "myhost.me.com".
Let's say the process you check has 8 threads.  If you issue the command
above, this is what you would get:

UCD-SNMP::ucdavis.250.1.1.101.1 = STRING: "8"

You can parse this output or add options to the snmpget command to get
less text.  For example, if you wanted to assign the number of threads
to a particular variable at the command line, the following would do it:

threadCount=`snmpget -c public -v 2c myhost.me.com
.1.3.6.1.4.1.2021.250.1.1.101.1 | awk '{printf("%s\n", $NF)}' | sed
's/"//g'`

So, if you echoed $threadCount, the command line would display 8.

Hope that helps.

Michael Peoples
Senior Systems Manager
AT&T - ATTSI
Office:   614-789-8559
Cell:      614-886-0923
FAX:     614-789-8975
[email protected]

-----Original Message-----
From: Jatin [mailto:[email protected]] 
Sent: Tuesday, March 30, 2010 11:47 AM
To: PEOPLES, MICHAEL P (ATTSI)
Cc: Jatin Davey; Dave Shield; [email protected]
Subject: Re: Thread Usage of a specific process

Thanks Micheal , Appreciate your help.

I would not say that i understood all the things that you have 
mentioned. I will work on the things that you have mentioned and will 
probably get back to the mailing list for more help. This reply 
certainly gives me the direction in which i have move forward to achieve

what i want.

Thanks
Jatin

PEOPLES, MICHAEL P (ATTSI) wrote:
> Jatin,
>
> Consider using the SNMP agent extensions.  These extensions, amongst
> other things, allow you reference the output of a script through a
> user-defined OID.  
>
> These extensions are placed in the snmpd.conf file.  For example:
>
> extend .1.3.6.1.4.1.2021.250.1.1 httpdThreadCount
> /usr/local/bin/countHttpdThreads.ksh
>
> Then you need to write a small script to output that number.  For
> Solaris, you might issue the following:
>
> ps -efL | grep automountd | tr -s ' ' | sed 's/^ //' | cut -d' ' -f4
>
> If there were multiple automountd processes, you would have to sum the
> results.  Alternately, if you have a specific PID, then you could
> replace the above with:
>
> ps -fL -p | tr -s ' ' | sed 's/^ //' | cut -d' ' -f4
>
> No matter which approach you take, your script should print out a
single
> number.  Any program receiving it will consider that output to be a
> string, versus an integer or gauge.
>
> To get the value from the above OID, you would issue the following
> (example):
>
> snmpget -c public -v 2c myhost.me.com .1.3.6.1.4.1.2021.250.1.1.101.1
>
> Be sure to restart the agent after making the change.  Also, I found
> that the "extend" directive doesn't work on the Net-SNMP agent shipped
> with Solaris 10 (agent version 5.0.9).  You can replace "extend" with
> "exec", although the latter is being deprecated.
>
> This method is an easy way to gain SNMP access to data not supported
in
> traditional MIB's.  The down side is that unless you can figure out a
> way to mimic the table structure of a compiled MIB, every process you
> wish to monitor will require a separate OID.  You can mitigate some of
> the work by creating a script that allows you to pass a parameter to
in
> on the command line.   Example:
>
> extend .1.3.6.1.4.1.2021.250.1.1 httpdThreadCount
> /usr/local/bin/countThreads.ksh httpd
> extend .1.3.6.1.4.1.2021.250.1.2 automountdThreadCount
> /usr/local/bin/countThreads.ksh automountd
> extend .1.3.6.1.4.1.2021.250.1.3 statdThreadCount
> /usr/local/bin/countThreads.ksh statd
>
> If you walk the OID (.1.3.6.1.4.1.2021.250.1), you'll get a feel for
how
> the agent handles extensions.
>
> Good luck.
>
> Michael Peoples
> Senior Systems Manager
> AT&T - ATTSI
> Office:   614-789-8559
> Cell:      614-886-0923
> FAX:     614-789-8975
> [email protected]
> -----Original Message-----
> From: Jatin Davey [mailto:[email protected]] 
> Sent: Tuesday, March 30, 2010 3:46 AM
> To: Dave Shield
> Cc: [email protected]
> Subject: Re: Thread Usage of a specific process
>
> Thanks Dave.
>
> Thanks
> Jatin
>
> On 3/30/2010 12:39 PM, Dave Shield wrote:
>   
>> On 30 March 2010 07:45, Jatin Davey<[email protected]>  wrote:
>>    
>>     
>>> Is there a MIB parameter that i can use to monitor the "threads
>>>       
> usage"
>   
>>> by a specific process.
>>>      
>>>       
>> No
>>
>> Dave
>>
>>    
>>     
>
>
------------------------------------------------------------------------
> ------
> Download Intel&#174; Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Net-snmp-users mailing list
> [email protected]
> Please see the following page to unsubscribe or change other options:
> https://lists.sourceforge.net/lists/listinfo/net-snmp-users
>
>
------------------------------------------------------------------------
------
> Download Intel&#174; Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Net-snmp-users mailing list
> [email protected]
> Please see the following page to unsubscribe or change other options:
> https://lists.sourceforge.net/lists/listinfo/net-snmp-users
>
>   


------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.