VMware Cloud Community
murugurams
Contributor
Contributor

Problem in JMX custom plugin

Hi,
i created a jmx custom plugin to measure my application response time related performance. i deployed that plugins in both agent and server locations.

I am able to see the deployed server in Resources page.
While configuring properties for that services i am getting CommunicationException

Stack Trace
The configuration has not been set for this resource due to : Invalid configuration: Error contacting resource: Can't connect to MBeanServer [{jmx.url=service:jmx:rmi:///jndi/rmi://localhost:2098/jmxrmi}]: java.io.IOException: Failed to retrieve RMIServer stub: javax.naming.CommunicationException [Root exception is java.rmi.NoSuchObjectException: no such object in table]

My MBean class looks like this

try
{
mbs = ManagementFactory.getPlatformMBeanServer();
name = new ObjectName("Application Performance Monitoring:service=Response Time");
mbean =new ResponseTime();
mbs.registerMBean(mbean, name);
JMXServiceURL url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:2098/jmxrmi");
JMXConnectorServer cs = JMXConnectorServerFactory.newJMXConnectorServer(url, null, mbs);
mbs.addNotificationListener(name, listener, null, name);
}
catch(Exception e)
{}

my plugin xml config file as follows :

<plugin name="ResponseTime">

<classpath>
<include name="pdk/lib/mx4j"/>
</classpath>

<server name="Java" version="1.5">

<service name="ResponseTime Service" >

<property name="OBJECT_NAME"
value="Application Performance:type=ResponseTime"/>

<property name="AUTOINVENTORY_NAME"
value="%platform.name% Applicaton Response Time"/>

<plugin type="autoinventory"/>

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

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

<!-- reset is an MBean operation, set* are attribute setters -->
<actions include="ShowResponseTimeSummary"/>

<properties>
<property name="ResponseTime" description="ResponseTime"/>
<property name="Max" description="Maximum Response Time"/>
<property name="Min" description="Minimum Response Time"/>
</properties>

<config>
<option name="jmx.url" description="JMX URL to MBeanServer" default="service:jmx:rmi:///jndi/rmi://localhost:2098/jmxrmi"/>
<option name="jmx.username" description="JMX username" optional="true" default=""/>
<option name="jmx.password" description="JMX password" optional="true" default="" type="secret"/>
<option name="process.query" description="PTQL for Java Process" default="State.Name.eq=java,Args.*.ct=proc.java.home"/>
</config>

<!-- derive installpath from JAVA_HOME env prop... -->
<property name="PROC_HOME_ENV" value="JAVA_HOME"/>

<!-- derive installpath from -Dproc.java.home=... -->
<property name="PROC_HOME_PROPERTY" value="proc.java.home"/>
<plugin type="autoinventory" class="org.hyperic.hq.product.jmx.MxServerDetector"/>
<plugin type="measurement" class="org.hyperic.hq.product.jmx.MxMeasurementPlugin"/>


<filter name="template"
value="${OBJECT_NAME}:${alias}"/>

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

<metric name="ResponseTime"
alias="ResponseTime"
collectionType="trendsup"
indicator="true"/>

<metric name="Min"
alias="Min"
collectionType="trendsup"
indicator="true"/>

<metric name="Max"
alias="Max"
collectionType="trendsup"
indicator="true"/>
</service>
</server>

</plugin>

the given port(2098) is HQ server RMI Port
Please correct me if i am doing anything wrong

Regards
Ram
0 Kudos
0 Replies