Ad Widget

Collapse

Patch for proper trigger dependency update on full clone

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • AdamLundrigan
    Junior Member
    • Jan 2008
    • 15

    #1

    Patch for proper trigger dependency update on full clone

    Hi All,

    I have noticed a slight problem with the "full clone" feature of hosts/templates. When cloning, the triggers are duplicated properly, however their dependencies are not. For instance, if I have the following triggers in HOST1: (number in brackets is the trigger ID)
    Code:
    HOST1:Trigger A (1)
        Dep:  HOST1:Trigger B (2)
    HOST1:Trigger B (2)
    And then full-clone HOST1 -> HOST2, the triggers will look like this:
    Code:
    HOST2:Trigger A (3)
        Dep:  HOST1:Trigger B (2)
    HOST2:Trigger B (4)
    instead of:
    Code:
    HOST2:Trigger A (3)
        Dep:  HOST[B]2[/B]:Trigger B ([B]4[/B])
    HOST2:Trigger B (4)
    as it should be. In essence, the cloned template's triggers which have dependencies will still depend on the triggers from the souce template.

    I urgently needed to be able to properly clone a few templates which have a moderate number of triggers with many interdependencies, so I created the following patch to fix the problem (attached).

    DISCLAIMER: I have not fully tested this patch. I have not checked to see if updating the corresponding C code is necessary. If you chose to use this patch, it is at your own risk. In order words, to quote the GPL:
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    GNU General Public License for more details.
    Enjoy!
    Attached Files
  • simix
    Member
    • Jul 2006
    • 53

    #2
    I just tried to do a full clone of a template and found that it doesn't clone applications as well. So the full clone feature is either not completed yet or it doesn't work the way I expected it...

    Comment

    • AdamLundrigan
      Junior Member
      • Jan 2008
      • 15

      #3
      Thanks for pointing that out....I completely missed it! I've updated the patches.

      Caveat: I've also noticed that when adding a template to a host, the triggers that the host receives do not have the dependency structure that the template's triggers have. The dependency structure is not copied at all. I am working on fixing this as well.

      Changes:
      • Added 'applications' box to the 'full clone' screen
      • Clone applications to new host during 'full clone'


      DISCLAIMER: I have not fully tested these patches. I have not checked to see if updating the corresponding C code is necessary. If you chose to use this patch, it is at your own risk. In order words, to quote the GPL:
      This program is distributed in the hope that it will be useful,
      but WITHOUT ANY WARRANTY; without even the implied warranty of
      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
      GNU General Public License for more details.
      Enjoy!
      Attached Files
      Last edited by AdamLundrigan; 06-01-2009, 20:36. Reason: Added caveat

      Comment

      • AdamLundrigan
        Junior Member
        • Jan 2008
        • 15

        #4
        I've updated the patch again, to fix the caveat mentioned above. This patch, and the last, were made against the original (unmodified) PHP code of Zabbix frontend for v1.6.1

        Changes:
        • Fixed issue: When attaching template to host, the trigger dependencies were not added for the host's triggers.


        DISCLAIMER: I have not fully tested these patches. I have not checked to see if updating the corresponding C code is necessary. If you chose to use this patch, it is at your own risk. In other words, to quote the GPL:
        This program is distributed in the hope that it will be useful,
        but WITHOUT ANY WARRANTY; without even the implied warranty of
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
        GNU General Public License for more details.
        Enjoy!
        Attached Files

        Comment

        • AdamLundrigan
          Junior Member
          • Jan 2008
          • 15

          #5
          I've updated the patch (again), to fix a slight issue. When attaching a template to a host, the triggers created for the host were no longer linked back to the trigger of the template.

          DISCLAIMER: I have not fully tested these patches. I have not checked to see if updating the corresponding C code is necessary. If you chose to use this patch, it is at your own risk. In other words, to quote the GPL:
          This program is distributed in the hope that it will be useful,
          but WITHOUT ANY WARRANTY; without even the implied warranty of
          MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
          GNU General Public License for more details.
          Enjoy!
          Attached Files

          Comment

          Working...