diff --git a/playbooks/prod_db.yml b/playbooks/prod_db.yml index f2bceb8..e890a86 100755 --- a/playbooks/prod_db.yml +++ b/playbooks/prod_db.yml @@ -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: diff --git a/roles/prometheus/templates/prometheus.yml.j2 b/roles/prometheus/templates/prometheus.yml.j2 index 74ee950..9ac12b2 100644 --- a/roles/prometheus/templates/prometheus.yml.j2 +++ b/roles/prometheus/templates/prometheus.yml.j2 @@ -6,13 +6,12 @@ global: evaluation_interval: 15s scrape_configs: - # The job name is added as a label `job=` 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 %}