{#APPLICATION_NAME} macro in replication discovery doesn't distinguish by pid (PostgreSQL agent plugin)

XMLWordPrintable

    • Type: Problem report
    • Resolution: Unresolved
    • Priority: Trivial
    • None
    • Affects Version/s: 7.0.27, 8.0.0beta1
    • Component/s: Agent2 plugin (G)
    • None

      Steps to reproduce:

      1. Install Zabbix Server (any version, 7.0.27 used for testing)
      2. Add a host with "PostgreSQL by Zabbix agent 2" template
      3. Add 2 physical replication instances to the host using the same application name
      4. Trigger "Replication Discovery"

      Result:
      The template will only discover one replication application, the other one will create a conflict because it has the same name
      Expected:
      The {#APPLICATION_NAME} macro should not depend only on application_name from pg_stat_replication since it's not a unique identifier. In fact there's an inconcistency with the documentation which says:

      pgsql.replication.process.discovery[uri,username,password] - replication procces name discovery. Returns: Result of the

      SELECT 
      json_build_object('data',
      json_agg(json_build_object('{#APPLICATION_NAME}',
      CONCAT(application_name, ' ', pid))))       
      FROM 
      pg_stat_replication

       

      When in reality, the query that's being executed according to handler_replication_process_name_discovery.go:31 is:

       

      query := `SELECT 
       json_build_object('data',COALESCE(json_agg(json_build_object('{#APPLICATION_NAME}',application_name)), '[]')) 
       FROM pg_stat_replication`

       

      The correct approach should be the one already stated in the documentation where the pid is concatenated to the name of the application in the macro

            Assignee:
            Guntis Liepins
            Reporter:
            Carlos Chapi
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: