Monitoring a postgresql db process with telegraf using procstat input plugin send running=0i for active running state

197 views Asked by At

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
0

There are 0 answers