VMware Cloud Community
O-RzA
Contributor
Contributor

Can't see MBean in HQ UI

Hi,
I''ve been trying to create a custom plugin for my MBean and see it through the HQ UI but i cannot.

i can connect to my MBean through jconsole and see the attributes and run the operations but no luck with HQ

Here is my plugin content(Stat1, Stat1 are the attributes from my MBean)

<?xml version="1.0"?>

<plugin name="testBean" package="org.hyperic.hq.product.jmx">

<service name="HelloThere Plugin" server="Sun JVM" version="1.5">
<config>
<option name="jmx.url" description="JMX URL to MBeanServer" default="service:jmx:rmi:///jndi/rmi://localhost:9999/jmxrmi"/>
<option name="jmx.username" description="JMX username" optional="true" default=""/>
<option name="jmx.password" description="JMX password" optional="true" default="" type="secret"/>
</config>

<property name="OBJECT_NAME" value="SimpleAgent:name=hellothere"/>

<plugin type="autoinventory"/>
<plugin type="measurement" class="org.hyperic.hq.product.jmx.MxMeasurementPlugin"/>
<plugin type="control" class="org.hyperic.hq.product.jmx.MxControlPlugin"/>

<metric name="Availability"
template="${OBJECT_NAME}:Availability"
indicator="true"/>

<metric name="Used Memory"
template="${OBJECT_NAME}:Composite.Usage.used"
indicator="true"
units="B"/>

<metric name="Commited Memory"
template="${OBJECT_NAME}:Composite.Usage.committed"
indicator="true"
units="B"/>

<metric name="Status"
category="PERFORMANCE"
template="${OBJECT_NAME}:Status"
indicator="true"/>

<metric name="Status1"
template="${OBJECT_NAME}:Stat1"
indicator="true"/>

<metric name="Status2"
template="${OBJECT_NAME}:Stat2"
indicator="true"/>

<actions include="updateStats"/>

</service>
</plugin>

and when i try to run it from my agent directory with this command
java -jar pdk/lib/hq-product.jar -Dplugins.include=jmx,testBean -m discover -a metric -Dlog=debug

I get the following output
[DEBUG] ProductPluginManager - Initializing in client mode (pdk=C:\Program Files
\Hyperic HQ 3.2.3\agent-3.2.3\pdk)
[DEBUG] MIBTree - No MIBs in directory: C:\Program Files\Hyperic HQ 3.2.3\agent-
3.2.3\pdk\mibs
[INFO] ProductPluginManager - Loading plugin: system-plugin.jar
[DEBUG] SystemPlugin - sigar.mirror.procnet=null
[INFO] ProductPluginManager - Loading plugin: netservices-plugin.jar
[INFO] MeasurementPlugin - Register TCP Socket proxy for domain: socket
[INFO] MeasurementPlugin - Register HTTP proxy for domain: http
[INFO] MeasurementPlugin - Register HTTP proxy for domain: url.availability
[INFO] MeasurementPlugin - Register FTP proxy for domain: ftp
[INFO] ProductPluginManager - Loading plugin: sqlquery-plugin.jar
[DEBUG] ProductPluginManager - adding to sqlquery classpath:
[DEBUG] ProductPluginManager - d C:\Program Files\Hyperic HQ 3.2.3\agent-3.2.
3\pdk\lib\jdbc
[INFO] SQLQueryMeasurementPlugin - Registered proxy for domain: sql
[INFO] ProductPluginManager - Loading plugin: jmx-plugin.xml
[DEBUG] ProductPluginManager - adding to jmx classpath:
[DEBUG] ProductPluginManager - d C:\Program Files\Hyperic HQ 3.2.3\agent-3.2.
3\pdk\lib\mx4j
[INFO] ProductPluginManager - Loading plugin: testBean-plugin.xml
[DEBUG] ProductPluginXML - Trying data ClassLoader to load: org.hyperic.hq.produ
ct.jmx.MxControlPlugin for plugin Sun JVM 1.5 HelloThere Plugin
[DEBUG] ProductPluginXML - Unable to load org.hyperic.hq.product.jmx.MxControlPl
ugin for plugin Sun JVM 1.5 HelloThere Plugin: java.lang.ClassNotFoundException:
org.hyperic.hq.product.jmx.MxControlPlugin
[DEBUG] ProductPluginXML - Trying data ClassLoader to load: org.hyperic.hq.produ
ct.jmx.MxMeasurementPlugin for plugin Sun JVM 1.5 HelloThere Plugin
[DEBUG] ProductPluginXML - Unable to load org.hyperic.hq.product.jmx.MxMeasureme
ntPlugin for plugin Sun JVM 1.5 HelloThere Plugin: java.lang.ClassNotFoundExcept
ion: org.hyperic.hq.product.jmx.MxMeasurementPlugin
[DEBUG] PluginDiscoverer - Adding Auto Scanners=[ServerSignature {stName=Sun JVM
1.5, match=[null], exclude=[null], regMatch=[null]}]
[DEBUG] PluginDiscoverer - Adding Registry Scanners=[]
[DEBUG] AutoScan - Running AutoServerDetector for: Sun JVM 1.5
[DEBUG] WindowsRegistryScan - Windows Registry Scan starting...
[DEBUG] WindowsRegistryScan - Windows Registry Scan completed, took: 0
0 servers detected

I dunno why i get the class not found exception but even if i remove the two lines from the plugin so as to not get any exceptions i do not see the plugin in the Auto-Discovery panel in the HQ dashboard nor anywhere is. could it be working and i just dunno where to look?

Any help would be much appreciated, Thanx
0 Kudos
25 Replies
O-RzA
Contributor
Contributor

oh, and the MBean name of SimpleAgent:name=hellothere
I got that from the object name in jconsole
0 Kudos
O-RzA
Contributor
Contributor

Ok, I looked through the hq-product.jar file and there does not seem to be a jmx subdirectory under product. but in product there is a MeasurementPlugin class as well as a ControlPlugin class,
so i switched them up and the MeasurementPlugin seemd to work but not the ControlPlugin
but also if i run another plugin like the activemq-plugin.xml with the same command from the command line, it has both those lines in the plugin and i get not classnotfoundexception....
0 Kudos
O-RzA
Contributor
Contributor

I'm starting to wonder, is there a particular way a plugin needs to be deployed, all i have done is place the -plugin.xml file in the hqplugins directory under [Install Dir]\HypericHQ

and then run that line from the command prompt, is there anything else that needs to be done?
0 Kudos
O-RzA
Contributor
Contributor

Ok, so another question to add to my list

If i wanted to add this manually to HQ how would i do it.
I imagine it would be a platform service, but i am lost on what the service type would be and where i would get the name from so that the service is monitored properly.

Any help would be much appreciated, thanx

Edit: ok so i figured the service name; its the one you specify in the plugin. so in my case it would be HelloThere Plugin. Still trying to figure out the service type though.

Message was edited by: O-RzA

Message was edited by: O-RzA
0 Kudos
O-RzA
Contributor
Contributor

ok
so i have changed my plugin to the attached one
and now i am running my bean from the command line and setting the PROC_HOME_PROPERTY to hyp.proc.java.home using the following command

-> java -DPROC_HOME_PROPERTY=hyp.proc.java.home SimpleAgent

and when i run the plugin from the command line with the following command

-> C:\Program Files\Hyperic HQ Enterprise 3.2.3\agent-3.2.3-EE>java -jar pdk/lib/hq-product.jar -Dplugins.include=jmx,testBean -m discover -a metric -Dlog=debug

I get this as an output
[DEBUG] MIBTree - No MIBs in directory: C:\Program Files\Hyperic HQ Enterprise 3
.2.3\agent-3.2.3-EE\pdk\mibs
[INFO] ProductPluginManager - Loading plugin: system-plugin.jar
[DEBUG] SystemPlugin - sigar.mirror.procnet=null
[INFO] ProductPluginManager - Loading plugin: netservices-plugin.jar
[INFO] MeasurementPlugin - Register TCP Socket proxy for domain: socket
[INFO] MeasurementPlugin - Register HTTP proxy for domain: http
[INFO] MeasurementPlugin - Register HTTP proxy for domain: url.availability
[INFO] MeasurementPlugin - Register FTP proxy for domain: ftp
[INFO] ProductPluginManager - Loading plugin: sqlquery-plugin.jar
[DEBUG] ProductPluginManager - adding to sqlquery classpath:
[DEBUG] ProductPluginManager - d C:\Program Files\Hyperic HQ Enterprise 3.2.3
\agent-3.2.3-EE\pdk\lib\jdbc
[INFO] SQLQueryMeasurementPlugin - Registered proxy for domain: sql
[INFO] ProductPluginManager - Loading plugin: jmx-plugin.xml
[DEBUG] ProductPluginManager - adding to jmx classpath:
[DEBUG] ProductPluginManager - d C:\Program Files\Hyperic HQ Enterprise 3.2.3
\agent-3.2.3-EE\pdk\lib\mx4j
[INFO] ProductPluginManager - Loading plugin: testBean-plugin.xml
[DEBUG] ProductPluginManager - adding to testBean classpath:
[DEBUG] ProductPluginManager - d C:\Program Files\Hyperic HQ Enterprise 3.2.3
\agent-3.2.3-EE\pdk\lib\mx4j
[DEBUG] PluginDiscoverer - Adding Auto Scanners=[ServerSignature {stName=Sun JVM
1.5, match=[null], exclude=[null], regMatch=[null]}, ServerSignature {stName=He
lloThere Plugin 1.0, match=[null], exclude=[null], regMatch=[null]}]
[DEBUG] PluginDiscoverer - Adding Registry Scanners=[]
[DEBUG] AutoScan - Running AutoServerDetector for: Sun JVM 1.5
[DEBUG] AutoScan - Running AutoServerDetector for: HelloThere Plugin 1.0
[DEBUG] MxServerDetector - State.Name.sw=java,Args.*.sw=-Dhyp.proc.java.home= ma
tched 0 processes
[DEBUG] WindowsRegistryScan - Windows Registry Scan starting...
[DEBUG] WindowsRegistryScan - Windows Registry Scan completed, took: 0
0 servers detected

I am no longer getting any of the other errors i was before such as class not found but
problem is I am still getting 0 servers detected, any ideas?
0 Kudos
O-RzA
Contributor
Contributor

i got it working
if anyone needs the details on how exactly send me a pm
otherwise i will post-up a description when i get some free time.

still need to get it into HQ UI but now the UI won't start....

Message was edited by: O-RzA
0 Kudos
scottmf
Enthusiast
Enthusiast

This is most likely because you started your java proc with options

java -DPROC_HOME_PROPERTY=hyp.proc.java.home SimpleAgent

rather than

java -Dhyp.proc.java.home=/install/path/of/product SimpleAgent
0 Kudos
O-RzA
Contributor
Contributor

instead of setting the system property in the command line when i run the program using -Dproc.java.home=JAVA_HOME

i setting it in my bean using
System.setProperty("proc.java.home",System.getProperty("java.home"));

but now when running the same command from the command line it no longer detects my mbean, it only detects it if I use the -D option from the command line

Why is that?
0 Kudos
scottmf
Enthusiast
Enthusiast

That is because HQ is trying to detect the process signature via sigar. Adding the property inside the jvm does nothing to the proc itself.

Try this ->

java -jar /path/to/pdk/lib/sigar.jar ps State.Name.eq=java,Args.*.sw=-Djava.home

This is the actual command that the plugin is running in order to detect your process. It is the rough equivalent of "ps -ef | grep java | grep '-Djava.home'" in unix.
0 Kudos
O-RzA
Contributor
Contributor

I am not getting any result from that command, even when i put in my jre env or my java.home


so then how would I define this 'signature' if i were to run nothing from the command line?

eidt: ok so this works
sigar> ps State.Name.eq=java,Args.*.sw=SimpleAgent
but this returns nothing
sigar> ps State.Name.eq=java,Args.*.sw=-D

but since hyperic uses the -Dto get the bean, it still won't work if i put this value into the PROC_HOME_PROPERTY value...

so do you know how I can give my bean an attribute so that it can be recognize with the -D option that sigar is using if i am not running my program from the command line. or maybe something i need to change in the plugin?

Message was edited by: O-RzA

Message was edited by: O-RzA
0 Kudos
scottmf
Enthusiast
Enthusiast

There must be some process that serves this request on a platform. The agent should then run on this platform and discover the associated java process. There are other ways to accomplish this but using the MxServerDetector limits your possibilities. This methodology works for pretty much every jmx plugin we currently distribute.

If you'd rather not use the PROC_HOME_PROPERTY (with the -D stuff) you can use the PROC_MAIN_CLASS (see plugin docs) instead to accomplish what you want. The sigar query for this is "ps State.Name.eq=java,Args.*.eq=SimpleAgent"

The disadvantage of this is that your installpath may not be correct which limits log tracking and control actions. You can make sure it is correct by either using the PROC_HOME_ENV (see docs) or making sure the path that you are running java from matches the installpath for the product.
0 Kudos
O-RzA
Contributor
Contributor

Ok so this is the situation;
I am running my MBean from inside a c++ based program, that is creating its own JVM. And the MBean application is being run in there
So the sigar command State.Name.eq=java,Args.*.sw=-D<value of proc main class>. Is not applicable because a separate java application is not being run.
I can only see it using this command State.Name.eq=”bean app name”
Is there some sort of work around for this to get Hyperic to see my bean or do you not support this method of launching an java app within a jvm from a c++ environment.

Let me know if I did not explain myself clearly enough.
0 Kudos
scottmf
Enthusiast
Enthusiast

ok, another option for pre-written classes is to use the DaemonDetector. See the tutorial for script plugins to get more info on this. It is not limited to java procs.
0 Kudos
O-RzA
Contributor
Contributor

If i use the script to get the attributes from my MBean
can I use control actions on a script based plugin as well?
0 Kudos
scottmf
Enthusiast
Enthusiast

0 Kudos
O-RzA
Contributor
Contributor

what does this mean

The configuration has not been set for this resource due to : Unable to modify config track config: Agent error: Event Log 'C:\ISMonitorLog.txt' does not exist

because the file does exist and is at that location
does the log file have to be in a specific location or do i have to set the path relative to the agent?
0 Kudos
scottmf
Enthusiast
Enthusiast

What exactly is the plugin trying to do? Is it log tracking or config tracking?

Could it be a permissions or case thing?
0 Kudos
O-RzA
Contributor
Contributor

well i need to do log tracking and the instructions described here
http://support.hyperic.com/confluence/display/DOC/ui-Inventory.Configuration#ui-Inventory.Configurat...
don't seem to be valid because i do not have the fields from step 3,4, and 5 in the configuration properties screen for the platform.

as far as permissions, the file is accessible and both read and write are allowed.

do the logs have to be in a specific location for hyperic to look them up

Message was edited by: O-RzA
0 Kudos
scottmf
Enthusiast
Enthusiast

These docs are for setting up the log tracking once your plugin supports it. There is probably something wrong with your descriptor. Could you attach it?

Logs can be anywhere, not sure why it says that file C:\ISMonitorLog.txt doesn't exist if it is actually there. That seems like an odd place for a log file to be in the parent dir of your C: . maybe it is something with the installpath? I need to see your hq-plugin.xml descriptor to have a better idea of what is happening.
0 Kudos