JDBC data not populated for tomcat added by Prometheus

JDBC data not populated for tomcat added by Prometheus

To configure JDBC metrics in tomcat exporter
1) Open the below file from tomcat installation directory.
$CATALINA_BASE/conf/server.xml
2) Add the following configuration under <GlobalNamingResources> tag in the server.xml file.
<Resource name="<CUSTOM_RESOURCE_NAME>"
auth="Container"
type="javax.sql.DataSource"
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
jdbcInterceptors="nl.nlighten.prometheus.tomcat.TomcatJdbcInterceptor(logFailed=true,logSlow=true,threshold=1000,buckets=.01|.05|.1|1|10,slowQueryBuckets=1|10|30)"
username="<DB_USERNAME>"
password="<DB_PASSWORD>"
driverClassName="<JDBC_DRIVER_NAME>"
url="<JDBC_CONNECTION_URL>"/>
3) Restart tomcat server/pod and access the metrics URL: http://host:port/metricsCheck if JDBC metrics are generated or not. 
Eg.
4) Check if the metrics are scraped by Prometheus using PromQL query tool. A query execution example is shown below.
Prometheus query execution
5) Now poll the monitor from Applications Manager and verify if JDBC data is populated in the UI.


                  New to ADManager Plus?

                    New to ADSelfService Plus?