Ad Widget

Collapse

Relinking template and keeping history from old template's items

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Emir Imamagic
    Member
    • Mar 2008
    • 67

    #1

    Relinking template and keeping history from old template's items

    Hello,

    on couple of occasions I ran into following problem:
    - host is linked to a template A
    - at certain point subset of items & triggers needs to be tuned
    - I create template B and copy everything from template A and perform tune items & triggers
    - I unlink and clear template A from host and link template B.
    In the last step I practically loose all data for items which are present in template B. However, if I don't perform "unlink and clear" but rather "unlink", linking with template B creates duplicated items.

    My question is - is there a way to perform this type of relinking without loosing data?

    Comment 1: usually this is done on set of hosts, otherwise a simple unlink and tuning individual items & trigger for the particular host would be an obvious solution.

    Comment 2: I understand that from the point of organization of items in database this isn't a trivial issue. However, this scenario has happened to me already more than couple of times and I'm quite sure it will happen again. My installation is still not in production and I need to find a sensible way to relink hosts without loosing data before putting everything in production.

    Thanks in advance,
    emir
  • Emir Imamagic
    Member
    • Mar 2008
    • 67

    #2
    I'd like to add one possible solution I see here:
    - in last step perform unlink without clear of template A
    - change link procedure to check if item or trigger with existing name already exists; if the name exists update all fields of existing items (thus keeping the ID and links with history) instead of adding a new item
    - user would then be responsible for cleaning all items&triggers which are in the template A and not in the template B.

    Cheers,
    emir

    Comment

    • richlv
      Senior Member
      Zabbix Certified Trainer
      Zabbix Certified SpecialistZabbix Certified Professional
      • Oct 2005
      • 3112

      #3
      what exactly do you refer to as 'tuning' ?
      from my experience (and as just tested on current trunk), items usually are correctly relinked.
      which entities are not relinked as expected (items/triggers/graphs/other) ?
      what properties of such entities have been changed ?
      Zabbix 3.0 Network Monitoring book

      Comment

      • Emir Imamagic
        Member
        • Mar 2008
        • 67

        #4
        Originally posted by richlv
        what exactly do you refer to as 'tuning' ?
        For example I have template TemplateWindows which contains items/triggers/graphs for all Windows boxes. At certain point for the set of machines (e.g. laptops belonging to specific sector of company) I need to modify template, meaning add/modify/remove items/triggers/graphs. I create new template TemplateWindowsLaptopsC and would like to unlink the TemplateWindows and link the TemplateWindowsLaptopsC to those machines, while of course keeping the history.

        Originally posted by richlv
        from my experience (and as just tested on current trunk), items usually are correctly relinked.
        I didn't stress that I'm still using version 1.4. Could you describe me the procedure you used?

        Originally posted by richlv
        which entities are not relinked as expected (items/triggers/graphs/other) ?
        what properties of such entities have been changed ?
        As I described, I tried:
        - using "Unlink" without clear of old tempalte, then link host with new template (TemplateWindowsLaptopsC) and ended up with duplicates.
        - using "Unlink and clear" and all the data was gone
        - simply linking a new template while keeping the old one and ended up with Conflict in templates because of the same entity names.

        Thanks,
        emir

        Comment

        • richlv
          Senior Member
          Zabbix Certified Trainer
          Zabbix Certified SpecialistZabbix Certified Professional
          • Oct 2005
          • 3112

          #5
          well, i think it depends on what are you modifying for those entities.
          for a quick test on a fresh trunk test system i cloned template_linux & default linux host.
          then i unlinked second host from the template 7 linked it with the cloned template - all items & triggers were correctly relinked to the second template.

          now, if i had changed an item description & key, i'm quite positive it would have been created as another item - but then i have no idea how we can expect zabbix to know this should be treated as the same item

          also, are you using latest, 1.4.6 ?
          Zabbix 3.0 Network Monitoring book

          Comment

          • Emir Imamagic
            Member
            • Mar 2008
            • 67

            #6
            ok it seems I was wrong from the beginning. Unlink without clear and then link with new template indeed relinks items/triggers/graphs. Unfortunately I can't reproduce the error anymore. I've played a bit with 1.6 and it seems it works fine in all cases. If I come across the strange behavior again I'll let you know.

            Thanks for your help,
            emir

            Comment

            Working...