Closed
Description
intro
So, apparently the custom queries functionality in postgres_exporter which allows us to collect metrics based on the data in the postgres database (aka pretty much the only reason we are using the postgres_exporter) has been deprecated. It seems that the maintainers of postgres_exporter view the main purpose of the project as to provide metrics specific to the inner workings of the Postgres instance. They recommend using a different exporter for collecting metrics from the actual data in the Postgres database.
Test setup
pinning these to the top of the ticket, @mrjones-plip to keep up to date:
- check out these repos
- using
script/docker-helper-4.x
directory in CHT Core repo, start a docker helper instance of CHT core - note the URL and Port. - assuming docker helper gave you a URL and port of
192-168-68-17.local-ip.medicmobile.org:10464
- start your couch2pg instance bycd
into thecht-couch2pg
directory and running:COUCH2PG_SLEEP_MINS=0.1 \ COUCHDB_URL=https://medic:password@172-17-0-1.local-ip.medicmobile.org:10464/medic \ docker compose up -d
- you can optionally connect with a postgres client to
localhost:5432
with usernamecht_couch2pg
, passwordcht_couch2pg_password
to databasecht
to ensure connection is working cd
intowatchdog
repo directory and check out81-sql-exporter
repo- still in watchdog repo, update your
cht-instances.ylm
to have the URL from step 1. In this example it's192-168-68-17.local-ip.medicmobile.org:10464
- copy
exporters/postgres/sql_servers_example.yml
toexporters/postgres/sql_servers.yml
. Update the value in172-17-0-1.local-ip.medicmobile.org:10464
to match the CHT Core URL from step 2 above. - still in the top level
cht-watchdog
directory, run the restart script:./development/kill.start.ips.sh
Test steps
- From step 8's output above, look for the one called
*-sql_exporter-*
and go to that URL (http://172.30.0.4:9399/metrics
in this case).Services: cht-watchdog-grafana-1 http://172.30.0.3:3000 cht-watchdog-prometheus-1 http://172.30.0.5:9090/targets?search= cht-watchdog-json-exporter-1 http://172.30.0.2:7979/metrics cht-watchdog-sql_exporter-1 http://172.30.0.4:9399/metrics
- ensure the web page looks like this:
# HELP couch2pg couch2pg backlog. # TYPE couch2pg gauge couch2pg{db="_users",job="db_targets",target="local-cht"} 1 couch2pg{db="medic",job="db_targets",target="local-cht"} 186 couch2pg{db="medic-logs",job="db_targets",target="local-cht"} 10 couch2pg{db="medic-sentinel",job="db_targets",target="local-cht"} 79 couch2pg{db="medic-users-meta",job="db_targets",target="local-cht"} 3 # HELP scrape_duration_seconds How long it took to scrape the target in seconds # TYPE scrape_duration_seconds gauge scrape_duration_seconds{job="db_targets",target="local-cht"} 0.008943289 # HELP up 1 if the target is reachable, or 0 if the scrape failed # TYPE up gauge up{job="db_targets",target="local-cht"} 1
- log into the dev watchdog instance at http://localhost:3000 (user
medic
passwordpassword) and go to the main "admin overview" dashboard. ensure the "Couch2pg Backlog" panel is working. It should show a backlog of
0`:
- using the name of the container on step 1 above in the section, stop the couch2pg container. (eg
docker stop cht-couch2pg-cht-couch2pg-1
). - add a household to your cht instance. after a few min you should see a backlog greater than zero
- start the couch2pg container. (eg
docker start cht-couch2pg-cht-couch2pg-1
) and you should see the backlog go back to0
Metadata
Metadata
Assignees
Labels
No labels