nasdoma
Contributor
Contributor

How to monitor com.mchange.v2.c3p0:type=PooledDataSource[df0438]

Hi

I'm trying to setup monitoring of this c3p0 DB connection pool. In jconsole it shows under com.mchange.v2.c3p0:type=PooledDataSource[df0438].

Everything works fine if I put "com.mchange.v2.c3p0:type=PooledDataSource[df0438]" into the OBJECT_NAME. I can read properties with this command :

java -jar bundles/agent-4.1.2-1053/pdk/lib/hq-product.jar -p c3p0 -t "Sun JVM 1.5 c3p0" -Djmx.url=service:jmx:rmi:///jndi/rmi://localhost:6969/jmxrmi

The problem is that [df0438] gets assigned at the runtime and after restart it gets new value. I was trying to use * in the OBJECT_NAME in multiple variants but was not able to make it work. The java test command above always return :


MetricNotFoundException: ObjectName not found [com.mchange.v2.c3p0:type=]: javax.management.InstanceNotFoundException: com.mchange.v2.c3p0:type=

Any advice on how to get this working ?

Thanks


========== my plugin xml file ========

<plugin>
<service name="c3p0" server="Sun JVM" version="1.5">

<property name="OBJECT_NAME" value="com.mchange.v2.c3p0:type=*"/>
<property name="AUTOINVENTORY_NAME" value="%platform.name% c3p0 pool %type%"/>

<config>
<option name="type"
description="c3p0 instance id"
default=""/>
</config>

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

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

<metric name="Active DB connections"
template="${OBJECT_NAME}:numBusyConnections"
indicator="true"/>

<metric name="Idle DB connections"
alias="numIdleConnections"
indicator="true"/>

</service>
</plugin>
0 Kudos
0 Replies