PostgreSQL plugin - separate physical and logical standby for "pgsql.replication.count" key

XMLWordPrintable

    • Type: Change Request
    • Resolution: Unresolved
    • Priority: Trivial
    • None
    • Affects Version/s: None
    • Component/s: None
    • None

      Hi.

      The "PostgreSQL by Zabbix agent 2" template has the following element:

      Key: pgsql.replication.count 
      Name: Replication: Standby count
      Description: Number of standby servers
      

      https://www.zabbix.com/integrations/postgresql#postgresql_agent2

      The pgsql.replication.count key, which executes the query in the database:

      query = `SELECT COUNT(DISTINCT client_addr) + COALESCE(SUM(CASE WHEN client_addr IS NULL THEN 1 ELSE 0 END), 0) FROM pg_stat_replication;`

      https://git.zabbix.com/projects/AP/repos/postgresql/browse/plugin/handler_replication.go#117

      However, this query counts not only the number of physical standbys, but in general all types of replications, incl. logical replications.

      In my opinion, the name of the "Standby count" element in the template is incorrect.

      Or if we want to show only physical standbys, then we need to change the current key pgsql.replication.count by adding a condition that will exclude logical replications (for example, join with the pg_replication_slots table and exclude slot_type = logical)

            Assignee:
            Zabbix Development Team
            Reporter:
            Anton Glushakov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: