0

I'm monitoring a postgresql db process with telegraf and procstat input plugin, but it's not seems to be working as expected in all machines(master and slaves).

The input plugin configuration is like below:

[[inputs.procstat]]
  systemd_unit = "postgresql-10.service"

For this process where it's running and telegraf says running=0i

MainPID absent

I can connect to the DB without problem using psql!

In another machine where telegraf says running=1i:

MianPID!=0

The only difference I can see is the absence of MainPID. It seems that telegraf use this cmd systemctl show postgresql-10.service | grep MainPID to find the pid of process and get 0 when it says running=0i.

systemctl show postgresql-10.service | grep MainPID
GuessMainPID=yes
MainPID=0
ExecMainPID=0

The databases are installed with ansible playbook so there's no difference on version of postgres or the system unit file configuration.

I found this issue but couldn't figure out what to exactly do to fix it.

What is the issue and How to fix it? Thanks in advance.

Update:

systemctl list-unit-files | grep enabled | grep postgres
postgres_exporter.service                     enabled

systemctl list-unit-files | grep postgres
postgres_exporter.service                     enabled
postgresql-10.service                         disabled
GUISSOUMA Issam
  • 2,572
  • 2
  • 16
  • 27
  • Hi, per that issue a MainPID=0 means the service is not running, and that would align with what Telegraf is saying. What do you get when you run `systemctl list-unit-files | grep enabled | grep postgres`? – powersj Nov 17 '22 at 21:16
  • Hello @powersj, the service is running and I can connect using psql. the above command returns postgres_exporter.service enabled If I remove enabled it shows: postgres_exporter.service enabled postgresql-10.service disabled The result is similar on machine where telegraf says running=0i or running=1i I appreciate any help – GUISSOUMA Issam Nov 18 '22 at 08:14

0 Answers0