WAS v8.5 > Script the application serving environment (wsadmin) > Use the wsadmin scripting AdminControl object for scripted administration

Modify attributes on running objects using wsadmin.sh

Use scripting and wsadmin to modify attributes on running objects.

Before starting this task, wsadmin must be running. See the topic on starting the wsadmin scripting client. We can run a script that modifies attributes on running objects.

  1. Obtain the name of the running object.

    Run the completeObjectName command with the name parameter.

    • Jacl:

        $AdminControl completeObjectName name
    • Jython:

        AdminControl.completeObjectName(name)

    AdminControl completeObjectName command description. Run the completeObjectName command from a wsadmin command line.

    Element Description
    $ is a Jacl operator for substituting a variable name with its value
    AdminControl is an object that enables the manipulation of MBeans that run in a WebSphere Application Server process
    completeObjectName is an AdminControl command
    name is a fragment of the object name used to find the matching object name. For example: type=TraceService,node=mynode,*. This value can be any valid combination of domain and key properties, for example, type, name, cell, node, process, and so on.

  2. Set the ts1 variable to the running object.

    The following scripts set the ts1 variable to the result of the completeObjectName commands.

    • Jacl:

        set ts1 [$AdminControl completeObjectName name]
    • Jython:

        ts1 = AdminControl.completeObjectName(name)

  3. Modify the running object.

    The following scripts use the setAttribute command to set the ts1 variable ring buffer size to 10.

    • Jacl:

        $AdminControl setAttribute $ts1 ringBufferSize 10
    • Jython:

        AdminControl.setAttribute(ts1, 'ringBufferSize', 10)

    We can also modify multiple attribute name and value pairs, for example:

    • Jacl:

      set ts1 [$AdminControl completeObjectName type=TraceService,process=server1,*]
      $AdminControl setAttributes $ts1 {{ringBufferSize 10}
       {traceSpecification com.ibm.*=all=disabled}}
    • Jython list:

      ts1 = AdminControl.completeObjectName('type=TraceService,process=server1,*')
      AdminControl.setAttributes(ts1, [['ringBufferSize', 10],
       ['traceSpecification',  'com.ibm.*=all=disabled']])
    • Jython string:

      ts1 =AdminControl.completeObjectName('type=TraceService,process=server1,*')
      AdminControl.setAttributes(ts1, '[[ringBufferSize 10]
       [traceSpecification  com.ibm.*=all=disabled]]')

    The new attribute values are returned to the command line.


Related


Start the wsadmin scripting client using wsadmin.sh
Turning traces on and off in servers processes using scripting
Use the wsadmin scripting AdminControl object for scripted administration
Performing operations on running objects using wsadmin.sh


Reference:

Example: Identifying running objects using wsadmin.sh
Commands for the AdminControl object using wsadmin.sh


+

Search Tips   |   Advanced Search