Ad Widget

Collapse

PostgreSQL monitoring, ping test failed but Postgres runs

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nti
    Junior Member
    • May 2015
    • 8

    #1

    PostgreSQL monitoring, ping test failed but Postgres runs

    Hi

    I've installed Zabbix 4.4.5
    The Postgres service test says"PostgreSQL: Service is down" because the ping test from "Template DB PostgreSQL" did not succeed: {Template DB PostgreSQLgsql.ping["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.D B}"].last()} = 0

    But the server runs and on the console, using zabbix_get, everything is OK.

    zabbix_get -s 10.1.1.2 -k 'pgsql.ping["127.0.0.1","5432","zbx_monitor","postgres"]'
    127.0.0.1:5432 - Verbindungen werden angenommen

    zabbix_get -s 10.1.1.2 -k 'pgsql.ping.time["127.0.0.1","5432","zbx_monitor","postgres"]'
    1
    Zeit: 0,273 ms


    On the DB Host also everything is OK with "pg_isready":

    sudo -u zabbix pg_isready -h "127.0.0.1" -p "5432" -U "zbx_monitor" -d "postgres"
    127.0.0.1:5432 - Verbindungen werden angenommen

    Maybe a problem with german language ? Or do I have to create a value mapping ? Any ideas?
    Last edited by nti; 18-02-2020, 15:36.
  • mfortes
    Senior Member
    • Oct 2019
    • 416

    #2
    Hello nti
    You need to create a new value mapping...
    Maybe your item is using a incompatible value mapping, and then, shows nothing =/


    Michael R. Fortes

    Linkedin: Mike Fortes
    Medium: mromeiro-f

    Comment

    • nti
      Junior Member
      • May 2015
      • 8

      #3
      Thanks - I do not have a correct mapping. There was nothing for postgres in my installation and I tried to create one (analog to mysql), but doesn't work. Do you have the original for me?

      Comment

      • nti
        Junior Member
        • May 2015
        • 8

        #4
        I found it. Originally it is mapped tor "service state" - that should work I think?

        Comment

        • nti
          Junior Member
          • May 2015
          • 8

          #5
          In the zabbix postgre XML file the value search is for english , so I have to change my postgresql.conf lc_message
          <params>return value.search(/accepting connections/)&gt;0 ? 1 : 0</params>

          My Output:

          127.0.0.1:5432 - Verbindungen werden angenommen

          Comment

          • nti
            Junior Member
            • May 2015
            • 8

            #6
            It's a nightmare! - I can't set locales for the Zabbix user! Everything I did in profile or login.conf is ignored. Which enviroment is zabbix_agentd using? where can I change locales?

            Comment

            • tim.mooney
              Senior Member
              • Dec 2012
              • 1427

              #7
              How is the zabbix_agend service started? If it's started via systemd, you may want to make a local edit to the service and set LANG or one of the other localization environment variables in the service file.

              Note that using the procedure I linked doesn't modify the service file that the package installs, it adds a local override (on just that host).

              Comment

              • jptamayo
                Junior Member
                • May 2024
                • 1

                #8
                Hello

                I am using Zabbix 6.4.15 and facing the same problem but in Spanish language (es_ES.UTF-8) as ENCODING at the PostgreSQL engine and Operating System too.

                I found the following solution:

                $ psql -qtAX postgresql://"zbx_monitor":"Zabbix2024"@"127.0.0.1":"5432"/"postgres" -f "/var/lib/zabbix/postgresql/pgsql.ping.time.sql"
                1
                Duración: 0,386 ms

                $ psql -qtAX postgresql://"zbx_monitor":"Zabbix2024"@"127.0.0.1":"5432"/"postgres" -f "/var/lib/zabbix/postgresql/pgsql.ping.time.sql" | sed 's/Duración/Time/'| sed 's/,/./'
                1
                Time: 0.361 ms




                So modify the following 2 lines in the file /etc/zabbix/zabbix_agentd.d/template_db_postgresql.conf

                UserParameter=pgsql.ping[*], pg_isready -h "$1" -p "$2" | sed 's/aceptando conexiones/accepting connections/'
                UserParameter=pgsql.ping.time[*], LANG=C.UTF-8 psql -qtAX postgresql://"$3":"$4"@"$1":"$2"/"$5" -f "/var/lib/zabbix/postgresql/pgsql.ping.time.sql" | sed 's/Duración/Time/'| sed 's/,/./'



                After changing the file you have to restart the agent:
                $ sudo systemctl restart zabbix-agent​


                Best Regards!
                Juan Pablo

                Comment

                Working...