developer1
Contributor
Contributor

Probably simple, How do I autodiscover MBeans?

Jump to solution

Hello everybody,

I am using hyperic-HQ version 4.6.6.

I just started trying to get hyperic working at my place of business and am having issues with JMX/MBean autodiscovery.  Our environement has java processes that run and have @ManagedResource / @ManagedOperation annotated spring beans for some of our methods and the like.  After starting up my hq-agent on the deployed VM that is running these processes I See:


s
erverName - Solaris 10
modifiedserver set changed
   serverNameNTP 4.x/usr/lib/inet/xntpdnewN/A
   serverNameSendmail 8.x/usr/sbin/sendmailnewN/A
   serverNameHQ Agent 4.6.6/export/home/deploy/hyperic-hq-agent-4.6.6newN/A

in the autodiscovery section (where sever name is our actual server name).  When I add this to my inventory, I see the following resources:

CPU, File Server, Network Server, NFS Mount, sshd process.

Nothing having to do with java, java processes, JMX or MBeans.

I have been working off of this documentation:

http://support.hyperic.com/display/DOCS46/Java+Applications

According to that documentation:

Applications using Spring 3.0 JMX Annotations

If your applications expose MBeans using the Spring 3.0 JMX annotations (@ManagedResource, @ManagedMetric, @ManagedAttribute, @ManagedOperation), they should automatically be exported with the required descriptors.

What am I doing wrong for these to not show up?  Is there a flag I need to set in one of the properties files to turn on java/mbean autodiscovery, or is there something else I need to be doing?  JMX is configureed for the running processes by Spring (not directly with -Dsun.remote..... command line args).

There are no errors in my agent.log, and it shows this block for discovery:

28-06-2012 16:15:21,569 CDT INFO  [Thread-4] [RuntimeAutodiscoverer@266] Running runtime autodiscovery for ProcessServer
28-06-2012 16:15:21,588 CDT INFO  [Thread-4] [RuntimeAutodiscoverer@275] ProcessServer discovery took 0.01
28-06-2012 16:15:21,588 CDT INFO  [Thread-4] [RuntimeAutodiscoverer@266] Running runtime autodiscovery for NetworkServer
28-06-2012 16:15:21,594 CDT INFO  [Thread-4] [RuntimeAutodiscoverer@275] NetworkServer discovery took 0
28-06-2012 16:15:21,595 CDT INFO  [Thread-4] [RuntimeAutodiscoverer@266] Running runtime autodiscovery for Net Services
28-06-2012 16:15:21,603 CDT INFO  [Thread-4] [RuntimeAutodiscoverer@275] Net Services discovery took 0
28-06-2012 16:15:21,603 CDT INFO  [Thread-4] [RuntimeAutodiscoverer@266] Running runtime autodiscovery for FileServer
28-06-2012 16:15:21,609 CDT INFO  [Thread-4] [RuntimeAutodiscoverer@275] FileServer discovery took 0

Any help would be greatly appreciated, this is really the main use case we are trying to get this up and running for.

Also, just re-checked agent.log and found this guy:

org.hyperic.hq.agent.AgentRemoteException: Failed to unschedule metrics for entity 2:10002: No measurement schedule for: 2:10002

        at org.hyperic.hq.measurement.agent.server.MeasurementCommandsService.unscheduleMeasurements(MeasurementCommandsService.java:433)

        at org.hyperic.hq.measurement.agent.server.MeasurementCommandsServer.dispatchCommand(MeasurementCommandsServer.java:167)

        at org.hyperic.hq.agent.server.CommandDispatcher.processRequest(CommandDispatcher.java:113)

        at org.hyperic.hq.agent.server.CommandListener.handleConn(CommandListener.java:216)

        at org.hyperic.hq.agent.server.CommandListener.access$100(CommandListener.java:57)

        at org.hyperic.hq.agent.server.CommandListener$AgentDispatchTask.run(CommandListener.java:200)

        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

        at java.lang.Thread.run(Thread.java:619)

not sure if that matters, but I don't expect it should.  Everything is normal in the logs after that entry.

Message was edited by: developer1  Fixed capatalization error

0 Kudos
1 Solution

Accepted Solutions
excowboy
Virtuoso
Virtuoso

Hi,

I would not recommended modifying the existing plugin. What you need to do is click on on of your platforms, choose "New Server" from the drop-down menu and choose "Sun JVM 1.5". After you have created the server, you will have to go through the "Configuration Properties" page and configure JMX URL etc.

Cheers,

Mirko

View solution in original post

0 Kudos
3 Replies
excowboy
Virtuoso
Virtuoso

Hi,

if I remember correctly the plugin is not enabled for autodiscovery per default. That means you would have to manually deploy the Java/JMX plugin and it should then autodiscover  MBeans.

Cheers,

Mirko

developer1
Contributor
Contributor

Mirko Pluhar wrote:

Hi,

if I remember correctly the plugin is not enabled for autodiscovery per default. That means you would have to manually deploy the Java/JMX plugin and it should then autodiscover  MBeans.

Cheers,

Mirko

Thank you for the response.

I am working on trying to do this but I am not sure how to verify that I am deploying the plugin.

In my agenthome/bundles/agent-4.6.6/pdk/plugins directory I have the file: jmx-plugin.xml with the contents attached.

I also have sun-jvm-service.xml which is attached just in case it matters.  I was under the impression that if there was an xml descriptor for the plugin present in this directory then the plugin is installed.

When I run :   java -jar /export/home/deploy/hyperic-hq-agent-4.6.6/bundles/agent-4.6.6/pdk/lib/hq-pdk-4.6.6.jar -m discover the only thing I see that relates to jmx and rmi is:  I notice that I show port 6969 in this log.  Is that the port for jmx that was found or is that the port that is configured?  In my xml I set to port 12003 which is where the MBean server should be, but this information is showing 6969 with user system.  Maybe I have the wrong config file?

EBUG [Thread-1] [NullScan] Running AutoServerDetector for: Spring Application
1 servers detected
Server: localhost price-endpoint Spring Application [price-endpoint]
AIID.....localhost price-endpoint Spring Application
config...
product..ptql=State.Name.eq=java,Args.*.ct=spring.managed.application.name,jmx.username=system,jmx.url=service:jmx:rmi:///jndi/rmi://localhost:6969/jmxrmi,
metric...
control..null
ERROR [main] [PluginDiscoverer] Spring Application Solaris-->org.hyperic.hq.product.PluginException: Failed to retrieve RMIServer stub: javax.naming.ServiceUnavailableException [Root exception is java.rmi.Con
nectException: Connection refused to host: localhost; nested exception is:
        java.net.ConnectException: Connection refused]
org.hyperic.hq.product.PluginException: Failed to retrieve RMIServer stub: javax.naming.ServiceUnavailableException [Root exception is java.rmi.ConnectException: Connection refused to host: localhost; nested
exception is:
        java.net.ConnectException: Connection refused]
        at org.hyperic.hq.product.jmx.MxServerDetector.discoverServiceTypes(MxServerDetector.java:589)
        at org.hyperic.hq.product.ServerDetector.discoverResources(ServerDetector.java:209)
        at org.hyperic.hq.product.util.PluginDiscoverer.runtimeScan(PluginDiscoverer.java:604)
        at org.hyperic.hq.product.util.PluginDiscoverer.start(PluginDiscoverer.java:321)
        at org.hyperic.hq.product.util.PluginDumper.testDiscovery(PluginDumper.java:1153)
        at org.hyperic.hq.product.util.PluginDumper.invoke(PluginDumper.java:462)
        at org.hyperic.hq.product.util.PluginMain.main(PluginMain.java:321)

In any case, the goal here is this.  We have applicatiosn and we want to be able to call the @ManagedOperation methods and also see the @ManagedAttributes of those Resources.  We should ideally not have to tell hyperic what ObjectNames to use, it should just scan and find them.

Do you see any glaring problems with my config?

0 Kudos
excowboy
Virtuoso
Virtuoso

Hi,

I would not recommended modifying the existing plugin. What you need to do is click on on of your platforms, choose "New Server" from the drop-down menu and choose "Sun JVM 1.5". After you have created the server, you will have to go through the "Configuration Properties" page and configure JMX URL etc.

Cheers,

Mirko

0 Kudos