Ad Widget

Collapse

Bug (1.8.2) when linking templates with dependencies

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • spblue
    Junior Member
    Zabbix Certified Specialist
    • Nov 2009
    • 9

    #1

    Bug (1.8.2) when linking templates with dependencies

    Since version 1.8 of Zabbix, we've had problems linking templates to hosts. We thought it was fixed in 1.8.2 but it's still there. Basically, when you have a template that has a trigger that is dependant on another template, you cannot link it to a host. Example with two templates:

    Template A (Server)
    Trigger : Server is down
    Dependency : Template B trigger Switch is down

    Template B (Switch)
    Trigger : Switch is down

    If you try to add Template A to a host, you get an error. You have to manually remove the dependency on Template A, then re-add it afterwards. This is extremely time consuming. Is there any workaround?
  • spblue
    Junior Member
    Zabbix Certified Specialist
    • Nov 2009
    • 9

    #2
    Alexei,

    Can I get some feedback regarding this? Should I submit this bug officially somewhere else? We'd really like this acknowledged because we are monitoring thousands of hosts using templates depending on other templates and it's a showstopper for us. I understand it might not be a very high priority for you, but can you at least confirm that you're creating a bug track for it?

    Comment

    • bashman
      Senior Member
      • Dec 2009
      • 432

      #3
      I have the same problem, and I'm very interested in resolving it.
      978 Hosts / 16.901 Items / 8.703 Triggers / 44 usr / 90,59 nvps / v1.8.15

      Comment

      • jimmycappaert
        Junior Member
        • May 2010
        • 3

        #4
        I seem to have a similar problem, I described it on http://www.zabbix.com/forum/showthread.php?t=17337. I think it indeed has to do with dependencies, but I have the same problem just linking to blank templates with each other.

        I confirm that this problem is also present in 1.8.3.

        Perhaps some feedback from ZABBIX Support? Could you confirm this is probably a bug, so we can submit it, and that we're not overlooking something?

        Thanks

        Comment

        • danrog
          Senior Member
          • Sep 2009
          • 164

          #5
          What I've noticed is when you use discovery and setup the appropriate actions to add these host templates (and groups, etc...), you don't have this template/dependency issue (its a GUI issue). You do however, have a problem when you go to modify a host, but if you have cookie cutter systems, it shouldn't be a big deal to setup actions to cover all types of hosts.

          If you don't use discovery, then you can look at the API. There might be something there you could use until this gets fixed. I used the API to import a couple hundred URLs (with triggers [w/deps], and graphs). Here is my triggers import (please don't mock, I'm not a php coder ):

          Uses Farley's Zabbix PHP class (http://andrewfarley.com/php/zabbix-1...php-class-v1-0)

          Code:
          <?php
          require_once("ZabbixAPI.class.php");
          
          // This enables debugging, this is rather verbose but can help debug problems
          ZabbixAPI::debugEnabled(TRUE);
          
          // This logs into Zabbix, and returns false if it fails
          ZabbixAPI::login('http://localhost/zabbixdev2/','zabbix','zabbix')
              or die('Unable to login: '.print_r(ZabbixAPI::getLastError(),true));
          
          $webitems = ZabbixAPI::fetch_array('item','get',array('extendoutput'=>1, 'pattern'=>'Failed step of', 'webitems'=>1)) 
              or die('Unable to get hostgroup: '.print_r(ZabbixAPI::getLastError(),true));
          
          foreach ($webitems as $w) {
                  $hostname = ZabbixAPI::fetch_array('host','get',array('extendoutput'=>1,'hostids'=>$w['hostid']));
                  $tr = "{".$hostname[0]['host'].":".$w['key_'].".last(0)}>0";
                  $gettr = ZabbixAPI::fetch_array('trigger','getObjects',array('expression'=>$tr,'hostid'=>$w['hostid']));
                  foreach($gettr as $g){
                  if (!isset($g['triggerid'])) {
                    print "NOTFOUND:".$tr."\n";
                    add_to_zab($tr);
                    $newget = ZabbixAPI::fetch_array('trigger','getObjects',array('expression'=>$tr,'hostid'=>$w['hostid']));
                      foreach($newget as $ng) {
                          print " NEWTRIGGER: ".$ng['triggerid']."\n";
                          $pingid = ZabbixAPI::fetch_array('trigger','get',array('extendoutput'=>1,'pattern'=>'is not responding to pings','hostids'=>$w['hostid'
          ]));
                          foreach($pingid as $p ) { 
                           print "  PINGID: ".$p['triggerid']."\n";
                           if(isset($ng['triggerid'])) { add_tr_depen($ng['triggerid'],$p['triggerid']); }
                          }
                      }
                  } else {
                    print "FOUND:".$tr."\n";
                  }
                  }
          
          }
          
          function add_to_zab($tr) {
          ZabbixAPI::query('trigger','add',array('expression'=>$tr,'description'=>'{HOSTNAME} Failed Web step','status'=>0,'priority'=>4));
          }
          function add_tr_depen($tr,$dep) {
          ZabbixAPI::query('trigger','addDependencies',array('triggerid'=>$tr,'depends_on_triggerid'=>$dep));
          }

          Comment

          Working...