Ad Widget

Collapse

Template DB PostgreSQL doesn't use {$PG.PASSWORD}

Collapse
This topic has been answered.
X
X
 
  • Time
  • Show
Clear All
new posts
  • stanski
    Junior Member
    • Mar 2021
    • 2

    #1

    Template DB PostgreSQL doesn't use {$PG.PASSWORD}

    Hi everyone,

    Using Zabbix server 5.0.9, running on Ubuntu 18.04, connecting to zabbix agent 5.0.20 on an Ubuntu 20.04 server with PostgreSQL 13.

    I've linked the "Template DB PostgreSQL" and set the {$PG.PASSWORD} macro for the host configuration. The postgres user zbx_monitor has been created.
    I've confirmed I can connect to the postgres db using the zbx_monitor user and password, however zabbix only shows errors.

    Example output of PostgreSQL: Get bgwriter:

    psql: error: connection to server at "127.0.0.1", port 5432 failed: FATAL: password authentication failed for user "zbx_monitor"
    Also, the template macros didn't include {$PG.PASSWORD} anywhere, so I have a feeling a password is not actually used.

    Thanks.

  • Answer selected by stanski at 09-02-2022, 16:47.
    cyber
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Dec 2006
    • 4807


    Password is used in many places in userparameters.

    Comment

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

      #2

      Password is used in many places in userparameters.

      Comment

      • stanski
        Junior Member
        • Mar 2021
        • 2

        #3
        Originally posted by cyber
        https://git.zabbix.com/projects/ZBX/...Frelease%2F5.0
        Password is used in many places in userparameters.
        Interesting. In the included template it doesn't appear to be the case.

        Example for PostgreSQL: Get bgwriter:

        pgsql.bgwriter["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.D B}"]

        I'll re-import the template XML from the repo.
        Thanks.

        Update: Overriding the included template with the one from the repo worked.
        Last edited by stanski; 09-02-2022, 16:48.

        Comment

        • Steve Palmer
          Junior Member
          • Apr 2022
          • 1

          #4

          I've just fallen over this, but found another approach. On web page https://www.zabbix.com/documentation...x/zabbix_agent, table row "Template DB Postgress", column "Additional steps/comments", note 5 states:
          5. To monitor a remote server, create a .pgpass file in Zabbix agent home directory (/var/lib/zabbix/) and add rows with the instance, port, database, user and password information (see PostgreSQL documentation for details).
          Row examples:
          <REMOTE_HOST1>:5432: postgres:zbx_monitor:<PASSWORD>
          *:5432: postgres:zbx_monitor:<PASSWORD>
          This step is not mentioned on the https://git.zabbix.com/projects/ZBX/...Frelease%2F5.0 web page which instead mentions the {$PG.PASSWORD} macro, though this is not used in the supplied template.

          Comment

          Working...