PMM and postgres RDS

PMM is working great. Now I need to add Postgres RDS. I’ve got the postgres_exporter on the client that is serving RDS MySQL. Will I have to hack prometheus to get this to work?

Hi erino,

as I know have long-term plan to make PMM pluggable, so in future, we want to have the possibility to add PostgreSQL (or any other popular DB) plugin in one or two simple actions.
Currently, it is quite complex to add PostgreSQL monitoring, but I think it is possible.

If you want I can research and prepare instruction how to add Postgres RDS into PMM.
It will be “hacker” way (not simple) and totally not supported officially.
please say if you need it, it can take some time.

I think I’m not the only one that would need this. And I don’t mind hacking. I have added postgres to my prometheus.yml file (in docker). and at the moment I do have my PMM prometheus gathering stats. I just can’t figure out how to get my pmm grafana to use those metrics.

I think you can try to use this dashboard - [url]https://grafana.com/dashboards/455[/url]

I guess I should have given you more info. I do have that dashboard… Let me gather all the info on what I’ve done so far.

  1. I copied a mysql job_name in the prometheus.yml and added a postgres (this may be the problem?)
  • job_name: postgres
    metrics_path: /postgres
    scrape_interval: 60s
    scrape_timeout: 5s
    basic_auth:
    username: pmm
    password: pmm

tls_config:
insecure_skip_verify: true

consul_sd_configs:

  • server: ‘localhost:8500’
    datacenter: dc1
    services: [‘postgres:metrics’]

relabel_configs:

  • target_label: ‘job’
    replacement: ‘postgres’
  • source_labels: [‘_meta_consul_tags’]
    regex: '.*,alias
    ([-\w:.]+),.*’
    target_label: ‘instance’
    replacement: ‘$1’
  • source_labels: [‘__meta_consul_tags’]
    regex: ‘.,scheme_https,.
    target_label: ‘scheme
    replacement: ‘https’
  1. docker exec -it pmm-server bash
    vi /etc/prometheus.yml ← added that
  2. kill -HUP (the first time I had a typo & prometheus failed to run, fixed it & now it’s running)
  3. added the grants/create functions/create schema postgres_exporter (as per postgres_exporter recommended)
  4. tried to add the pmm-admin add postres:metrics but pmm refused!
  5. went to this page: http://<PMM_SERVER>:/metrics
    THERE are metrics & a reload sees the
    pg_exporter_scrapes_total 2 → 3 7) here’s where I’m having problems - setting the $HOST The postgres instance is an RDS one. I can not seem to get the postgres Overview grafana see the host. Prometheus has the metrics… I’ve tried: : ← no go :/ Thoughts?

as I understand postgres_exporter REST API working fine and you can see metrics on http://<PMM_SERVER>:/metrics URL.

the next step is to add it to prometheus.

  • can you rollback changes and try to add the following lines to Prometheus config?
- job_name: postgres
static_configs:
- targets: ['PG-EXPORTER-IP:PG-EXPORTER-PORT']
labels:
instance: PG-EXPORTER-IP
  • restart prometheus
docker exec pmm-server supervisorctl restart prometheus
  • now it is needed to check if postgres_exporter target is added and in “UP” state
    visit http://PMM-SERVER-IP/prometheus/targets

  • if everything ok, Postgres metrics should exist in prometheus database
    for example

YAY! that worked. Of course I got all my white space messes up the first time I changed the yml file but /var/log/prometheus hinted at the line number. but it’s working! Now to learn a but more Postgres. Thanks for you help. Hopefully this thread will help others.