Ad Widget

Collapse

ERROR: Cannot add node

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • armstrongzhao
    Junior Member
    • Oct 2013
    • 6

    #1

    ERROR: Cannot add node

    Hello,

    My zabbix got a problem to add the master node on the child nodes.
    The master zabbix: 10.2.7.250
    The child zabbix: 10.2.7.177
    The master zabbix can add child node.
    The child zabbix can add child node.

    But the child zabbix got the following error when child zabbix add the master node.

    ERROR: Cannot add node
    Error in query [INSERT INTO nodes (nodeid,name,ip,port,nodetype,masterid) VALUES (1,'zabbix1','10.2.7.250','10051','2','NULL')] [Cannot add or update a child row: a foreign key constraint fails (`zabbix`.`nodes`, CONSTRAINT `c_nodes_1` FOREIGN KEY (`masterid`) REFERENCES `nodes` (`nodeid`))]

    zabbix version:2.0.8
    centos version:6.4_64bit
    mysql:5.1.66
    php: php-5.3.3-23.el6_4.x86_64
  • Pada
    Senior Member
    • Apr 2012
    • 236

    #2
    Hi & welcome to Zabbix forums!

    The standard Zabbix installation isn't meant for distributed setup, but only for proxies.

    Did you run the following yet?
    Code:
    zabbix_server -n <node id>
    It is required, as described in the manual: https://www.zabbix.com/documentation...nitoring/nodes

    Comment

    • armstrongzhao
      Junior Member
      • Oct 2013
      • 6

      #3
      Originally posted by Pada
      Hi & welcome to Zabbix forums!

      The standard Zabbix installation isn't meant for distributed setup, but only for proxies.

      Did you run the following yet?
      Code:
      zabbix_server -n <node id>
      It is required, as described in the manual: https://www.zabbix.com/documentation...nitoring/nodes
      Hi,man

      I have configured the master and child node as distributed monitoring ones.

      I runned the command.
      ./zabbix_server -n 1 -c /etc/zabbix_server.conf
      ./zabbix_server -n 2 -c /etc/zabbix_server.conf

      Both of the nodes can add child nodes.
      The problem is that the child nodes can not add master node. As long as the child node add the master node, child zabbix will display the upon error message.

      Comment

      • sudoer
        Junior Member
        • Oct 2013
        • 1

        #4
        Hi!

        Got absolutely same error. And btw got it works.

        It looks like zabbix bug. Let me explain why.

        After normal install, every node getting "Local master" record in "nodes" sql table.

        "masterid" field in "nodes" table means "who is master". If NULL - "Im master".

        So, when you adding new master, it trying to become master too!!!

        "INSERT INTO nodes (nodeid,name,ip,port,nodetype,masterid) VALUES (1,'zabbix1','10.2.7.250','10051','2','NULL')"

        I think, "foreign key" error is just because table contents TWO "NULL" records.

        To avoid this error, I just updated masterid from NULL to 1 (real master node's ID).

        So, you can try something like (for NEW installation) on child node:
        # mysql zabbix
        > update nodes set masterid=1;
        > INSERT INTO nodes (nodeid,name,ip,port,nodetype,masterid) VALUES (1,'zabbix1','10.2.7.250','10051','2','NULL');
        > exit

        Comment

        • armstrongzhao
          Junior Member
          • Oct 2013
          • 6

          #5
          Hi,
          Thanks for your reply.

          I updated zabbix to the latest 2.0.9.

          The error message disappeared. It is ok to add the master node on the child node.

          It must be a bug in the version 2.0.8

          Comment

          Working...