Not the answer you need?
Register and ask your own question!

PMM and postgres RDS

erinoerino ContributorInactive User Role Beginner
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?

Comments

  • MykolaMykola Percona Percona Staff Role
    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.
  • erinoerino Contributor Inactive User Role Beginner
    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.
  • MykolaMykola Percona Percona Staff Role
    I think you can try to use this dashboard - https://grafana.com/dashboards/455
  • erinoerino Contributor Inactive User Role Beginner
    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.
  • erinoerino Contributor Inactive User Role Beginner
    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:

    relabel_configs:
    - target_label: 'job'
    replacement: 'postgres'
    - source_labels:
    regex: '.*,alias_([-\w:\.]+),.*'
    target_label: 'instance'
    replacement: '$1'
    - source_labels:
    regex: '.*,scheme_https,.*'
    target_label: '__scheme__'
    replacement: 'https'
    2) docker exec -it pmm-server bash
    vi /etc/prometheus.yml <-- added that
    3) kill -HUP <pid of prometheus> (the first time I had a typo & prometheus failed to run, fixed it & now it's running)
    4) added the grants/create functions/create schema postgres_exporter (as per postgres_exporter recommended)
    5) tried to add the pmm-admin add postres:metrics but pmm refused!
    6) went to this page: http://<PMM_SERVER>:<pg-exporter-port>/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: <PMM-SERVER>:<pg-exporter-port> <-- no go <PMM IP>:<pg-exporter-port>/ Thoughts?
  • MykolaMykola Percona Percona Staff Role
    as I understand postgres_exporter REST API working fine and you can see metrics on http://<PMM_SERVER>:<pg-exporter-port>/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
  • erinoerino Contributor Inactive User Role Beginner
    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.
This discussion has been closed.

MySQL, InnoDB, MariaDB and MongoDB are trademarks of their respective owners.
Copyright ©2005 - 2020 Percona LLC. All rights reserved.