+

Search Tips   |   Advanced Search

Use wsadmin to start and stop Tivoli Performance Viewer logging

Tivoli Performance Viewer can store real-time data for system resources, WebSphere Application Server pools and queues, application-related statistics, and others in log files for later retrieval. The wsadmin tool helps you start and stop logging using the command line. We can use the command line to start and stop Tivoli Performance Viewer logging.

The following task assumes that you are using Jython script.

  1. Start the wsadmin scripting tool.

      wpsadmin.sh -jython

  2. Import the UserPreferences and jarray.

      import com.ibm.ws.tpv.engine.UserPreferences
      import jarray

  3. Identify the server where we want logging to be started, and assign it to the following variable tpvOName:

  4. Create a UserPreferences object.

      pref = com.ibm.ws.tpv.engine.UserPreferences()
      pref.setServerName("server1")
      pref.setNodeName("mynode")
      pref.setLogFileName("tpv_log_1")
      pref.setUserId("user")

  5. Create the necessary arguments and invoke monitorServer action on the TPV MBean.

      list_p = java.util.ArrayList()
      list_p.add(pref)
      params=jarray.array(list_p,java.lang.Object)
      list_s = java.util.ArrayList()
      list_s.add("com.ibm.ws.tpv.engine.UserPreferences")
      sigs = jarray.array(list_s,java.lang.String)
      print "--- TPV Calling monitorServer ---"
    • AdminControl.invoke_jmx(tpvOName, "monitorServer", params, sigs )

  6. When to start logging, call the following operation:

      print "--- TPV Calling startLogging ---"
    • AdminControl.invoke_jmx(tpvOName, "startLogging", params, sigs )

  7. When to stop logging , call the following operation:

      print "--- TPV : Now Stop Logging ---"
    • AdminControl.invoke_jmx(tpvOName, "stopLogging", params, sigs )


What to do next

By default, the log files are stored on the node on which the server is running in...

TPV automatically compresses the log file when it finishes writing to it to conserve space. At this point, there must only be a single log file in each .zip file and it must have the same name as the .zip file.

To view the log files, click...

...and choose your file using one of the following methods...


Gotcha

Note that a NullPointerException has been known to occur when using UserPreferences. When the TPV logging is started simultaneously for two different servers on the same node agent, the common code was overwritten by both threads separately, causing one thread to lose data to the other. See PI703346.


Related tasks

Use the wsadmin scripting AdminConfig object for scripted administration
  • Logging performance data with Tivoli Performance Viewer
  • Monitor performance with Tivoli Performance Viewer
  • Node administration scripts
  • Commands for the AdminConfig object