Ad Widget

Collapse

Template dependency

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • coudy
    Junior Member
    • Mar 2012
    • 17

    #1

    Template dependency

    Hello,
    I search forum for template dependency, but can't find solution.
    I have installed Zabbix 2.0rc1 , where should be new functions.
    We have this installation:


    And I need trigger dependency in template.
    I'm using hostgroups Servers, Routers1, Routers2, Switches, PCs
    Hostgroup Servers contains Server1 .. Server X
    ...
    Hostgroup PCs contains PC1 .. PC X

    What I need is to create dependency in template, then link hosts to templates
    status of PC1..4 depend on status of switch
    status of Server depend on status of switch
    status of switch depend on status of router2
    status of router2 depend on status of router1
    status of router1 depend of status of DSL line

    I was able create this dependency in templates, but I can't link templates to hosts. I have this error

    Code:
    Trigger in template [ server ] has dependency with trigger in template [ router2 ] [CTemplate.update -> CTemplate.massUpdate -> CTemplate.massAdd -> CTemplate.link]
    here are exported templates
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <zabbix_export>
        <version>2.0</version>
        <date>2012-03-14T14:25:50Z</date>
        <groups>
            <group>
                <name>Templates_CS</name>
            </group>
            <group>
                <name>test</name>
            </group>
        </groups>
        <templates>
            <template>
                <template>router1</template>
                <name>router1</name>
                <groups>
                    <group>
                        <name>Templates_CS</name>
                    </group>
                    <group>
                        <name>test</name>
                    </group>
                </groups>
                <applications/>
                <items>
                    <item>
                        <name>link_router1</name>
                        <type>0</type>
                        <snmp_community></snmp_community>
                        <multiplier>0</multiplier>
                        <snmp_oid></snmp_oid>
                        <key>icmpping[&lt;ip&gt;,&lt;count&gt;,&lt;interval&gt;,&lt;size&gt;,&lt;timeout&gt;]</key>
                        <delay>30</delay>
                        <history>90</history>
                        <trends>365</trends>
                        <status>0</status>
                        <value_type>3</value_type>
                        <allowed_hosts></allowed_hosts>
                        <units></units>
                        <delta>0</delta>
                        <snmpv3_securityname></snmpv3_securityname>
                        <snmpv3_securitylevel>0</snmpv3_securitylevel>
                        <snmpv3_authpassphrase></snmpv3_authpassphrase>
                        <snmpv3_privpassphrase></snmpv3_privpassphrase>
                        <formula>1</formula>
                        <delay_flex></delay_flex>
                        <params></params>
                        <ipmi_sensor></ipmi_sensor>
                        <data_type>0</data_type>
                        <authtype>0</authtype>
                        <username></username>
                        <password></password>
                        <publickey></publickey>
                        <privatekey></privatekey>
                        <port></port>
                        <description></description>
                        <inventory_link>0</inventory_link>
                        <applications/>
                        <valuemap/>
                    </item>
                </items>
                <discovery_rules/>
                <macros/>
                <templates/>
                <screens/>
            </template>
            <template>
                <template>router2</template>
                <name>router2</name>
                <groups>
                    <group>
                        <name>Templates_CS</name>
                    </group>
                    <group>
                        <name>test</name>
                    </group>
                </groups>
                <applications/>
                <items>
                    <item>
                        <name>link_router2</name>
                        <type>3</type>
                        <snmp_community></snmp_community>
                        <multiplier>0</multiplier>
                        <snmp_oid></snmp_oid>
                        <key>icmpping[&lt;ip&gt;,&lt;count&gt;,&lt;interval&gt;,&lt;size&gt;,&lt;timeout&gt;]</key>
                        <delay>30</delay>
                        <history>90</history>
                        <trends>365</trends>
                        <status>0</status>
                        <value_type>3</value_type>
                        <allowed_hosts></allowed_hosts>
                        <units></units>
                        <delta>0</delta>
                        <snmpv3_securityname></snmpv3_securityname>
                        <snmpv3_securitylevel>0</snmpv3_securitylevel>
                        <snmpv3_authpassphrase></snmpv3_authpassphrase>
                        <snmpv3_privpassphrase></snmpv3_privpassphrase>
                        <formula>1</formula>
                        <delay_flex></delay_flex>
                        <params></params>
                        <ipmi_sensor></ipmi_sensor>
                        <data_type>0</data_type>
                        <authtype>0</authtype>
                        <username></username>
                        <password></password>
                        <publickey></publickey>
                        <privatekey></privatekey>
                        <port></port>
                        <description></description>
                        <inventory_link>0</inventory_link>
                        <applications/>
                        <valuemap/>
                    </item>
                </items>
                <discovery_rules/>
                <macros/>
                <templates/>
                <screens/>
            </template>
            <template>
                <template>server</template>
                <name>server</name>
                <groups>
                    <group>
                        <name>test</name>
                    </group>
                </groups>
                <applications/>
                <items>
                    <item>
                        <name>server_ping</name>
                        <type>0</type>
                        <snmp_community></snmp_community>
                        <multiplier>0</multiplier>
                        <snmp_oid></snmp_oid>
                        <key>icmpping[&lt;ip&gt;,&lt;count&gt;,&lt;interval&gt;,&lt;size&gt;,&lt;timeout&gt;]</key>
                        <delay>30</delay>
                        <history>90</history>
                        <trends>365</trends>
                        <status>0</status>
                        <value_type>3</value_type>
                        <allowed_hosts></allowed_hosts>
                        <units></units>
                        <delta>0</delta>
                        <snmpv3_securityname></snmpv3_securityname>
                        <snmpv3_securitylevel>0</snmpv3_securitylevel>
                        <snmpv3_authpassphrase></snmpv3_authpassphrase>
                        <snmpv3_privpassphrase></snmpv3_privpassphrase>
                        <formula>1</formula>
                        <delay_flex></delay_flex>
                        <params></params>
                        <ipmi_sensor></ipmi_sensor>
                        <data_type>0</data_type>
                        <authtype>0</authtype>
                        <username></username>
                        <password></password>
                        <publickey></publickey>
                        <privatekey></privatekey>
                        <port></port>
                        <description></description>
                        <inventory_link>0</inventory_link>
                        <applications/>
                        <valuemap/>
                    </item>
                </items>
                <discovery_rules/>
                <macros/>
                <templates/>
                <screens/>
            </template>
        </templates>
        <triggers>
            <trigger>
                <expression>{router1:icmpping[&lt;ip&gt;,&lt;count&gt;,&lt;interval&gt;,&lt;size&gt;,&lt;timeout&gt;].last(0)}=1</expression>
                <name>router1 status</name>
                <url></url>
                <status>0</status>
                <priority>0</priority>
                <description></description>
                <type>0</type>
                <dependencies/>
            </trigger>
            <trigger>
                <expression>{router2:icmpping[&lt;ip&gt;,&lt;count&gt;,&lt;interval&gt;,&lt;size&gt;,&lt;timeout&gt;].last(0)}=1</expression>
                <name>router2 status</name>
                <url></url>
                <status>0</status>
                <priority>0</priority>
                <description></description>
                <type>0</type>
                <dependencies>
                    <dependency>
                        <name>router1 status</name>
                        <expression>{router1:icmpping[&lt;ip&gt;,&lt;count&gt;,&lt;interval&gt;,&lt;size&gt;,&lt;timeout&gt;].last(0)}=1</expression>
                    </dependency>
                </dependencies>
            </trigger>
            <trigger>
                <expression>{server:icmpping[&lt;ip&gt;,&lt;count&gt;,&lt;interval&gt;,&lt;size&gt;,&lt;timeout&gt;].last(0)}=1</expression>
                <name>server status</name>
                <url></url>
                <status>0</status>
                <priority>0</priority>
                <description></description>
                <type>0</type>
                <dependencies>
                    <dependency>
                        <name>router2 status</name>
                        <expression>{router2:icmpping[&lt;ip&gt;,&lt;count&gt;,&lt;interval&gt;,&lt;size&gt;,&lt;timeout&gt;].last(0)}=1</expression>
                    </dependency>
                </dependencies>
            </trigger>
        </triggers>
    </zabbix_export>
    Is there a solution ?
  • shpin
    Junior Member
    • Apr 2012
    • 2

    #2
    I have same problem, but zabbix version is 1.8.11.

    Searchng this problem found: https://support.zabbix.com/browse/ZBX-4317

    There was problem with massupdate ("Yes, it's possible to link the template B by manual editing properties for every host"). But I trying to update a single host and got an error:
    Trigger in template [ ping_m100 ] has dependency with trigger in template [ ping ]
    Cannot link template
    Host update failed

    Comment

    • shpin
      Junior Member
      • Apr 2012
      • 2

      #3
      I do this:

      I have host Cisco 3750 M100 with a icmpping check.

      In trigger for ping on host dbb1 - i manyally add: "{Cisco 3750 M100:icmpping.last(0)}=1" (template: {host_name:check.func()}=condition )

      So i have this:
      {dbb1:icmpping.last(0)}=0 & {Cisco 3750 M100:icmpping.last(0)}=1

      and it works, when no ping on Cisco 3750 M100, and no ping on dbb1 - this trigger doesn't make any actions, but if we have ping on cisco device and haven't on dbb1 - it works.

      Comment

      • Yello
        Senior Member
        • Apr 2011
        • 309

        #4
        Hi,
        You cannot have trigger dependencies between templates. They must either be set up in one template or you can set up a "binding" template into which the other templates link. You can then set up the dependencies there. I would expect that to work.


        Regards,
        David

        Comment

        • coudy
          Junior Member
          • Mar 2012
          • 17

          #5
          bidning template ?

          Hi,
          I have upgraded to 2.0.3, and in docs is written , that I can link template trigger to template trigger:

          http://www.zabbix.com/documentation/...s/dependencies

          Code:
          Trigger dependency may be added from a template to a template. If a trigger from template A depends on a trigger from template B, template A may only be linked to a host (or another template) together with template B, but template B may be linked to a host (or another template) alone.
          I can manually in host server link trigger to host router trigger. But, host must not be linked to template. I want to use templates, because when I change something it is changed on all hosts.

          This option was available in some 1.8 versions of zabbix, but I don't know why it is removed.

          Other solution is as you written, create one template with all items and triggers, and create dependencies, then link all hosts to this template. This isn't good solution, because on router I'm checking other items as on servers and workstations.

          I'm attaching my example templates and hosts.

          Is there any solution to this problem ?
          Attached Files

          Comment

          • Yello
            Senior Member
            • Apr 2011
            • 309

            #6
            Originally posted by coudy

            Other solution is as you written, create one template with all items and triggers, and create dependencies, then link all hosts to this template. This isn't good solution, because on router I'm checking other items as on servers and workstations.
            That depends upon how you structure your templates and items. The approach is perfectly valid as I have used it. You may however think that thinking through your template and item structure is disadvantageous...

            While I don't have a strong opinion on this subject I do feel that the kind of inter-template dependencies you prefer binds templates together in a way that isn't obvious in the gui and could lead to opaque configurations. That is, once bound via dependencies template A & B are effectively one seeing as Template B must be bound to a host with template A because of the dependency of trigger(s) in A on triggers in B.

            Using a template to bridge the two makes the relationship explicit, rather than implicit, and decouples Template A from Template B.


            Regards,
            David

            Comment

            • coudy
              Junior Member
              • Mar 2012
              • 17

              #7
              Hi, it is difficult for me to imagine that (because English isn't my native language). Could you please show me example ?

              Comment

              Working...