Ad Widget

Collapse

Zabbix Agent 2, PostgreSQL, DROP DB is not possible

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sardylan
    Junior Member
    • Jan 2024
    • 2

    #1

    Zabbix Agent 2, PostgreSQL, DROP DB is not possible

    Hi all,
    I've a little problem monitoring PostgreSQL with Zabbix Agent 2 (both server and agent version 6.0 LTS).
    Everything is working fine, the Agent auto-discover new databases and start to collect stats on new DBs also.

    Since my application creates and drop databases during normal operations, problems begin to happen when the application tries to DROP a db in which Zabbix agent is still connected.

    If the connection was opened and closed every time it collect stats, the problem could be reduced a lot, since the probabilities to have both the software working on DB and the agent collecting stats are few.
    Unfortunately, I've seen connections to DB up and running up to 15 days...

    There is any way to tell Zabbix to not discover some database, maybe using a regex for db-name matching?
    Another solution could be to force-closing the connections using "pg_kill" queries, but I don't know if it could affect the stats collection or could creates any problem to Zabbix Agent.
    Any other suggestion?

    Best​
  • cyber
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Dec 2006
    • 4807

    #2
    https://www.zabbix.com/integrations/postgresql
    {$PG.LLD.FILTER.DBNAME} Filter of discoverable databases. .+
    ​By default it accepts everything (.+). Change the regex and discover only those what you need...

    Comment


    • Lukeffo
      Lukeffo commented
      Editing a comment
      Hello,

      The macro seems not working properly on zabbix 6.0 and agent2: despite of filter application, i can see 1 process for each db in our postgres instance:

      ```
      ps aux -e | grep zbx_monit | wc -l
      8
      ```

      the marco values is curretly "test" that is the unique db that we would like to monitor and we restarted agent / proxy and disable and reenable the host on the zabbix server.

      any help or suggestion here is really appreciated.

      Thanks!
  • sardylan
    Junior Member
    • Jan 2024
    • 2

    #3
    Thank you cyber,
    I didn't notice that macro.
    I'm just applying the regex, as you suggested.

    Comment

    Working...