python.d/postgres only monitors one cluster

I’m trying to set up Postgres monitoring, but from what I can see it only seems to support a single cluster? At least, only one cluster actually shows up. Given the following configuration:

update_every: 5

    name     : 'foo'
    user     : 'foo'
    password : 'foo'
    database : 'postgres'
    host     : ''
    port     : 5433

    name     : 'bar'
    user     : 'bar'
    password : 'bar'
    database : 'postgres'
    host     : ''
    port     : 5435

The end result seems to be that only “bar” actually shows up, but “foo” did show up as long as “bar” was not included in the configuration.

How do I monitor multiple pgsql clusters on the same node?

Hi there,

I think that you need separate job names for multiple dbs but don’t stand on it, let’s see it with our own eyes and don’t guessing

Try to run this module in debug mode

$ sudo su -s /bin/bash netdata
$ cd /usr/libexec/netdata/plugins.d/
$ ./python.d.plugin postgres debug trace

Please share the output of the logs above

1 Like

This was caused by what I think is called the “job id”, i.e. what’s called tcp above. It can’t be identical for the two blocks, but has to be unique, which I suppose is what you meant.

My suggestion would be to clarify this in the documentation, since the job id is used there (and other places, as I’ve seen) to indicate what type of connection it is (ipv4/ipv6/socket etc.) – I think this sets a possible implicit and false interpretation that the jobs should be named after what connection type they have, when in fact they should probably be named something descriptive.

This might be obvious if you have experience setting up netdata plugins, since I assume the uniqueness of job-ids is something that goes for all plugins, but if you don’t, it’s easy to just follow examples given and get confused.

1 Like

Exactly, thank you for your feedback, there is always room for improvement and I agree this is not obvious from the first glance.

Have a good one!

1 Like

We should make a quick PR to the docs to make this obvious. I can do it next week when next at laptop.