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 # Database servers
--- ---
- hosts: vm-general-1.ashburn.mgmt.desu.ltd - 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: roles:
- role: geerlingguy.postgresql - role: geerlingguy.postgresql
vars: vars:

View File

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