Ad Widget

Collapse

Use of libzbxpgsql template

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • TiYab
    Junior Member
    • Feb 2017
    • 6

    #1

    Use of libzbxpgsql template

    Hi everyone,
    new on Zabbix server and new with the use of PostgreSQL.
    Anyway I am trying to use the libzbxpgsql template on my databases.
    • Zabbix_server: 3.2
    • Zabbix_agent: 3.2
    • libzbxpgsql is the one for 3.2

    But I really don't understand why the thing doesn't work.

    in my host template, I have set the settings that can be seen in the file attached.

    On my zabbix server when I executed the following command it is working perfectly:
    Code:
    zabbix_get -s XX.XX.XX.XX -k pg.connect[user=monitoring,postgres]
    My return code is 0 when PostgreSQL is stop and 1 when running.

    But I can't see anything in Zabbix Web interface.

    Help would be greatly appreciated.
    Attached Files
    Last edited by TiYab; 24-02-2017, 09:49. Reason: SOLVED
  • batchenr
    Senior Member
    • Sep 2016
    • 440

    #2
    Originally posted by TiYab
    Hi everyone,
    new on Zabbix server and new with the use of PostgreSQL.
    Anyway I am trying to use the libzbxpgsql template on my databases.
    • Zabbix_server: 3.2
    • Zabbix_agent: 3.2
    • libzbxpgsql is the one for 3.2

    But I really don't understand why the thing doesn't work.

    in my host template, I have set the settings that can be seen in the file attached.

    On my zabbix server when I executed the following command it is working perfectly:
    Code:
    zabbix_get -s XX.XX.XX.XX -k pg.connect[user=monitoring,postgres]
    My return code is 0 when PostgreSQL is stop and 1 when running.

    But I can't see anything in Zabbix Web interface.

    Help would be greatly appreciated.
    can you post the item and trigger that doesn't seem to work ?
    and by the item that doesn't work - is it enabled or unsupported ?
    if unsupported it should post why, and i know sometimes there is an issue if you set zabbix agent or zabbix agent active so try to change that in the item itself and see if it works for you.

    Comment

    • TiYab
      Junior Member
      • Feb 2017
      • 6

      #3
      Originally posted by batchenr
      can you post the item and trigger that doesn't seem to work ?
      The item and trigger definition as attached screenshots.
      Originally posted by batchenr
      and by the item that doesn't work - is it enabled or unsupported ?
      the item is enable
      Originally posted by batchenr
      if unsupported it should post why, and i know sometimes there is an issue if you set zabbix agent or zabbix agent active so try to change that in the item itself and see if it works for you.
      This template seems to be use by a lot of people already. So I am pretty sure that there is a misconfiguration from my part but I really don't see where I could have missed the configuration since the zabbix_get is working
      Attached Files

      Comment

      • TiYab
        Junior Member
        • Feb 2017
        • 6

        #4
        I have managed to solved my problem.
        1. - I forgot to allow incoming traffic on port 10051
        2. - I needed to allow the user monitoring to access the DB through TCP/IP.
          This https://github.com/cavaliercoder/libzbxpgsql/issues/30 help me to understand.
          And the different steps needed were:
          • Create home directory for zabbix user
            Code:
            usermod -d /etc/zabbix zabbix
          • Create a pgpass file in /etc/zabbix with the following content
            Code:
            #hostname:port:database:username:password
            *:*:*:monitoring:mystrongpassword
          • Add the following line in the pg_hba.conf
            Code:
            local   all             monitoring                              md5
          • reload pg_hba.conf & restart zabbix agent (it is faster than waiting for a new polling)


        Comment

        • kloczek
          Senior Member
          • Jun 2006
          • 1771

          #5
          zabbix_get it is the tool which is used to test passive agent items.
          In your screenshot you have item type listed as "zabbix agent (active)". If whole monitoring is not working it means that agent is working with passive setup.
          What it means? It means that agent is not asking zabbix srv/prx for active agent items cfg and this is why it does not sends back monitoring data.

          You hae two possible solutions:
          1) switch agent to active setup (ActiveServer=<prx_or_srv_add>, StartAgents=0) and make sure that all zabbix agent items are "zabbix agent (active)" type
          2) change type of items to "zabbix agent" and stick with passive agent settings.
          Documentation: https://www.zabbix.com/documentation.../activepassive

          However if you monited env will be growing sooner or later you will end up only on active monitoring because only active scales up, so as JFDI you can change type of the items and you should start switching whole monitoring to active one.
          Last edited by kloczek; 25-02-2017, 19:12.
          http://uk.linkedin.com/pub/tomasz-k%...zko/6/940/430/
          https://kloczek.wordpress.com/
          zapish - Zabbix API SHell binding https://github.com/kloczek/zapish
          My zabbix templates https://github.com/kloczek/zabbix-templates

          Comment

          Working...