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:
- Check the host, port and path are correct
- Check the username:password if you are using Basic auth on your DBmarlin server.
- Make sure there are no firewalls blocking port 9090 between your prometheus server and then DBmarlin server.
- Check on the DBmarlin server if you can run the curl command
- Check that the latest
prometheus##?.?.war
was copied totomcat/webapps
from the extras directory and that no other olderprometheus##?.?.war
files exist.