Ad Widget

Collapse

using templates in beta5 - no triggers?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Alexei
    Founder, CEO
    Zabbix Certified Trainer
    Zabbix Certified SpecialistZabbix Certified Professional
    • Sep 2004
    • 5654

    #16
    Pardon ? Then what are the differing IDs in between templates and hosts good for ?
    All right, what is real template then? I understand templates as something that is linked to host(s) and all changes made to a template are propagated to corresponding (linked) hosts. One ID or different IDs - this is up to implementation.

    Replace "get updated" with "should get updated" as i've seen it not happen, just was not in the mood to hunt down which cases they really are.
    If it does not happen, then it is a bug. I beleive that ZABBIX 1.1beta5 has it fixed.

    In a situation where you emulate templates by trying to keep things in sync by repeating copyies you get into several problems:

    - You must never forget to do these updates
    What updates?
    - You must track which Objects really are based on a template, and which have been modified locally. Once they are meant to be real copies, you must remember to stop copying.
    I agree.
    - All in all, complexity for the program will quickly become higher with copying than with real templates (given you use an API and not SQL directly from your clients).
    Not quite true. I don't have to worry about templating when selecting data from DB, for example. I just select items, no extra logic involved.

    Which is if you add another template on a template used by a host, predefined objects in that template won't appear in the host. Which probably just means that again, copying was forgotten. If they were real templates, this kind of issues wouldn't arise at all.
    Basically, see issue report earlier in the thread.
    Not implemented yet.

    In effect, without actually checking the DB, i would tend to think based on the external indicators, there is no chance i believe you saying there are real templates at work.
    I agree, but is it really necessary? If it is, a small modification to the GUI may help.

    In general, I agree that current implementation of templates (even if everything works as expected) is not very straight forward. It is quite confusing.

    Having said this, I do not see other way how this can be implemented nicely.

    Suppose we have real (in your understanding) templates. What if we want to add a new host-specific item to a host (not template)? How this can be implemented? Can we use several real templates for one host? Please explain. I'm really interested!
    Alexei Vladishev
    Creator of Zabbix, Product manager
    New York | Tokyo | Riga
    My Twitter

    Comment

    • [cc]smart
      Junior Member
      • May 2005
      • 25

      #17
      For a not so well thought answer during week (can take more time to look at it on weekend probably), from first sight i woul tend to suggest:

      - introduction of a new DB object "itemset". Contains no more than "itemsetid" and "name"

      - change table "items" so that "hostid" becomes "itemsetid"

      - add a referencing only table "hostXitemset" to allow for association in between "hostids" and "itemsetids".

      - change table "history" turning "itemid" column into a combined "hostiditemid" column.

      now you can have

      hosts:
      ID,name
      901,HostA
      902,HostB

      itemsets:
      ID,name
      101,os.basic.common
      102,os.basic.unix
      103,HostA
      104,os.basic.windows
      105,HostB

      items:
      ID,itemsetID,function
      201,101,version[zabbix_agent]
      202,101,system[uptime]
      203,102,vfs.fs.inode[/,free]
      204,103,vfs.fs.size[/only/i/have/this,free]
      205,104,diskfree[c:]
      206,105,diskfree[x:]

      hostXitemset:
      901,103
      901,101
      901,102
      902,105
      902,101
      902,104

      When you are parsing what items a host is to monitor, you take all entries in "hostXitemset" that have hostid matching and extract the itemsetids. Then you take all entries from "items" matching "itemsetid". You do not need an individual item of same function per host here. 901 and 902 can both use the same set 101.

      In table "history" you use combined IDs (whatever they look like in mysql, but they should be there; otherwise 2 columns are needed for full id).

      history:
      ID,timestamp,value
      901_201, xxx, 1
      901_201, xxx+1, 1


      History seems a bit starnge to me though, because it has no real ID, and to get things in right order you need to sort. Maybe this could be changed. If makes sense possibly like this:

      history:
      ID,hostID,itemID,prevID,nextID,timestamp,value
      801,901,201,NIL,803,xxx,1
      802,901,202,NIL,805,xxx,1h5m1s
      803,901,201,801,804,xxx+1,1
      804,901,201,803,NIL,xxx+2,1
      805,901,202,802,806,xxx+60,1h6m1s
      806,901,202,806,NIL,xxx+120,1h7m1s

      This way, timestamp becomes simple data. You do not meed it to get sorted graphs or such. On the other hand, if timestamp is readable by mysql, you can let mysql do more work for you, ignoring "next" and "previous". You would find the first entry by searching for NIL in prev and the last for NIL in next.

      Again, this is based on brief look on tables and what seems to me a short path from there not meant as a 1:1 implementation plan...


      Then a general question by the side... What do you do with old data or old function when the function of an item is changed ?


      One ID or different IDs - this is up to implementation.
      But there is the actual difference that starts complexity. For as long as you have only one object/one ID, chnages propagate automatically for you.

      Suppose we have real (in your understanding) templates. What if we want to add a new host-specific item to a host (not template)? How this can be implemented? Can we use several real templates for one host? Please explain. I'm really interested!
      In this example i made this time, there would be no difference between template part and host part. Host part would only mean you reference it no more than once.
      Last edited by [cc]smart; 11-01-2006, 17:15.

      Comment

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

        #18
        In fact it looks like current DB schema plus extra itemsetid in table "items".
        What if we leave everything as it is now and add extra field "templateid" (itemsetid) to table "items"?

        The GUI will also be updated to see what item belongs to what template. What do you think?
        Alexei Vladishev
        Creator of Zabbix, Product manager
        New York | Tokyo | Riga
        My Twitter

        Comment

        • [cc]smart
          Junior Member
          • May 2005
          • 25

          #19
          Originally posted by Alexei
          In fact it looks like current DB schema plus extra itemsetid in table "items".
          What if we leave everything as it is now and add extra field "templateid" (itemsetid) to table "items"?
          In items "hostid" is removed and replaced by "itemsetid" in my example. This is no big difference in first lace, except that you do not save all the host related data with an itemset.

          Th big difference is with the linking in hostXitemset. If you link to host directly from item, then any given item can not be related to more than one host.

          In the example you see that itemset 101 is referenced by both hosts 901 and 902, thus items 201 and 202 are referenced by both hosts.

          Since for that reason, data in "history" is no more unique to a given host if you reference itemid only, you need to reference both, itemid and hostid at the same time.


          Originally posted by Alexei
          The GUI will also be updated to see what item belongs to what template. What do you think?
          This you have already in your implementation. While you save both, templates and hosts in the same thing (which per se does not need to be a bad idea) you clearly see ownership of items, also by templates. The issue is, that items are copied from the template when "linked" to a host and become a new object. So from now on, if you want to imitate template behaviour, you'l have to think about when to and when not to update these copies. This is what tends to become a major headache.

          Comment

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

            #20
            Originally posted by [cc]smart
            Th big difference is with the linking in hostXitemset. If you link to host directly from item, then any given item can not be related to more than one host.

            In the example you see that itemset 101 is referenced by both hosts 901 and 902, thus items 201 and 202 are referenced by both hosts.
            All right, I see.
            Originally posted by [cc]smart
            This you have already in your implementation. While you save both, templates and hosts in the same thing (which per se does not need to be a bad idea) you clearly see ownership of items, also by templates. The issue is, that items are copied from the template when "linked" to a host and become a new object. So from now on, if you want to imitate template behaviour, you'l have to think about when to and when not to update these copies. This is what tends to become a major headache.
            No, I meant something different.

            Suppose you have an item created by host-template linkage. Currently GUI does not provide any information about the linkage on the item level. I suggest GUI to provide this information:

            Item | Key| Template

            System uptime | system.uptime | -
            Ping | agent.ping | Basic checks

            So, having this GUI implemented, an user may see that item 'Ping' is actually item of the template 'Basic checks'. Even more, there must be a restriction to edit this item directly. If user wants to edit this item, he must:

            1. Change item 'Ping' of template 'Basic checks', or
            2. Unlink this item from the template (thus making it not related to the template) and then edit it as a normal item

            I think such design will be very clear and understandable. What do you think?
            Alexei Vladishev
            Creator of Zabbix, Product manager
            New York | Tokyo | Riga
            My Twitter

            Comment

            • [cc]smart
              Junior Member
              • May 2005
              • 25

              #21
              Originally posted by Alexei
              Suppose you have an item created by host-template linkage. Currently GUI does not provide any information about the linkage on the item level. I suggest GUI to provide this information:

              Item | Key| Template

              System uptime | system.uptime | -
              Ping | agent.ping | Basic checks

              So, having this GUI implemented, an user may see that item 'Ping' is actually item of the template 'Basic checks'. Even more, there must be a restriction to edit this item directly. If user wants to edit this item, he must:

              1. Change item 'Ping' of template 'Basic checks', or
              2. Unlink this item from the template (thus making it not related to the template) and then edit it as a normal item

              I think such design will be very clear and understandable. What do you think?
              Yes, showing that items are copies of a template, and per the idea under control of Zabbix in this case, is a good idea in the context of the current implementation. With respect to database design you don't need to change anything for this, since hostid is identical to templateid afaik. So you can check in the host referenced by the item if its flagged as being a template and react on that.

              Er...

              at least that's what i thought. I'm just looking at the DB again and now i see "host_templates". This one irritates me because i originally see no real need for this, since the effect in program seems more or less identical to what host does. What's "templateid" in there ?

              In principle, it should still e valid to say that the data is there already and i guess the link should also exist already, because you seem to have the ability to identify template based items. Otherwise, no updates would have been possible yet for these when the template is changed.


              Doing this, you'll still stick with the problem of updating all template referencing items.

              About prohibiting the user to edit items in hosts directly, i don't think this is needed. If the user executes such a change, it would mean the item becomes a host-local item and for this item, the link to the template is removed.

              I feel though, that in long term you will have an easier job maintaining Zabbix when you don't copy.

              Comment

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

                #22
                I need some time to think about the best implementation. Thanks for the useful discussion! Let me know if you have anything else to discuss
                Alexei Vladishev
                Creator of Zabbix, Product manager
                New York | Tokyo | Riga
                My Twitter

                Comment

                • [cc]smart
                  Junior Member
                  • May 2005
                  • 25

                  #23
                  Maybe, for the 1.x series of Zabbix you would go with adding a marker for templated items to the GUI and for 2.x you might look at new possibilities.

                  Comment

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

                    #24
                    I absolutely agree.
                    Alexei Vladishev
                    Creator of Zabbix, Product manager
                    New York | Tokyo | Riga
                    My Twitter

                    Comment

                    • azilber
                      Member
                      • Apr 2005
                      • 33

                      #25
                      Caveats...

                      Originally posted by sterno
                      It's a little obscure and not entirely intuitive (at least to me), and unfortunately the documentation hasn't caught up to the new functionality. I just figured this out the other day.

                      1. Create a new template in the "Hosts" screen. Put it in the templates group and set the status to "template". Do not add any items to this template.

                      2. From the drop-down menu at the upper-right, select "Hosts/templates Linkage". You should get an empty screen.

                      3. There will be a second row of menus to select a host. Select the template you just created.

                      4. In the middle of the page you'll see a box labeled "Template". Pick an existing template with real items, such as "Host.Unix", and click "add linkage". Optionally, add more templates in the same way.

                      5. Go back to the hosts screen (top-right menu).

                      6. Create a new host for a real machine. In the "use templates of this host" field, select the template you created in step 1.


                      The part that I found confusing was the multiple layers of templating required - first you create a template with the things you want to monitor, then you create another template that just links to that, and then you create a real host connected to that second template. You can't directly link a host to that first template, though you can copy all of its items to a host.

                      Maybe this could be simplified by defining some naming conventions or other organization for the different types of template....
                      I would like to add an important issue. Following these directions on an already created host doesnt work. You actually have to follow these steps in order, at least for the template linkage part. If you already have a host, and you choose UPDATE. It will NOT work. I had to delete the host, re-create it with "use templates of this host", then the items will get populated. WHEW! What a headache.
                      Last edited by azilber; 24-01-2006, 19:34. Reason: spelling

                      Comment

                      Working...