[ZBX-8013] Adding trigger dependency between templates fails when template is directly linked with hosts Created: 2014 Apr 01  Updated: 2020 Feb 24

Status: Open
Project: ZABBIX BUGS AND ISSUES
Component/s: Frontend (F)
Affects Version/s: 2.2.2
Fix Version/s: None

Type: Incident report Priority: Trivial
Reporter: Mika Tiainen Assignee: Unassigned
Resolution: Unresolved Votes: 14
Labels: dependencies, nested, templatelinking
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File ZBX-8013-fixtriggersearchinlinkedtemplates.patch     XML File hosts.xml     XML File templates.xml    
Issue Links:
Duplicate

 Description   

I have a template "Template App HTTP Service" that is directly linked to hosts. Trying to add a dependency from that to "Template ICMP Ping" which is linked to hosts through other templates fails with:

Updated: Trigger "HTTP service is down on

{HOST.NAME}" on "Template App HTTP Service".
Updated: Trigger "HTTP service is down on {HOST.NAME}

" on "host-xxx".
Cannot add dependency from a host to a template.

I have similar template "Template App SSH Service" that is linked to hosts through "Template OS Linux" adding the same dependency there works.



 Comments   
Comment by richlv [ 2014 Apr 01 ]

can you please reproduce this with a small set of templates/hosts and describe exact setup ?

Comment by Mika Tiainen [ 2014 Apr 01 ]

Okay, I have reproduced it with 5 templates and 2 hosts (attached).

"Template dependency test 1 & 2" have the triggers that I wan't to have a dependency on: "Template dependency test ICMP Ping:

{HOST.NAME}

is down". Adding it to test 1 works, adding to test 2 doesn't.

"test host 1" is linked to "Template dependency test OS 1" which is then linked to "Template dependency test ICMP Ping" & "Template dependency test 1"

"test host 2" is linked to "Template dependency test 2" & "Template dependency test OS 2" which is linked to "Template dependency test ICMP Ping"

Comment by Mika Tiainen [ 2014 Apr 01 ]

Export of templates & hosts needed to reproduce

Comment by Mika Tiainen [ 2014 Apr 01 ]

If I remove "test host 2" from "Template dependency test 2" I can add the trigger dependency, but adding the host back fails with:

Trigger in template "Template dependency test 2" has dependency with trigger in template "Template dependency test ICMP Ping".

Comment by richlv [ 2014 Apr 01 ]

that's still a very convoluted testcase (for example, i believe "Template dependency test 1", "Template dependency test OS 1" and "test host 1" have nothing to do with the problem), but i believe i have reproduced the problem

trunk r43953.

create a setup like this :

t1--link--t2
           \
          link
           /
t3--link--h1

now try to create a dependency from t3 to t1 like this :

t1--link--t2
^          \
dep       link
|          /
t3--link--h1

fails with :

Cannot add dependency from a host to a template. [triggers.php:178 → CAPIObject->update() → CAPIObject->__call() → czbxrpc::call() → czbxrpc::callAPI() → call_user_func() → CTrigger->update() → CTrigger->addDependencies() → CTrigger->addDependencies() → CTrigger->validateAddDependencies() → CTrigger->checkDependencies() → CZBXAPI::exception() in api/classes/CTrigger.php:1400]

Comment by Mika Tiainen [ 2014 Apr 02 ]

Yes, that behaves exactly the same way. Thank you for working it out.

Comment by Pavels Jelisejevs (Inactive) [ 2014 Apr 02 ]

I'm not sure where it is documented, but we don't support such dependencies. We only allow dependencies between templates, if both the templates are directly linked to the same host or template.

The error message is incorrect, though.

<richlv> i'll admit that i don't remember such a limitation - there was the case where we didn't allow a trigger to have an unresolved dependency on a lower level template, but that is not the case here

<richlv> for the record, this was discussed and we determined that this is a bug and should be fixed

Comment by Exploit Natixis [ 2014 Aug 20 ]

Please, do you have an idea of the fixed release ?
We have the same issue.
Thanks

Comment by Mickael Martin (Cyres) [ 2014 Nov 06 ]

Same issue :
I have a template generic (Zabbix) who check nodata on agent.ping and I want to create dependency with "no response on port 10050" (port 10050 closed). My template "port 10050" is linked with my Template Zabbix.
The dependency works on the template but I can't apply my zabbix agent template on a host :
Trigger in template "_T_Zbx2.2_Lin_AgentZabbix_test" has dependency with trigger in template "_T_SC_Port_Zabbix_10050". [hosts.php:482 → CAPIObject->update() → CAPIObject->__call() → czbxrpc::call() → czbxrpc::callAPI() → call_user_func() → CHost->update() → CHost->massUpdate() → CHost->massAdd() → CHostGeneral->massAdd() → CHostGeneral->link() → CHostBase->link() → CZBXAPI::exception() in /********************/api/classes/CHostBase.php:143]

Comment by Graham Kenville [ 2015 Feb 10 ]

I ran into this issue today.

When will it be fixed?

Comment by Arli [ 2015 Aug 10 ]

Until trigger.update is fixed, you could use trigger.deletedependencies + trigger.adddependencies... worked for me

Comment by Stefan Priebe [ 2016 Jan 31 ]

I'm willing to provide a patch. Can i just post it here? Is there anywhere something like github to provide a pull request?

Comment by Aleksandrs Saveljevs [ 2016 Feb 01 ]

Stefan, yes, you can simply post the patch here. At the moment we do not have a place like GitHub for pull requests.

Comment by Stefan Priebe [ 2016 Feb 02 ]

Attached is the patch to solve this.

Comment by Mickael Martin (Cyres) [ 2020 Feb 24 ]

Hello, can you add the patch for the 5.x version please ?

Generated at Thu Apr 25 04:30:38 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.