Ad Widget

Collapse

Proxy database update error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gigatec
    Junior Member
    • Sep 2011
    • 15

    #1

    Proxy database update error

    Hi,

    installed 2.0.0 server and proxy. Server was updated from 1.8.12, proxy got a new and clean database from the supplied schema files.

    Now configuration sync with the proxy fails (last line):

    Code:
      9222:20120526:120857.949 Zabbix Proxy stopped. Zabbix 2.0.0 (revision 27675).
      9332:20120526:120956.794 Starting Zabbix Proxy (active) [proxy-server18]. Zabbix 2.0.0 (revision 27675).
      9332:20120526:120956.794 **** Enabled features ****
      9332:20120526:120956.794 SNMP monitoring:       YES
      9332:20120526:120956.794 IPMI monitoring:       YES
      9332:20120526:120956.794 ODBC:                   NO
      9332:20120526:120956.794 SSH2 support:           NO
      9332:20120526:120956.794 IPv6 support:          YES
      9332:20120526:120956.794 **************************
      9338:20120526:120956.817 proxy #1 started [configuration syncer #1]
      9332:20120526:120956.827 proxy #0 started [main process]
      9340:20120526:120956.828 proxy #3 started [data sender #1]
      9348:20120526:120956.832 proxy #11 started [trapper #2]
      9347:20120526:120956.833 proxy #10 started [trapper #1]
      9350:20120526:120956.833 proxy #13 started [trapper #4]
      9349:20120526:120956.833 proxy #12 started [trapper #3]
      9352:20120526:120956.834 proxy #15 started [icmp pinger #1]
      9351:20120526:120956.834 proxy #14 started [trapper #5]
      9339:20120526:120956.835 proxy #2 started [heartbeat sender #1]
      9353:20120526:120956.835 proxy #16 started [housekeeper #1]
      9353:20120526:120956.835 Executing housekeeper
      9354:20120526:120956.835 proxy #17 started [http poller #1]
      9356:20120526:120956.835 proxy #19 started [history syncer #1]
      9357:20120526:120956.836 proxy #20 started [history syncer #2]
      9359:20120526:120956.836 proxy #22 started [history syncer #4]
      9361:20120526:120956.837 proxy #24 started [ipmi poller #2]
      9363:20120526:120956.837 proxy #26 started [ipmi poller #4]
      9353:20120526:120956.851 Deleted 0 records from history [0.006326 seconds]
      9358:20120526:120956.853 proxy #21 started [history syncer #3]
      9360:20120526:120956.853 proxy #23 started [ipmi poller #1]
      9362:20120526:120956.853 proxy #25 started [ipmi poller #3]
      9364:20120526:120956.854 proxy #27 started [ipmi poller #5]
      9346:20120526:120956.907 proxy #9 started [unreachable poller #1]
      9342:20120526:120956.907 proxy #5 started [poller #2]
      9345:20120526:120956.924 proxy #8 started [poller #5]
      9344:20120526:120956.939 proxy #7 started [poller #4]
      9343:20120526:120956.944 proxy #6 started [poller #3]
      9341:20120526:120956.949 proxy #4 started [poller #1]
      9355:20120526:120956.950 proxy #18 started [discoverer #1]
      9338:20120526:120956.980 Received configuration data from server. Datalen 194264
      9338:20120526:120957.222 [Z3005] query failed: [1451] Cannot delete or update a parent row: a foreign key constraint fails (`zabbix_proxy`.`opgroup`, CONSTRAINT `c_opgroup_2` FOREIGN KEY (`groupid`) REFERENCES `groups` (`groupid`)) [delete from groups where groupid in (1,2,4,5);
    delete from expressions where expressionid between 1 and 4;
    delete from regexps where regexpid between 1 and 3;
    delete from dchecks where dcheckid=2;
    delete from drules where druleid=2;
    delete from interface where interfaceid=1;
    delete from hosts where hostid in (10001,10047,10050,10056,10060,10065,10066,10067,10068,10069,10070,10071,10072,10073,10074,10075,10076,10077,10078,10079,10081,10082,10083,10084);
    delete from globalmacro where globalmacroid=2;
    ]
      9338:20120526:120957.222[B] failed to update local proxy cofiguration copy: database error[/B]
    Before the error occured, I've added a few webchecks which should be executed by the proxy.

    Just tried with a clean proxy database and got this error on initial sync:

    Code:
      9731:20120526:121818.394 Starting Zabbix Proxy (active) [proxy-server18]. Zabbix 2.0.0 (revision 27675).
      9731:20120526:121818.394 **** Enabled features ****
      9731:20120526:121818.394 SNMP monitoring:       YES
      9731:20120526:121818.394 IPMI monitoring:       YES
      9731:20120526:121818.394 ODBC:                   NO
      9731:20120526:121818.394 SSH2 support:           NO
      9731:20120526:121818.394 IPv6 support:          YES
      9731:20120526:121818.394 **************************
      9737:20120526:121818.400 proxy #1 started [configuration syncer #1]
      9739:20120526:121818.408 proxy #3 started [data sender #1]
      9747:20120526:121818.412 proxy #11 started [trapper #2]
      9731:20120526:121818.415 proxy #0 started [main process]
      9749:20120526:121818.416 proxy #13 started [trapper #4]
      9751:20120526:121818.416 proxy #15 started [icmp pinger #1]
      9746:20120526:121818.417 proxy #10 started [trapper #1]
      9738:20120526:121818.417 proxy #2 started [heartbeat sender #1]
      9748:20120526:121818.417 proxy #12 started [trapper #3]
      9753:20120526:121818.418 proxy #17 started [http poller #1]
      9750:20120526:121818.418 proxy #14 started [trapper #5]
      9752:20120526:121818.419 proxy #16 started [housekeeper #1]
      9752:20120526:121818.419 Executing housekeeper
      9755:20120526:121818.419 proxy #19 started [history syncer #1]
      9756:20120526:121818.424 proxy #20 started [history syncer #2]
      9757:20120526:121818.425 proxy #21 started [history syncer #3]
      9758:20120526:121818.425 proxy #22 started [history syncer #4]
      9760:20120526:121818.426 proxy #24 started [ipmi poller #2]
      9762:20120526:121818.426 proxy #26 started [ipmi poller #4]
      9759:20120526:121818.429 proxy #23 started [ipmi poller #1]
      9761:20120526:121818.433 proxy #25 started [ipmi poller #3]
      9763:20120526:121818.433 proxy #27 started [ipmi poller #5]
      9752:20120526:121818.438 Deleted 0 records from history [0.001109 seconds]
      9745:20120526:121818.487 proxy #9 started [unreachable poller #1]
      9743:20120526:121818.489 proxy #7 started [poller #4]
      9754:20120526:121818.518 proxy #18 started [discoverer #1]
      9744:20120526:121818.537 proxy #8 started [poller #5]
      9742:20120526:121818.540 proxy #6 started [poller #3]
      9741:20120526:121818.540 proxy #5 started [poller #2]
      9740:20120526:121818.542 proxy #4 started [poller #1]
      9737:20120526:121818.564 Received configuration data from server. Datalen 194264
      9737:20120526:121819.007 [Z3005] query failed: [1451] Cannot delete or update a parent row: a foreign key constraint fails (`zabbix_proxy`.`opgroup`, CONSTRAINT `c_opgroup_2` FOREIGN KEY (`groupid`) REFERENCES `groups` (`groupid`)) [delete from applications where applicationid in (1,5,7,9,13,15,17,21,23,179,206,207,214,227,228,229,230,231,232,234,235,236,237,238,240,241,242,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,319,320,322,323,324,325,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355);
    delete from config where configid=1;
    delete from groups where groupid in (1,2,4,5);
    delete from expressions where expressionid between 1 and 4;
    delete from regexps where regexpid between 1 and 3;
    delete from dchecks where dcheckid=2;
    delete from drules where druleid=2;
    delete from interface where interfaceid=1;
    delete from hosts where hostid in (10001,10047,10050,10056,10060,10065,10066,10067,10068,10069,10070,10071,10072,10073,10074,10075,10076,10077,10078,10079,10081,10082,10083,10084);
    delete from globalmacro where globalmacroid=2;
    Any ideas?

    regards
    Stephan
    Last edited by gigatec; 26-05-2012, 12:23.
  • dimir
    Zabbix developer
    • Apr 2011
    • 1080

    #2
    Did you also load data.sql for proxy database? For a proxy database only the schema should be loaded to clean database.

    Comment

    • gigatec
      Junior Member
      • Sep 2011
      • 15

      #3
      Sorry for delay - with loading just schema.sql everything seems to work as expected.

      Problem solved :-)

      Comment

      • markl
        Member
        Zabbix Certified Specialist
        • Apr 2008
        • 62

        #4
        Thanks for posting this. I've just encountered the exact same error and was wondering what the heck I'd done wrong.

        Instructions for installation don't mention only loading the schema for the proxy (unless I've missed something).

        Thanks again.

        Mark.

        Comment

        • dimir
          Zabbix developer
          • Apr 2011
          • 1080

          #5
          http://www.zabbix.com/documentation/...zabbix_daemons

          In section "3. Create Zabbix database" it is mentioned:

          [...]
          SQL scripts are provided for creating database schema and, with Zabbix server, inserting a default dataset as well.
          [...]

          However, I agree that this is not mentioned explicitly enough. We will fix that in documentation. Thanks for pointing this out.

          Comment

          • skygge
            Member
            • Jun 2009
            • 46

            #6
            Hello,

            I have problems with proxy database (mysql 5.5) after upgrade.
            I did everything as mentioned above during proxy update from 1.8 to 2.0 (drop database, create empty database, import "schema.sql"). At this step I have no errors.

            But in zabbix_proxy.log I see:
            22442:20120615:151902.273 Received configuration data from server. Datalen 178475
            22442:20120615:151902.529 [Z3005] query failed: [1452] Cannot add or update a child row: a foreign key constraint fails (`zabbix`.`config`, CONSTRAINT `c_config_2` FOREIGN KEY (`discovery_groupid`) REFERENCES `groups` (`groupid`)) [insert into config (configid,refresh_unsupported,discovery_groupid,sn mptrap_logging) values (1,600,0,1);
            ]
            22442:20120615:151902.529 failed to update local proxy cofiguration copy: database error

            and then:
            22479:20120615:151934.139 cannot send list of active checks to [192.168.54.14]: host [db-xxx] not found
            22485:20120615:151937.834 cannot send list of active checks to [192.168.49.1]: host [rtr-yyy] not found
            22483:20120615:151941.193 cannot send list of active checks to [192.168.59.1]: host [rtr-zzz] not found
            ...
            ...
            all hosts "not found".

            Manually execute this SQL query returns error:

            mysql> insert into config (configid,refresh_unsupported,discovery_groupid,sn mptrap_logging) values (1,600,0,1);
            ERROR 1452 (23000): Cannot add or update a child row: a foreign key constraint fails (`zabbix`.`config`, CONSTRAINT `c_config_2` FOREIGN KEY (`discovery_groupid`) REFERENCES `groups` (`groupid`))

            What is wrong?
            Thanx
            Skygge
            Last edited by skygge; 15-06-2012, 16:16.

            Comment

            • dimir
              Zabbix developer
              • Apr 2011
              • 1080

              #7
              Are you using 1.8 server with proxy 2.0?

              Comment

              • skygge
                Member
                • Jun 2009
                • 46

                #8
                No, of course not. Server was updated before.

                I dropped this foreign key:
                mysql> ALTER TABLE `config` DROP FOREIGN KEY `c_config_2`;
                Query OK, 0 rows affected (0.01 sec)
                Records: 0 Duplicates: 0 Warnings: 0

                Then created it once again:
                mysql> ALTER TABLE `config` ADD CONSTRAINT `c_config_2` FOREIGN KEY (`discovery_groupid`) REFERENCES `groups` (`groupid`);
                Query OK, 0 rows affected (0.01 sec)
                Records: 0 Duplicates: 0 Warnings: 0

                And the Insert:
                mysql> insert into config (configid,refresh_unsupported,discovery_groupid,sn mptrap_logging) values (1,600,0,1);
                ERROR 1452 (23000): Cannot add or update a child row: a foreign key constraint fails (`zabbix`.`config`, CONSTRAINT `c_config_2` FOREIGN KEY (`discovery_groupid`) REFERENCES `groups` (`groupid`))
                Last edited by skygge; 18-06-2012, 11:05.

                Comment

                • skygge
                  Member
                  • Jun 2009
                  • 46

                  #9
                  UP.

                  I almost gave up.

                  I exported whole zabbix database, each table into separate text file, only data without table schema.

                  Then I created empty database, created schema from source 2.0 directory, and imported previously exported tables into new database. Everything went fine without any errors.

                  I configured Zabbix server and web interface to use this new database and I started it up.

                  On Zabbix Proxy I dropped database and re-created it from script.

                  Zabbix Proxy start and....

                  Z3005] query failed: [1452] Cannot add or update a child row: a foreign key constraint fails (`zabbix`.`config`, CONSTRAINT `c_config_2` FOREIGN KEY (`discovery_groupid`) REFERENCES `groups` (`groupid`)) [insert into config (configid,refresh_unsupported,discovery_groupid,sn mptrap_logging) values (1,600,0,1);

                  I almost lost my hope...

                  Comment

                  • dimir
                    Zabbix developer
                    • Apr 2011
                    • 1080

                    #10
                    Are you sure the proxy uses this new freshly created database?

                    Comment

                    • skygge
                      Member
                      • Jun 2009
                      • 46

                      #11
                      OK, I solved this issue.

                      I removed completely zabbix server database and whole database software including MySQL rpms and rm -fr /var/lib/mysql dir (database size was over 100GB ).

                      I installed newest MySQL version from scratch, created new empty database from source dir and imported every table one by one (data only, without the structure).

                      Now I have problems with triggers - all disappeared, but at last my Zabbix is collecting data. I'll fix the triggers manually.

                      Edit: Triggers fixed. See you on the next update!
                      Last edited by skygge; 18-08-2012, 15:08.

                      Comment

                      • gigatec
                        Junior Member
                        • Sep 2011
                        • 15

                        #12
                        Sorry to bring this up again - the proxy problem came back:

                        Code:
                        [Z3005] query failed: [1062] Duplicate entry '100100000010053-' for key 'applications_2' [insert into applications (applicationid,hostid) values (100100000000463,100100000010053);
                        insert into applications (applicationid,hostid) values (100100000000665,100100000010053);
                        
                        [Z3005] query failed: [1452] Cannot add or update a child row: a foreign key constraint fails (`zabbix_proxy`.`httptest`, CONSTRAINT `c_httptest_1` FOREIGN KEY (`applicationid`) REFERENCES `applications` (`app
                        insert into httptest (httptestid,name,applicationid,delay,macros,agent,authentication,http_user,http_password) values (100100000000011,'WEBSITE NAME',100100000000463,300,'','gigatec Monitoring',0,'','');
                        insert into httptest (httptestid,name,applicationid,delay,macros,agent,authentication,http_user,http_password) values (100100000000013,'WEBSITE NAME',100100000000463,300,'','gigatec Monitoring',0,'','');
                        insert into httptest (httptestid,name,applicationid,delay,macros,agent,authentication,http_user,http_password) values (100100000000014,'WEBSITE NAME',100100000000665,300,'','gigatec Monitoring',0,'','');
                        insert into httptest (httptestid,name,applicationid,delay,macros,agent,authentication,http_user,http_password) values (100100000000015,'WEBSITE NAME',100100000000665,300,'','gigatec Monitoring',0,'','');
                        
                        ...
                        Both server and proxy are version 2.0.2, I've already deleted the proxy database and restarted with a fresh 2.0.2 schema.sql on the proxy. Errors above appear on initial sync with the server. At least the last added webcheck which should run on the proxy keeps in state unknown.

                        MySQL: Server version: 5.1.63-0+squeeze1 (Debian)

                        Any help is welcome...

                        Thanks
                        Stephan

                        Comment

                        • lana_paradinha
                          Junior Member
                          • Sep 2013
                          • 28

                          #13
                          i received this erros

                          21586:20140319:104842.159 Received configuration data from server. Datalen 14107
                          21586:20140319:104842.388 [Z3005] query failed: [1451] Cannot delete or update a parent row: a foreign key constraint fails (`zabbix`.`host_discovery`, CONSTRAINT `c_host_discovery_3` FOREIGN KEY (`parent_itemid`) REFERENCES `items` (`itemid`)) [delete from items where (itemid between 10055 and 10059 or itemid between 22700 and 22744 or itemid between 22755 and 22789 or itemid between 22796 and 22846 or itemid between 22851 and 22863 or itemid between 22867 and 22886 or itemid between 22891 and 22903 or itemid between 22907 and 22914 or itemid between 22920 and 22924 or itemid between 22938 and 22954 or itemid between 22980 and 22994 or itemid between 22996 and 23005 or itemid between 23011 and 23036 or itemid between 23058 and 23063 or itemid between 23067 and 23078 or itemid between 23108 and 23131 or itemid between 23134 and 23138 or itemid between 23158 and 23165 or itemid between 23167 and 23329 or itemid between 23340 and 23360 or itemid between 23542 and 23569 or itemid between 23575 and 23579 or itemid between 23595 and 23608 or itemid between 23628 and 23659 or itemid in (10009,10010,10013,10014,10016,10019,10020,10025,1 0026,10030,17318,17350,17352,17354,17356,17358,173 60,17362,22181,22183,22185,22187,22189,22191,22196 ,22199,22219,22231,22232,22396,22399,22400,22401,2 2402,22404,22406,22408,22410,22412,22414,22416,224 18,22420,22422,22424,22426,22428,22430,22444,22446 ,22448,22450,22452,22454,22456,22458,22665,22668,2 2671,22674,22677,22680,22683,22686,22689,22746,227 49,22793,22848,22888,22917,22918,22933,22934,22961 ,22962,22963,22965,22968,22971,22972,22973,22974,2 2978,23007,23039,23041,23042,23043,23053,23054,231 40,23143,23144,23145,23147,23148,23149,23150,23540 ,23572,23573,23585,23586,23587,23588,23593,23620,2 3625))]
                          21586:20140319:104842.423 failed to update local proxy configuration copy: database error



                          My zabbix server is 2.2.2 and proxy is 2.2.2

                          Comment

                          Working...