Troubleshooting - CHERTS/pgscv GitHub Wiki

Troubleshooting

  • Check pgSCV is running by systemd - service should be in active (running) state:
# systemctl status pgscv
● pgscv.service - pgSCV - PostgreSQL ecosystem metrics collector
     Loaded: loaded (/etc/systemd/system/pgscv.service; enabled; vendor preset: enabled)
     Active: active (running) since Thu 2024-02-08 12:11:14 UTC; 1s ago
       Docs: https://github.com/cherts/pgscv
   Main PID: 58904 (pgscv)
      Tasks: 6 (limit: 2220)
     Memory: 1.9M
        CPU: 19ms
     CGroup: /system.slice/pgscv.service
             └─58904 /usr/sbin/pgscv --config-file=/etc/pgscv.yaml
  • Check pgSCV exists in process list
# ps auxf |grep [p]gscv
postgres   58904  0.0  0.6 1237344 12124 ?       Ssl  12:11   0:00 /usr/sbin/pgscv --config-file=/etc/pgscv.yaml
  • Check port is opened by pgSCV - port specified in YAML configuration should be opened (or default one)
# ss -luntp |grep pgscv
tcp   LISTEN 0      4096               *:9890            *:*    users:(("pgscv",pid=58904,fd=3))

# netstat -ltupn | grep pgscv
tcp6       0      0 :::9890                 :::*                    LISTEN      58904/pgscv
  • Try to request /metrics HTTP endpoint - 200 OK should be returned.
# curl -I http://127.0.0.1:9890/metrics
HTTP/1.1 200 OK
content-type: text/plain; version=0.0.4; charset=utf-8
date: Thu, 08 Feb 2024 12:13:04 GMT
  • Try to request particular metrics, count or filter using grep.
# curl -s http://127.0.0.1:9890/metrics | grep -c '^postgres_'
700
  • Check log messages using journalctl
# journalctl -fu pgscv
Feb 08 12:18:31 openconnect-home pgscv[59091]: {"level":"info","service":"pgscv","time":"2024-02-08T12:18:31Z","message":"registered new service [system:0]"}
Feb 08 12:18:31 openconnect-home pgscv[59091]: {"level":"info","service":"pgscv","time":"2024-02-08T12:18:31Z","message":"registered new service [postgres:5432]"}
Feb 08 12:18:31 openconnect-home pgscv[59091]: {"level":"info","service":"pgscv","time":"2024-02-08T12:18:31Z","message":"registered new service [pgbouncer:6432]"}
Feb 08 12:18:31 openconnect-home pgscv[59091]: {"level":"info","service":"pgscv","time":"2024-02-08T12:18:31Z","message":"listen on https://0.0.0.0:9890"}
Feb 08 12:18:41 openconnect-home pgscv[59091]: {"level":"warn","service":"pgscv","time":"2024-02-08T12:18:41Z","message":"read 'kernel.sched_migration_cost_ns' failed: open /proc/sys/kernel/sched_migration_cost_ns: no such file or directory; skip"}
Feb 08 12:18:58 openconnect-home pgscv[59091]: {"level":"warn","service":"pgscv","time":"2024-02-08T12:18:58Z","message":"read 'kernel.sched_migration_cost_ns' failed: open /proc/sys/kernel/sched_migration_cost_ns: no such file or directory; skip"}
Feb 08 12:19:12 openconnect-home pgscv[59091]: 2024/02/08 12:19:12 http: TLS handshake error from 192.168.10.9:54052: remote error: tls: unknown certificate
Feb 08 12:19:12 openconnect-home pgscv[59091]: {"level":"warn","service":"pgscv","time":"2024-02-08T12:19:12Z","message":"read 'kernel.sched_migration_cost_ns' failed: open /proc/sys/kernel/sched_migration_cost_ns: no such file or directory; skip"}
Feb 08 12:19:39 openconnect-home pgscv[59091]: {"level":"warn","service":"pgscv","time":"2024-02-08T12:19:39Z","message":"read 'kernel.sched_migration_cost_ns' failed: open /proc/sys/kernel/sched_migration_cost_ns: no such file or directory; skip"}
Feb 08 12:19:41 openconnect-home pgscv[59091]: {"level":"warn","service":"pgscv","time":"2024-02-08T12:19:41Z","message":"read 'kernel.sched_migration_cost_ns' failed: open /proc/sys/kernel/sched_migration_cost_ns: no such file or directory; skip"}
  • pgSCV has --log-level option, supported values are: debug, info, warn, error. Default value: info.