Ad Widget

Collapse

zabbix with postgres database

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • RedRocket
    Junior Member
    • Apr 2008
    • 4

    #1

    zabbix with postgres database

    Kind of linux/unix noob here but anyhow.... After much battling with installing zabbix 1.4.5.1, mysql, apache, php from ports on freebsd 6.2, and getting everything up and running, I would prefer to use postgresql for db. I would like to know how to configure the /usr/local/etc/zabbix/zabbix_server.conf file to point to postgres server, and when that is working I can change the host postgres is on. I cant seem to find much on this anywhere.


    Here is the end of the config file:

    DBHost=localhost
    # Database name
    # SQLite3 note: path to database file must be provided. DBUser and DBPassword are ignored.
    DBName=zabbix

    # Database user
    DBUser=zabbix

    # Database password
    # Comment this line if no password used
    DBPassword=zabbix

    # Connect to MySQL using Unix socket?
    #DBSocket=/tmp/mysql.sock
  • RedRocket
    Junior Member
    • Apr 2008
    • 4

    #2
    can I just start afresh, compile zabbix, apache, php from ports, ignoring mysql or postgresql support, and use postgres server on another machine?
    I will try this now on a fresh freebsd jail...

    Comment

    • nelsonab
      Senior Member
      Zabbix Certified SpecialistZabbix Certified Professional
      • Sep 2006
      • 1233

      #3
      Yep, that's what you'll have to do. The database you compile support for in the server is the one that it will use. The docs are not explicit about this unfortunately.
      RHCE, author of zbxapi
      Ansible, the missing piece (Zabconf 2017): https://www.youtube.com/watch?v=R5T9NidjjDE
      Zabbix and SNMP on Linux (Zabconf 2015): https://www.youtube.com/watch?v=98PEHpLFVHM

      Comment

      • RedRocket
        Junior Member
        • Apr 2008
        • 4

        #4
        Originally posted by nelsonab
        Yep, that's what you'll have to do. The database you compile support for in the server is the one that it will use. The docs are not explicit about this unfortunately.
        I have just re-compiled in a new jail with support for postgres, and got it all working. Having a little trouble with postgres now...



        sorry for the large paste of log file,
        24256:20080430:193024 Query::insert into trends (clock,itemid,num,value_min,value_avg,value_max) values (1209574800,19550,1,
        9223372036854775808.000000,9223372036854775808.000 000,9223372036854775808.000000)
        24256:20080430:193024 Query failed:PGRES_FATAL_ERROR:ERROR: numeric field overflow
        DETAIL: A field with precision 16, scale 4 must round to an absolute value less than 10^12.

        24256:20080430:193024 Query::update items set nextcheck=1209578150,prevvalue=lastvalue,lastvalue ='9223372036854775807',lastc
        lock=1209576624 where itemid=19550
        24256:20080430:193024 Query failed:PGRES_FATAL_ERROR:ERROR: current transaction is aborted, commands ignored until end of t
        ransaction block

        24256:20080430:193024 Query::select distinct function,parameter,itemid,lastvalue from functions where itemid=19550
        24256:20080430:193024 Query failed:PGRES_FATAL_ERROR:ERROR: current transaction is aborted, commands ignored until end of t
        ransaction block

        24253:20080430:193024 One child process died. Exiting ...
        24253:20080430:193026 ZABBIX Server stopped


        Anyhow, I will try some more on this and revert back to forums if I cant get anywhere.




        If anyone wants me to document what steps I went through to install on freebsd 6.2, with zabbix 1.4.5.1, postgres 8.3, apache228, php5, let me know and I will do my best to write up a small how-to

        Comment

        • RedRocket
          Junior Member
          • Apr 2008
          • 4

          #5
          CREATE TABLE trends (
          itemid bigint DEFAULT '0' NOT NULL,
          clock bigint DEFAULT '0' NOT NULL,
          num bigint DEFAULT '0' NOT NULL,
          value_min numeric(64,4) DEFAULT '0.0000' NOT NULL,
          value_avg numeric(64,4) DEFAULT '0.0000' NOT NULL,
          value_max numeric(64,4) DEFAULT '0.0000' NOT NULL,
          PRIMARY KEY (itemid,clock)
          ) with OIDS;

          For anyone else having problems as my previous post, I changed this table schema in /tmp/zabbix-1.4.5/create/schema/postgresql.sql before using it to apply schema in postgres.

          Probably very obvious to all you complete nerds, but not to me :P, also possibly not the most ideal solution but zabbix now works for me with postgres

          Comment

          Working...