Add prometheus exporter to psql

This commit is contained in:
Salt 2024-07-09 16:29:50 -05:00
parent 5ef2bcd3e7
commit 1b119a94e3
2 changed files with 23 additions and 4 deletions

View File

@ -3,6 +3,18 @@
# Database servers
---
- hosts: vm-general-1.ashburn.mgmt.desu.ltd
tasks:
- name: assure prometheus psql exporter
ansible.builtin.docker_container:
name: prometheus-psql-exporter
image: quay.io/prometheuscommunity/postgres-exporter
env:
DATA_SOURCE_URI: "10.0.0.2:5432/postgres"
DATA_SOURCE_USER: "nagios"
DATA_SOURCE_PASS: "{{ secret_postgresql_monitoring_password }}"
ports:
- 9102:9187/tcp
tags: [ db, psql, prometheus, monitoring, docker ]
roles:
- role: geerlingguy.postgresql
vars:

View File

@ -6,13 +6,12 @@ global:
evaluation_interval: 15s
scrape_configs:
# The job name is added as a label `job=<job_name>` to any timeseries
# scraped from this config.
# Default Prometheus job to monitor itself
- job_name: "prometheus"
# metrics_path defaults to '/metrics'
# scheme defaults to 'http'.
static_configs:
- targets: ["localhost:9090"]
# These two jobs are included for every node in our inventory
- job_name: "node-exporter"
static_configs:
- targets:
@ -25,3 +24,11 @@ scrape_configs:
{% for host in groups['tags_nagios'] %}
- '{{ host }}:9101'
{% endfor %}
# This container is used on every psql machine
- job_name: "psql-exporter"
static_configs:
- targets:
{% for host in groups['tags_nagios-checkpgsql'] %}
- '{{ host }}:9102'
{% endfor %}