In JConsole I have fount the metrics of the connection pool I'd like to scrape to Prometheus:
Catalina:type=DataSource,class=javax.sql.DataSource,name="jdbc/postgres",connectionpool=connections
and when I set up the yml file for the export, I don't get the metrics into the /metrics page and they are not scraped
I try with the pattern
- pattern: 'Catalina:type=DataSource,class=javax.sql.DataSource,name="jdbc/postgres"<>NumIdle: ([0-9]+([.][0-9]+)?)'
name: jvm_process_jdbc_num_idle
value: $1
type: GAUGE
This pattern is working:
- pattern: 'Catalina<type=DataSource, class=javax.sql.DataSource, name="jdbc/postgres", connectionpool=connections><>(\w+): (\d+)'
name: jvm_process_jdbc_$1
value: $2
type: GAUGE
It produce all the metrics from this MBean's fields that are numbers.
Note:
<
and >
instead of :
in the JConsole iterface,
separator of the parameters and space after :
before the numeric value