Search code examples
tomcat7jmxzabbix

Zabbix getting info about active DB connections from tomcat datasource


I am trying to configure zabbix to obtain information from tomcat about active jdbc connections from datasource i am add this property in a different ways like:

jmx["Catalina:class=javax.sql.DataSource,name='jdbc/someDB',type=DataSource",active]

And like:

jmx[Catalina:class=javax.sql.DataSource,name="jdbc/someDB",type=DataSource,active]

And like:

jmx["Catalina:class=javax.sql.DataSource,name=\"jdbc/someDB\",type=DataSource",active]

But avery time i get "Not supported" at this item. Where do i wrong if so?

UPDATE: adding screenshot of property with jmxter Screenshot of property with jmxterm.

UPDATE: When i set key as

jmx["Catalina:class=javax.sql.DataSource,name=jdbc/someDB,type=DataSource",active]

In the zabbix items, than i get in logs this:

2014-11-19 05:50:40.136 [pool-1-thread-3] DEBUG com.zabbix.gateway.ItemChecker - getting value for item 'jmx[Catalina:class=javax.sql.DataSource,name="jdbc/someDB",type=DataSource,active]
'
2014-11-19 05:50:40.136 [pool-1-thread-3] DEBUG com.zabbix.gateway.ItemChecker - caught exception for item 'jmx[Catalina:class=javax.sql.DataSource,name="jdbc/someDB",type=DataSource,acti
ve]'
com.zabbix.gateway.ZabbixException: required key format: jmx[<object name>,<attribute name>]
        at com.zabbix.gateway.JMXItemChecker.getStringValue(JMXItemChecker.java:121) [zabbix-java-gateway-2.2.6.jar:na]
        at com.zabbix.gateway.ItemChecker.getJSONValue(ItemChecker.java:88) ~[zabbix-java-gateway-2.2.6.jar:na]
        at com.zabbix.gateway.JMXItemChecker.getValues(JMXItemChecker.java:96) [zabbix-java-gateway-2.2.6.jar:na]
        at com.zabbix.gateway.SocketProcessor.run(SocketProcessor.java:63) [zabbix-java-gateway-2.2.6.jar:na]
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [na:1.6.0_31]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [na:1.6.0_31]
        at java.lang.Thread.run(Thread.java:662) [na:1.6.0_31]

Solution

  • There was a question on ServerFault asked previously, which should help in the general case of creating JMX items for Zabbix. It shows how the values in JConsole match with the arguments one has to specify in Zabbix.

    In your particular case, based on the screenshot you posted, the third key in the list looks correct:

    jmx["Catalina:class=javax.sql.DataSource,name=\"jdbc/someDB\",type=DataSource",active]
    

    Zabbix documentation page, which details item key syntax and escaping rules, should help getting the syntax right in the future.