Ad Widget

Collapse

Zabbix 1.1: PostgreSQL?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • schneck
    Member
    • May 2006
    • 62

    #1

    Zabbix 1.1: PostgreSQL?

    Hi,

    anyone got 1.1-final running with PostgreSQL?

    src/libs/zbxdbhigh/db.c DBfetch() still seems to be missing some PG code (maybe there's even more, havn't looked at other places yet)

    Thanks,

    \B.

    PS: run's fine with mysql, though. Congratulations to the Zabbix Team!
    Last edited by schneck; 06-06-2006, 09:47. Reason: (no smilies!)
  • GateKeeper
    Junior Member
    • Mar 2006
    • 23

    #2
    Got the same problem! Please, say at least if it will be enough to copy PG-related code from 1.0 to 1.1.

    Comment

    • Zapnix
      Junior Member
      • Apr 2006
      • 13

      #3
      Originally posted by GateKeeper
      Got the same problem! Please, say at least if it will be enough to copy PG-related code from 1.0 to 1.1.
      It won't, I fear. At least have had a look at some beta version version (don't know exactly what version, but IIRC arount beta7 or so), and it seemed to me that some non-trivial fixes had to be done beside some trivial ones - so I decided to wait until 1.1 what I expected to have PostgreSQL support...

      Comment

      • GateKeeper
        Junior Member
        • Mar 2006
        • 23

        #4
        Strange thing... But diff'ing 1.0 versions of db.c against 1.1 version makes me think that changes haven't affect DB-related functions very largely.

        The most frequent diff is
        -- {
        -- fprintf("some error");
        zabbix_log("some log");
        exit(FAIL);
        -- }
        and so on...

        Including Oracle-related stuff, of course.

        Comment

        • proks
          Junior Member
          • Jun 2006
          • 1

          #5
          I have a same problem with PostgreSQL on FreeBSD, but have not with MySQL

          Making all in zbxdbhigh
          if gcc -DHAVE_CONFIG_H -I. -I. -I../../../include -I../../../include -I/usr/local/include -g -O2 -MT action.o -MD -MP -MF ".deps/action.Tpo" -c -o action.o action.c; then mv -f ".deps/action.Tpo" ".deps/action.Po"; else rm -f ".deps/action.Tpo"; exit 1; fi
          In file included from action.c:27:
          ../../../include/db.h:317: error: syntax error before '*' token
          ../../../include/db.h:317: warning: data definition has no type or storage class
          ../../../include/db.h:318: error: syntax error before '*' token
          ../../../include/db.h:318: warning: data definition has no type or storage class
          ../../../include/db.h:319: error: syntax error before "DBfetch"
          ../../../include/db.h:319: error: syntax error before '*' token
          ../../../include/db.h:319: warning: data definition has no type or storage class
          ../../../include/db.h:350: error: syntax error before "DB_ROW"
          action.c: In function `DBget_action_by_actionid':
          action.c:65: error: `PGresult' undeclared (first use in this function)
          action.c:65: error: (Each undeclared identifier is reported only once
          action.c:65: error: for each function it appears in.)
          action.c:65: error: `result' undeclared (first use in this function)
          action.c:66: error: syntax error before "row"
          action.c:74: error: `row' undeclared (first use in this function)
          *** Error code 1

          Stop in /usr/home/proks/src/zabbix-1.1/src/libs/zbxdbhigh.
          *** Error code 1

          Stop in /usr/home/proks/src/zabbix-1.1/src/libs/zbxdbhigh.
          *** Error code 1

          Stop in /usr/home/proks/src/zabbix-1.1/src/libs.
          *** Error code 1

          Stop in /usr/home/proks/src/zabbix-1.1/src.
          *** Error code 1

          Stop in /usr/home/proks/src/zabbix-1.1.

          Comment

          • Zapnix
            Junior Member
            • Apr 2006
            • 13

            #6
            Originally posted by proks
            ../../../include/db.h:317: error: syntax error before '*' token
            ../../../include/db.h:317: warning: data definition has no type or storage class
            ../../../include/db.h:318: error: syntax error before '*' token
            ../../../include/db.h:318: warning: data definition has no type or storage class
            ../../../include/db.h:319: error: syntax error before "DBfetch"
            ../../../include/db.h:319: error: syntax error before '*' token
            ../../../include/db.h:319: warning: data definition has no type or storage class
            ../../../include/db.h:350: error: syntax error before "DB_ROW"
            action.c: In function `DBget_action_by_actionid':
            action.c:65: error: `PGresult' undeclared (first use in this function)
            action.c:65: error: (Each undeclared identifier is reported only once
            action.c:65: error: for each function it appears in.)
            action.c:65: error: `result' undeclared (first use in this function)
            action.c:66: error: syntax error before "row"
            action.c:74: error: `row' undeclared (first use in this function)
            For the pure compilation, the following is sufficient. But there are still open issues with the database logic (not dived into yet because of workload):

            diff -ur zabbix-1.1.orig/configure.in zabbix-1.1/configure.in
            --- zabbix-1.1.orig/configure.in 2006-05-31 08:32:36.000000000 +0200
            +++ zabbix-1.1/configure.in 2006-06-07 10:44:57.000000000 +0200
            @@ -656,7 +656,7 @@
            dnl To avoid linking of crypt with the agent
            dnl AC_CHECK_FUNC(crypt, , AC_CHECK_LIB(crypt, crypt, LIBS="-lcrypt $LIBS"))
            dnl AC_CHECK_FUNC(crypt, , AC_CHECK_LIB(crypt, crypt, PGSQL_LFLAGS="-lcrypt $PGSQL_LFLAGS"))
            - AC_CHECK_FUNC(crypt, , AC_CHECK_LIB(crypt, crypt, PGSQL_LIBS="-lcrypt"))
            + AC_CHECK_FUNC(crypt, , AC_CHECK_LIB(crypt, crypt, PGSQL_LIBS="$PGSQL_LIBS -lcrypt"))

            AC_DEFINE(HAVE_PGSQL,1,[Define to 1 if PostgreSQL should be enabled.])
            AC_MSG_RESULT(yes)
            diff -ur zabbix-1.1.orig/include/db.h zabbix-1.1/include/db.h
            --- zabbix-1.1.orig/include/db.h 2006-05-26 14:13:17.000000000 +0200
            +++ zabbix-1.1/include/db.h 2006-06-07 10:13:50.000000000 +0200
            @@ -34,6 +34,10 @@
            #define DB_HANDLE MYSQL
            #endif

            +#ifdef HAVE_PGSQL
            + #include "libpq-fe.h"
            +#endif
            +
            #ifdef HAVE_ORACLE
            #include "sqlora.h"
            #endif
            @@ -70,6 +74,7 @@
            #ifdef HAVE_PGSQL
            #define DB_RESULT PGresult *
            #define DBfree_result PQclear
            + #define DB_ROW char **
            #endif

            #ifdef HAVE_ORACLE
            diff -ur zabbix-1.1.orig/src/libs/zbxdbhigh/db.c zabbix-1.1/src/libs/zbxdbhigh/db.c
            --- zabbix-1.1.orig/src/libs/zbxdbhigh/db.c 2006-06-02 14:36:06.000000000 +0200
            +++ zabbix-1.1/src/libs/zbxdbhigh/db.c 2006-06-07 10:21:12.000000000 +0200
            @@ -142,7 +142,7 @@
            #ifdef HAVE_PGSQL
            PGresult *result;

            - aabbix_log( LOG_LEVEL_DEBUG, "Executing query:%s",query);
            + zabbix_log( LOG_LEVEL_DEBUG, "Executing query:%s",query);
            result = PQexec(conn,query);

            if( result==NULL)
            @@ -325,7 +325,7 @@
            return mysql_insert_id(&mysql);
            #endif
            #ifdef HAVE_PGSQL
            -#error SUPPORT OF POSTGRESQL NOT IMPLEMENTED YET
            + return FAIL;
            #endif
            #ifdef HAVE_ORACLE
            return FAIL;
            Last edited by Zapnix; 08-06-2006, 13:04.

            Comment

            • jmgoodwin
              Junior Member
              • Jun 2006
              • 1

              #7
              segfault

              That seems to get things to compile, but the zabbix_server segfaults. I traced it, and it looks like it may be the PQclear call causing it. I haven't made any progress with it at this point, but here's output from strace if that helps anyone.

              connect(0, {sa_family=AF_FILE, path="/var/run/postgresql/.s.PGSQL.5432"}, 110) = 0
              getsockopt(0, SOL_SOCKET, SO_ERROR, "\0\0\0\0", [23550989311148036]) = 0
              getsockname(0, {sa_family=AF_FILE, path=@}, [2]) = 0
              poll([{fd=0, events=POLLOUT|POLLERR, revents=POLLOUT}], 1, -1) = 1
              rt_sigaction(SIGPIPE, {SIG_IGN}, {0x408dd0, [], 0x4000000}, 8) = 0
              sendto(0, "\0\0\0%\0\3\0\0user\0zabbix\0database\0zab".. ., 37, 0, NULL, 0) = 37
              rt_sigaction(SIGPIPE, {0x408dd0, [], SA_RESTART|0x4000000}, {SIG_IGN}, 8) = 0
              poll([{fd=0, events=POLLIN|POLLERR, revents=POLLIN}], 1, -1) = 1
              recvfrom(0, "R\0\0\0\10\0\0\0\0S\0\0\0\34client_encoding\0UN". .., 16384, 0, NULL, NULL) = 163
              rt_sigaction(SIGPIPE, {SIG_IGN}, {0x408dd0, [], SA_RESTART|0x4000000}, 8) = 0
              sendto(0, "Q\0\0\0+select refresh_unsupported "..., 44, 0, NULL, 0) = 44
              rt_sigaction(SIGPIPE, {0x408dd0, [], SA_RESTART|0x4000000}, {SIG_IGN}, 8) = 0
              poll([{fd=0, events=POLLIN|POLLERR, revents=POLLIN}], 1, -1) = 1
              recvfrom(0, "T\0\0\0,\0\1refresh_unsupported\0\0\0B\367\0" ..., 16384, 0, NULL, NULL) = 77
              --- SIGSEGV (Segmentation fault) @ 0 (0) ---
              Process 14808 detached

              Comment

              • Zapnix
                Junior Member
                • Apr 2006
                • 13

                #8
                Re: segfault

                Hello,

                my segfault seems to occur at a different position. Just fixed the DB schema (attached in zip file) and isolated the query causing the crash, to dive in further.
                Attached Files

                Comment

                • GateKeeper
                  Junior Member
                  • Mar 2006
                  • 23

                  #9
                  Alexey has said that PostgreSQL is coming back in the 1.1.1 Stable. So, wait! That's great that PostgreSQL functionality will be turned on back by the project develompent team instead of peolpe's own patches.

                  Comment

                  • Alexei
                    Founder, CEO
                    Zabbix Certified Trainer
                    Zabbix Certified SpecialistZabbix Certified Professional
                    • Sep 2004
                    • 5654

                    #10
                    Yes, i'd like to confirm that ZABBIX 1.1 does not support PostgreSQL. The support will be brought back in ZABBIX 1.1.1 (next stable minor release).
                    Alexei Vladishev
                    Creator of Zabbix, Product manager
                    New York | Tokyo | Riga
                    My Twitter

                    Comment

                    • Zapnix
                      Junior Member
                      • Apr 2006
                      • 13

                      #11
                      Originally posted by Alexei
                      Yes, i'd like to confirm that ZABBIX 1.1 does not support PostgreSQL. The support will be brought back in ZABBIX 1.1.1 (next stable minor release).
                      Theat's really good news, thanks!

                      Comment

                      • schneck
                        Member
                        • May 2006
                        • 62

                        #12
                        is it there yet?

                        Originally posted by Alexei
                        Yes, i'd like to confirm that ZABBIX 1.1 does not support PostgreSQL. The support will be brought back in ZABBIX 1.1.1 (next stable minor release).
                        while checking 1.1.1, I've found no changes in src/libs/zbxdbhigh/db.c ... so I guess PostgreSQL support didn't make the 1.1.1 cut? Or did I miss something?

                        Thanks,

                        \B.

                        Comment

                        • Alexei
                          Founder, CEO
                          Zabbix Certified Trainer
                          Zabbix Certified SpecialistZabbix Certified Professional
                          • Sep 2004
                          • 5654

                          #13
                          Please read the release notes carefully. Support of PostgreSQL was postponed to 1.1.2.
                          Alexei Vladishev
                          Creator of Zabbix, Product manager
                          New York | Tokyo | Riga
                          My Twitter

                          Comment

                          • schneck
                            Member
                            • May 2006
                            • 62

                            #14
                            release notes

                            Ooops ... sometimes people who can read really have an advantage :-/

                            I skipped directly to the what's new section and missed the notice.

                            Sorry.

                            \B.

                            Comment

                            Working...