This should be easy, but I'm having problems writing a custom plugin to create a new service that displays metrics about my application running in tomcat server. I have tested my MBean against jconole and it's fine.
Plugin looks something like this:
<plugin name="Obsidian">
<!--<property name="PLUGIN_VERSION" value="1.0"/>-->
<service name="Obsidian-Midtier">
<!-- the Obsidian MBean objectname -->
<property name="OBJECT_NAME" value="com.sas.obsidian:service=Signature,name=QueryStatistics"/>
<!-- autodiscover -->
<plugin type="autoinventory"/>
<!-- list measurements to include -->
<plugin type="measurement" class="org.hyperic.hq.product.jmx.MxMeasurementPlugin"/>
<filter name="template" value="${OBJECT_NAME}:${alias}"/>
<metric name="Event Rate" alias="EventRate" indicator="true"/>
<metric name="Event Rate Sampling Size" alias="EventRateSampleSize" indicator="true"/>
<metric name="Event Query Count" alias="EventQueryCount" indicator="true"/>
<!-- list operations -->
<plugin type="control" class="org.hyperic.hq.product.jmx.MxControlPlugin"/>
<actions include="setEventRateSampleSize,getEventQueryCount,getVisitorQueryCount,getVisitorQueryCountByEvent"/>
</service>
</plugin>
How can I get my service to be auto-discovered? Do I need to associate it with a server? Or will it just search all servers?
Any help is greatly appreciated.
I would love to see some errors or something stating that I have something wrong. How can I test my plugin for errors? When I run hq-pdk.jar -p obsidian -m discover, I just get "0 servers detected". No errors.
Thanks.
I found that if I name my mbean object by a certain convention:
spring.application:application=optional,type=required,name=required
then my service metrics and controls show up without even having to deploy a plugin.
Why?
I want to my company domain in place of spring.application.
I think a plugin would work so that I don't have to conform to this naming convention.
I would like to create a plugin that auto-discovers mbeans of a certain domain and type and
adds them to a service.
Why is this so hard? Conceptually, it seems easy. Can anyone help?
Thanks.
Hi saspad,
To get auto-discovery you need to define a "server".
Try with this xml
You can test the plugin with this command:
java -jar ../lib/hq-pdk-4.6.6.jar -p obsidian -Dplugins.include=obsidian -Dlog=debug -m discover -a metric
If you have problems, send me the full command outup.