Ad Widget

Collapse

auto registration bug (1.1 beta 7)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kevinappel
    Junior Member
    • Mar 2006
    • 21

    #1

    auto registration bug (1.1 beta 7)

    I traced code for the auto-registration and here is what I found:
    Inside the autoregister function, line 69 of autoregister.c, there is a check to see if the host is already in the database, if it is, then it will call the function to add it which fails because it is already there. I swapped the two lines of code and placed them in the else clause so if it doesnt find a match, then add the host:

    if(zbx_regexp_match(server, pattern, &len) != 0)
    {
    zabbix_log( LOG_LEVEL_DEBUG, "Matched [%s] [%s]",server,pattern);
    }
    else
    {
    zabbix_log( LOG_LEVEL_DEBUG, "No match [%s] [%s]",server,pattern);
    register_new_host(server, hostid);
    break;
    }

    This now worked to pick up new hosts, however I ran into another problem. Inside the add host function, it will call DBadd_template_to_host function and the sql is below.

    zabbix_log( LOG_LEVEL_DEBUG, "In DBadd_templates_to_host(%d,%d)", hostid, host_templateid);

    snprintf(sql,sizeof(sql)-1,"select templateid,items,triggers,graphs from hosts_templates where hostid=%d", host_templateid);

    I do not have any entries in the hosts_templates table, even though I have templates inside the hosts table.

    I was going to change the sql query but figured the table was there for a reason.
  • SAT QPass
    Member
    • Oct 2005
    • 61

    #2
    I cannot seem to even get Zabbix to auto assign a template at all currently. And I was able to reproduce your problem. Let me know if you find a way to not only register the host, but attach it to a template.

    Comment

    • kevinappel
      Junior Member
      • Mar 2006
      • 21

      #3
      Ok, well i got a little bit further. I am made a template off of a template and I am using this template for my autoregistration. Since my problem appears to be with the hosts_templates table, I did a one line insert:
      insert into hosts_templates (hostid,templateid,items,triggers,graphs) values ('10011','10001','7','7','1');

      Where 10011 is the id of my new template, and 10001 is the id of the template the new template was created from. I just picked random numbers for the remaining values.
      After doing this, I started at an agent and it picked up instantly and added with all the items the template had.

      So now that I can get this to work, does anybody have a clue on the correct way to populate the hosts_templates table?

      Comment

      • globifrosch
        Member
        • Sep 2005
        • 74

        #4
        autoregistration not working

        for me autoregistration is also not working.

        i turned on full debug messages in zabbix_server.conf, but there are only manual registred host's showing up.

        Comment

        • kevinappel
          Junior Member
          • Mar 2006
          • 21

          #5
          Did you try to make the change I posted and recompile the binaries for the server?

          This was my biggest problem, then secondly that hosts_templates table

          Comment

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

            #6
            The autoregistration is broken in 1.1beta7. Please give us some time to fix it.
            Alexei Vladishev
            Creator of Zabbix, Product manager
            New York | Tokyo | Riga
            My Twitter

            Comment

            Working...