How would i programmatically retrieve usage statistics for datasources deployed on JBoss? Its possible with GlassFish, however lost on how to do the same for JBoss.
For a start, go to http://localhost:8080/jmx-console and search for the JNDI name of the data source. This will show ~ 3 mbeans per datasource from where you can then get the statistics.
Of course you can get at the data programmatically - just follow the AMX example in your glassfish link on how to talk to the MBeanServer - of course you need to change the ObjectNames and Attribut names to reflect the JBoss ones.
发布评论
评论(2)
您可以使用 JavaMelody 来统计 sql 或 http 请求、jdbc 连接等信息。
You can use JavaMelody to have statistics on sql or http requests, jdbc connections and more.
您可以通过 JMX 来做到这一点。
首先,转到 http://localhost:8080/jmx-console 并搜索 JNDI 名称的数据源。这将显示每个数据源大约 3 个 mbean,然后您可以从中获取统计信息。
当然,您可以通过编程方式获取数据 - 只需按照 glassfish 链接中的 AMX 示例了解如何与 MBeanServer 通信 - 当然,您需要更改 ObjectNames 和 Attribut 名称以反映 JBoss 的名称。
You can do that via JMX.
For a start, go to http://localhost:8080/jmx-console and search for the JNDI name of the data source. This will show ~ 3 mbeans per datasource from where you can then get the statistics.
Of course you can get at the data programmatically - just follow the AMX example in your glassfish link on how to talk to the MBeanServer - of course you need to change the ObjectNames and Attribut names to reflect the JBoss ones.