Jython script to pull out stats from websphere

Posted By Sagar Patil

Currently I have number of websphere 6.1 instances under RHEL 5.3 but not a tool like hyperic, wily introscope to monitor them actively. I started using wsadmin scripts to pull out stats thru wsadmin.

I am basically trying to get same details thru wsadmin which I could thru NAGIOS plugin. Here is a sample output from NAGIOS.

Monitor JVM heapSize :
JVM heapsize is provided for the entire server. It is measured as: percent used/maximum configured
To Monitor, check_was -s heapsize -w 80 -c 90 -p <server name=”">
[was61@Server1 check_was-0.3]$ ./check_was -s heapsize -w 80 -c 90 -p server_member1
OK – heapsize: 1048576/2097152 (50.0%)|heapsize=50.0%;80;90;

MonitorLiveSessions :
Live session usage can be monitored for the entire server (all hosts) or with a named host. It is measured as: Number of live sessions

[was61@Server1 check_was-0.3]$ ./check_was -s sessions -w 200 -c 400 -p server_member1
OK – live sessions: total 0, default_hostCTI 0, default_hostprsysmgmt 0, default_hostprweb 0, default_hostprdbutil 0|total=0.0;200;400; default_hostcti=0.0;200;400; default_hostprsysmgmt=0.0;200;400; default_hostprweb=0.0;200;400; default_hostprdbutil=0.0;200;400;

MonitorJdbcConnectionPools:
JDBC connection pool usage can be monitored for the entire server (all connection pools) or with a named connection pool. It is measured as: percent used/maximum configured

[was61@Server1 check_was-0.3]$ ./check_was -s connectionpool -w 80 -c 90 -p server_member
OK – connection pool size: Oracle JDBC Driver 5/100 (5.0%)|oraclejdbcdriver=5.0%;80;90;

MonitorThreadPools :
Thread pool usage can be monitored for the entire server (all thread pools) or with a named thread pool. It is measured as: percent used/maximum configured

[was61@Server1 check_was-0.3]$ ./check_was -s threadpool -w 80 -c 90 -p server_member1
CRITICAL – thread pool size: WebContainer 4/100 (4.0%), SoapConnectorThreadPool 3/5 (60.0%), SIBFAPInboundThreadPool 0/50 (0.0%), HAManager.thread.pool 2/2 (100.0%), MessageListenerThreadPool 0/50 (0.0%), ORB.thread.pool 0/50 (0.0%), SIBFAPThreadPool 2/50 (4.0%), ProcessDiscovery 1/2 (50.0%), TCPChannel.DCS 3/20 (15.0%)|webcontainer=4.0%;80;90; soapconnectorthreadpool=60.0%;80;90; sibfapinboundthreadpool=0.0%;80;90; hamanager_thread_pool=100.0%;80;90; messagelistenerthreadpool=0.0%;80;90; orb_thread_pool=0.0%;80;90; sibfapthreadpool=4.0%;80;90; processdiscovery=50.0%;80;90; tcpchannel_dcs=15.0%;80;90;</server>

Attached is a python script which will return similar results
Purpose: wsadmin script used to display user specified information about
         WebSphere Application Server resources.\n
Version: %(version)s
Updated: %(updated)s\n
  Usage: %(cmdName)s [options]\n
Required switches/options:
  -i | --info       <value> = Type of information being requested
  -s | --serverName <value> = Target serverName\n
Optional switches/options:
  -n | --nodeName   <value> = Target nodeName\n
Information types/values:
  connectionpool - Display Connection Pool details
  heapsize       - Display Heap Size details
  threadpool     - Display Thread Pool details
  sessions       - Display Session Details\n
Notes:
- Long form option values may be separated/delimited from their associated
  identifier using either a space, or an equal sign ('=').\n
- Short form option values may be sepearated from their associated letter
  using an optional space.\n
- Text containing blanks must be enclosed in double quotes.\n
Examples:
  wsadmin -f %(cmdName)s.py -i heapsize -s server1 -n node01\n'''
[was61@Server1 was_scripts]$ /opt/IBM/WebSphere/AppServer/profiles/Profile01/dmgr/bin/wsadmin.sh -f /home/was61/was_scripts/check_was.py -i heapsize -s Server1  server_member2
WASX7209I: Connected to process “dmgr” on node Server1_Manager using SOAP connector;  The type of process is: DeploymentManager
WASX7303I: The following options are passed to the scripting environment and are available as arguments that are stored in the argv variable: “[-i, heapsize, -s, Server1server_member2]”
heapsize: node=Server1_Node01  server=Server1server_member2  used=1027.2 MB (65.69%)  free=536.5 MB
[was61@ was_scripts]$ /opt/IBM/WebSphere/AppServer/profiles/Profile01/dmgr/bin/wsadmin.sh -f /home/was61/was_scripts/check_was.py -i threadpool -s  server_member2
WASX7209I: Connected to process “dmgr” on node Server1_Manager using SOAP connector;  The type of process is: DeploymentManager
WASX7303I: The following options are passed to the scripting environment and are available as arguments that are stored in the argv variable: “[-i, threadpool, -s, server_member2]”
|             Low    High
|           Water  Water  Lower  Upper  Current
Name | integral  Mark   Mark   Bound  Bound  Usage    Ratio
————————+—————————————————–
Message.Listener.Pool |      0.0   10     10     10     50      0      0.00%
ORB.thread.pool |      0.0   10     10     10     50      0      0.00%
SIBFAPInboundThreadPool | 9090637.0    1      4      4     50      3     75.00%
SIBFAPThreadPool | 112975.0    1      4      4     50      2     50.00%
TCPChannel.DCS | 255726.0    1      5      5     20      3     60.00%
WebContainer | 12011409.0    1     10     10     50      7     70.00%
So here  ”WebContainer | 12011409.0   1  10  10  50   7  70.00%” means WebContainer currently using 7 processes out of 10 allocated and they can expand upto 50 MAX.

Leave a Reply

You must be logged in to post a comment.

6 Responses to “ Jython script to pull out stats from websphere ”

  1. i tried this on aix and got error.do i need to update naything

  2. I get the following error when using this on AIX

    WASX7017E: Exception received while running file “/usr/local/nagios/libexec/check-was_py”; exception information: com.ibm.bsf.BSFException: exception from Jython:
    Traceback (innermost last):
    File “”, line 544, in ?
    File “”, line 314, in main
    File “”, line 206, in heapsize
    ValueError: invalid literal for __int__: 2147483648

    Works fine on Linux servers.

  3. Thank you for this awesome script. I tried to get the heap info and worked excellent. but when i tried the same command to get connection pool and thread pool,

    I get the below error

    user@serverName:/usr/IBM/WebSphere/AppServer/profiles/DL10/bin>/usr/IBM/WebSphere/AppServer/profiles/DmgrDL10/bin/wsadmin.sh -f /usr/IBM/user/was_scripts/check_was.py -i connectionpool -s server1
    WASX7209I: Connected to process “dmgr” on node CellManagerDL10 using SOAP connector; The type of process is: DeploymentManager
    WASX7303I: The following options are passed to the scripting environment and are available as arguments that are stored in the argv variable: “[-i, connectionpool, -s, server1]”
    Not yet implemented: “connectionpool”

    Please help!!!

  4. Hi rchandran!

    I have looked at the code and like the message says only ‘heapsize’ and ‘threadpool’ have been implemented, the other two, ‘connectionpool’ and ‘sessions’ have not.

    (What this means is the current version of the program only has the code necessary to produce show the ‘heapsize’ and ‘threadpool’ information, the code necessary ‘connectionpool’ and ‘sessions’ information has not been written yet…)

    Have a nice day!

    Nick

  5. Argh, I should have re-read myself…

    The last part of my message should have read:

    (What this means is the current version of the program only has the code necessary to produce/show the ‘heapsize’ and ‘threadpool’ information, the code necessary to show the ‘connectionpool’ and ‘sessions’ information has not been written yet…)

  6. Thank you Mr Knight.
    Would you know of any script which can give me webcontainer thread information?

Top of Page

Top menu