Skip to content
This repository was archived by the owner on Aug 22, 2024. It is now read-only.
This repository was archived by the owner on Aug 22, 2024. It is now read-only.

problem with autodiscovery patroni #17

@glushakov

Description

@glushakov

Describe the bug
Running pgscv on host with Patroni, and exporter can not discovery patroni
In debug log:
{"level":"debug","service":"pgscv","time":"2021-10-22T17:50:32+03:00","message":"auto-discovery: looking up for new services..."}
{"level":"debug","service":"pgscv","time":"2021-10-22T17:50:32+03:00","message":"auto-discovery [patroni]: analyzing process with pid 2608"}
{"level":"warn","service":"pgscv","time":"2021-10-22T17:50:32+03:00","message":"auto-discovery [python3]: discovery failed: patroni YAML configuration file not found; skip"}

Steps to reproduce
#check all python process:
[root@postgres1 pgsql]# ps ax | grep python
1263 ? Ssl 0:02 /usr/libexec/platform-python -Es /usr/sbin/tuned -l -P
1267 ? Ssl 0:14 /usr/bin/python3 /usr/bin/goferd --foreground
1353 ? Ssl 0:18 /usr/bin/python3.6 /usr/local/bin/patroni /etc/patroni/postgres1.yml
23194 pts/1 S+ 0:00 grep --color=auto python

[root@postgres1 pgsql]# ./pgscv --config-file=pgscv.yaml --log-level=debug
{"level":"info","service":"pgscv","time":"2021-10-25T10:40:49+03:00","message":"read configuration from pgscv.yaml"}
{"level":"info","service":"pgscv","time":"2021-10-25T10:40:49+03:00","message":"no-track disabled, for details check the documentation about 'no_track_mode' option."}
{"level":"debug","service":"pgscv","time":"2021-10-25T10:40:49+03:00","message":"start application"}
{"level":"info","service":"pgscv","time":"2021-10-25T10:40:49+03:00","message":"listen on http://127.0.0.1:9890"}
{"level":"debug","service":"pgscv","time":"2021-10-25T10:40:49+03:00","message":"starting background auto-discovery loop"}
{"level":"info","service":"pgscv","time":"2021-10-25T10:40:49+03:00","message":"auto-discovery: service added [system:0]"}
{"level":"debug","service":"pgscv","time":"2021-10-25T10:40:49+03:00","message":"auto-discovery: looking up for new services..."}
{"level":"debug","service":"pgscv","time":"2021-10-25T10:40:50+03:00","message":"auto-discovery [patroni]: analyzing process with pid 1267"}
{"level":"warn","service":"pgscv","time":"2021-10-25T10:40:50+03:00","message":"auto-discovery [python3]: discovery failed: patroni YAML configuration file not found; skip"}
{"level":"debug","service":"pgscv","time":"2021-10-25T10:40:50+03:00","message":"auto-discovery [postgres]: analyzing process with pid 2077"}

#try to stop all other python processes

[root@postgres1 pgsql]# systemctl stop goferd
[root@postgres1 pgsql]# kill 1263
[root@postgres1 pgsql]# ps ax | grep python
1353 ? Ssl 0:19 /usr/bin/python3.6 /usr/local/bin/patroni /etc/patroni/postgres1.yml
23291 pts/1 S+ 0:00 grep --color=auto python

[root@postgres1 pgsql]# ./pgscv --config-file=pgscv.yaml --log-level=debug
{"level":"info","service":"pgscv","time":"2021-10-25T10:43:48+03:00","message":"read configuration from pgscv.yaml"}
{"level":"info","service":"pgscv","time":"2021-10-25T10:43:48+03:00","message":"no-track disabled, for details check the documentation about 'no_track_mode' option."}
{"level":"debug","service":"pgscv","time":"2021-10-25T10:43:48+03:00","message":"start application"}
{"level":"info","service":"pgscv","time":"2021-10-25T10:43:48+03:00","message":"listen on http://127.0.0.1:9890"}
{"level":"debug","service":"pgscv","time":"2021-10-25T10:43:48+03:00","message":"starting background auto-discovery loop"}
{"level":"info","service":"pgscv","time":"2021-10-25T10:43:48+03:00","message":"auto-discovery: service added [system:0]"}
{"level":"debug","service":"pgscv","time":"2021-10-25T10:43:48+03:00","message":"auto-discovery: looking up for new services..."}
{"level":"debug","service":"pgscv","time":"2021-10-25T10:43:48+03:00","message":"auto-discovery [postgres]: analyzing process with pid 2077"}
{"level":"debug","service":"pgscv","time":"2021-10-25T10:43:48+03:00","message":"making test connection: application_name=pgscv host=/var/run/postgresql port=5432 user=pgscv dbname=postgres password=test"}
{"level":"debug","service":"pgscv","time":"2021-10-25T10:43:48+03:00","message":"test connection success"}
{"level":"debug","service":"pgscv","time":"2021-10-25T10:43:48+03:00","message":"auto-discovery [postgres]: service has been found, pid 2077, available through application_name=pgscv host=/var/run/postgresql port=5432 user=pgscv dbname=postgres password=test"}
{"level":"info","service":"pgscv","time":"2021-10-25T10:43:48+03:00","message":"auto-discovery [postgres]: service added [postgres:5432]"}

Patroni still not found

Expected behavior
Patroni should be discovered

pgSCV startup options
[root@postgres1 pgsql]# cat pgscv.yaml
defaults:
postgres_username: "pgscv"
postgres_password: "test"

Errors and Logs
Add any useful information from logs if possible or errors if there is any.

Environment (please complete the following information):

  • RHEL 8.4
  • pgSCV 0.7.5
  • PostgreSQL Version 12.7
  • Do PostgreSQL and pgSCV are running on the same host? - yes
  • patroni 2.0.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions