0

Here's the documentation: http://publib.boulder.ibm.com/infocenter/wsdoc400/v6r0/index.jsp?topic=/com.ibm.websphere.iseries.doc/info/ae/ae/tjmx_develop.html

The problem is that this doesn't work:

import javax.management.ObjectName as ObjectName

...
theNodeAgentName = "WebSphere:type=NodeAgent,node='app_node2',*"
test_node_name = adminClient.queryNames(ObjectName(theNodeAgentName), None)
print test_node_name
adminClient.addNotificationListener(ObjectName(theNodeAgentName),listener,None,None)

The adminClient instance can never find the node agent Mbean. Any ideas?

output:

[WebSphere:name=NodeAgent,process=nodeagent,platform=common,node=app_node2,diagnosticProvider=true,version=8.5.5.3,type=NodeAgent,mbeanIdentifier=NodeAgent,cell=my_cell,spec=1.0]

javax.management.InstanceNotFoundException: javax.management.InstanceNotFoundException: Could not find WebSphere:type=NodeAgent,node='app_node2',*

the_marcelo_r
  • 1,847
  • 22
  • 35

2 Answers2

1

Using JMX notifications in pure wsadmin requires a bit of Jython hacking. You can find some inspiration (solution?) in WDR library (https://github.com/WDR/WDR/). A working example making use of WDR is documented here: http://wdr.github.io/WDR/reference/wdr.control.MBean.class.html.

Marcin Płonka
  • 2,840
  • 1
  • 17
  • 17
0

I found out what was wrong with the script (it was a pythonistic mistake: "adminClient.queryNames" returns a list!), I was passing a list to the first parameter of the "addNotificationListener" function, the trick is to queryNames and get the first element in the list, e.g.:

the_node_agent_name = "WebSphere:type=NodeAgent,node=app_node2,*"
query_name = ObjectName(the_node_agent_name)
node_agent_names = adminClient.queryNames(query_name, None)
node_agent = ObjectName(str(node_agent_names[0]))
print node_agent    
adminClient.addNotificationListener(node_agent,listener,None,None)
the_marcelo_r
  • 1,847
  • 22
  • 35