Ad Widget

Collapse

Can someone provide a templates "how to"...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • KarmaPolice
    Member
    • Oct 2005
    • 95

    #1

    Can someone provide a templates "how to"...

    Now that 1.1 is finalized and all those issues surrounding templates are at a finality point (i won't say fixed)... realizing that templating works somewhat less than intuitively, i was hoping someone could provide the fundamentals (maybe with illustrations) as to how this beast within zabbix works...

    I know there have been a couple different versions of how tos that have cropped up in the forums, but i couldn't quickly find them, and am finally beginning to use templates....

    I'll publish it to the wiki when someone gets together a good one, cause i really have no idea how they work!...

    Thanks In Advance
  • dantheman
    Senior Member
    • May 2006
    • 209

    #2
    Basically each template acts like a host, in that you can create items and triggers for it.. and you can link it to another template.

    Say you setup templates A, B, C and D.

    You could add an item on template A for sending a ping to the host.

    Then on template B you add an item to check for free disk space
    and Link it to template A.

    Template C you add an item for checking incoming network traffic on eth0 and this is linked to template B

    Now on your hosts... Any hosts that you link to template A will only have the item for sending a ping..

    Any hosts that are linked to template B will have the Ping, and checking for free disk space.

    Any hosts that are linked to template C will have the ping check, the free disk space check, and the item for incoming packets on eth0.

    You end up chaining the templates and then when you link your host to a template, it will acquire any items/triggers/graphs that that template either has directly on it, or is included in a template that it is linked to.

    In the example above if you add an item to template A, all the other templates and hosts that are underneath template A will also get this item added to it.

    Hopefully I didn't just confuse you further.

    Comment

    • KarmaPolice
      Member
      • Oct 2005
      • 95

      #3
      actually, that clarifies things a lot... i really appreciate it...

      i guess my one confusion is, say i have a host linked to A... but now i want to link it to C... can i just change that on the fly... or will it remove items and do all kinds of weird stuff such that i lose data gathered while it was in template A...

      also... how... if at all... does this play along with Host Groups?

      Comment

      • dantheman
        Senior Member
        • May 2006
        • 209

        #4
        Ummm.... not sure if you lose data, or if it does all kinds of wierd things, I haven't tried making that change on any of my hosts...

        There aren't any connection to host groups as far as I can tell.

        Comment

        • KarmaPolice
          Member
          • Oct 2005
          • 95

          #5
          thanks for your responses... this helps clarify a lot for me...

          anyone else happen to be able to chime in on the A to C change which i mentioned above?

          Comment

          • raminix
            Member
            • Jun 2006
            • 37

            #6
            I'm not sure as to the data loss aspect, but I have done the exact thing you describe and what happens is all items, triggers and graphs associated with A will be deleted and all items, triggers and graphs from C will be added.

            If you manage to get graphs attached to a template to work correctly, let me know how you did. I keep getting duplicate key errors on the graph names when I add one to a template and no one here seems to know how to do it.

            Comment

            • raminix
              Member
              • Jun 2006
              • 37

              #7
              Ok, here's an update on the graph/template issue. I looked through the code and could find no reason for having a unique key on the graph name in the graph table, so I changed it to just a plain index, and that fixed the issue of duplicate keys when adding graphs to a template. I did all of the database upgrades from every version from 1.1 alpha 7 to 1.1 final, so I'm wondering if somewhere along the way the schema for that table changed and was not reflected in the updates.

              Comment

              • Zabbixazzer
                Junior Member
                • Jul 2006
                • 15

                #8
                Originally posted by raminix
                Ok, here's an update on the graph/template issue. I looked through the code and could find no reason for having a unique key on the graph name in the graph table, so I changed it to just a plain index, and that fixed the issue of duplicate keys when adding graphs to a template. I did all of the database upgrades from every version from 1.1 alpha 7 to 1.1 final, so I'm wondering if somewhere along the way the schema for that table changed and was not reflected in the updates.
                I've got a similar issue: I updated zabbix 1.1 beta7 to 1.1 final and I applied database patches.
                Now in the web frontend, if I go to Monitoring-->Latest Data, with every host I select, I've got this error, written in red text in a box at the bottom of the webpage:

                SQL error: Duplicate entry '0' for key 1
                Query: insert into profiles (userid,idx,value,valuetype) values (1,'web.latest.groupbyapp','1',0)

                SQL error: Duplicate entry '0' for key 1
                Query: insert into profiles (userid,idx,value,valuetype) values (1,'web.latest.applications','',1)


                How can I do the same thing you did (changing uinque key to plain index)?
                Maybe I should give commands from the mysql console? What commands should I use?

                Comment

                • Jabberwocky
                  Junior Member
                  • Jul 2006
                  • 3

                  #9
                  Does anybody know how to take all the items associated with a host and transfer them to a template? I managed to turn one of my templates into a host by accident and now I can no longer link things too it....

                  Comment

                  • SLMitch
                    Member
                    • May 2006
                    • 39

                    #10
                    If you know SQL, you can update all row concerned.

                    For your pb, i think there are not a lot of query : verify how zabbix make difference between an host and a template, in the php code.

                    Comment

                    Working...