Skip to main content

Prometheus

DBmarlin sensor health can be monitored by Prometheus.

info

The Prometheus integration requires v3.11 of DBmarlin.

Configuration on DBmarlin server​

Copy the prometheus##?.?.war file from /extras to /tomcat/webapps

Configuration in Prometheus​

Edit your prometheus.yml file (E.g. /etc/prometheus/prometheus.yml) on your Prometheus server and add a DBmarlin job under the scrape_configs section like this.

scrape_configs:
- job_name: "prometheus"
# ... your existing config ...

- job_name: "dbmarlin"
metrics_path: "/prometheus/metrics"
# scheme defaults to 'http'.
static_configs:
- targets: ["staging1.dbmarlin.com:9090"]

# Adding basic authentication
basic_auth:
username: 'your_username'
password: 'your_password'

Troubleshooting​

You can use curl to make sure that the target is available using the target host:port and metrics_path specified. You should see text output similar to below.

root@prometheus:~# curl http://dbmarlin:9090/prometheus/metrics
# HELP dbmarlin_config setting and its value
# TYPE dbmarlin_config gauge
dbmarlin_config{name="dbmarlin",type="postgresql",config="collectblockingsessions"} 0
dbmarlin_config{name="dbmarlin",type="postgresql",config="collectdeadlocks"} 0
dbmarlin_config{name="dbmarlin",type="postgresql",config="collectextendedsqlstatistics"} 1
dbmarlin_config{name="dbmarlin",type="postgresql",config="collectsqlstatistics"} 1
dbmarlin_config{name="dbmarlin",type="postgresql",config="hasblockingsessions"} 1
dbmarlin_config{name="dbmarlin",type="postgresql",config="hassqlstatistics"} 0
# HELP dbmarlin_datasource_status status of the underlying database connection
# TYPE dbmarlin_datasource_status gauge
dbmarlin_datasource_status{name="dbmarlin",type="postgresql"} 200
# HELP dbmarlin_sensor_enabled status of the sensor
# TYPE dbmarlin_sensor_enabled gauge
dbmarlin_sensor_enabled{name="dbmarlin",type="postgresql"} 1
# HELP dbmarlin_sensor_status status of the sensor
# TYPE dbmarlin_sensor_status gauge
dbmarlin_sensor_status{name="dbmarlin",type="postgresql"} 200

If you don’t get output like above here are some things to try:

  1. Check the host, port and path are correct
  2. Check the username:password if you are using Basic auth on your DBmarlin server.
  3. Make sure there are no firewalls blocking port 9090 between your prometheus server and then DBmarlin server.
  4. Check on the DBmarlin server if you can run the curl command
  5. Check that the latest prometheus##?.?.war was copied to tomcat/webapps from the extras directory and that no other older prometheus##?.?.war files exist.