[ZBX-16411] Improve docs for template triggers and template items in Zabbix API Created: 2016 Feb 17  Updated: 2024 Apr 10  Resolved: 2020 Feb 14

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Documentation (D)
Affects Version/s: None
Fix Version/s: None

Type: Documentation task Priority: Trivial
Reporter: Praveen Kumar Assignee: Marina Generalova (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Team: Team D
Team: Team D
Sprint: Sprint 56 (Sep 2019), Sprint 55 (Aug 2019), Sprint 54 (Jul 2019), Sprint 57 (Oct 2019), Sprint 58 (Nov 2019), Sprint 59 (Dec 2019), Sprint 60 (Jan 2020), Sprint 61 (Feb 2020)

 Description   

Following 2 things required me to look for help in #zabbix, I guess it would be nicer if API docs cover these two things in the docs itself.

When user tries to create a template item it wasn't very clear how to assign an item to a template. The trick is to set hostid of the item to templateid of the template you want to assign it to. I was looking for templateid property in host object and got confused. This info on item.create page would be really helpful

When user tries to create trigger dependency it wasn't very clear that you can only add dependencies on the host level. I tried to create a dependency between template triggers which didn't work out. The trick here is to create triggers on template level then add dependencies on the host level. This info possibly on trigger.adddependencies page would be very helpful.



 Comments   
Comment by richlv [ 2016 Feb 17 ]

the second part doesn't seem to be correct, though - dependencies between template triggers should work

Comment by Praveen Kumar [ 2016 Feb 17 ]

I couldn't get it to work on template level, I kept getting "Cannot add dependency from a host to a template". And I was suggested to create template triggers and then define the dependencies on host level, which worked fine. Please feel free to correct me.

Comment by Oleksii Zagorskyi [ 2016 Feb 18 ]

Rich is right!
Praveen, you are wrong in 2nd part. Dependencies between triggers from templates can be added, then both such templates should be linked to a host simultaneously.

As for 1st part - in an item.get method documentation suggests properties "templateids" and "hostids", while for the item.create method only "hostid".
Interesting thing that both "templateids" and "hostids" works in item.get for both hosts and templates, i.e. you can get hosts using "templateids" and get templates using "hostids".
So "templateids" is, say, alias for "hostids", but only in the item.get method.

Not sure there is something to fix/improve in the doc.

Comment by Praveen Kumar [ 2016 Feb 18 ]

Thanks Oleksiy, as for the 2nd part - I'm not sure as I have template added to hosts already so as soon as I add a trigger to this template it gets added to all the hosts. By the time I add a different template trigger and add the other trigger as dependency, it's too late to add them simultaneously. So if they have to be done simultaneously, then I shouldn't add a template to hosts straight away and wait till all the dependent template triggers are added along with the dependencies and then add templates to the hosts simultaneously. Even these things have to be done simultaneously is new to me, and a worthy addition to doc I guess.

And as for the 1st part, I was trying to create an item, https://www.zabbix.com/documentation/2.4/manual/api/reference/item/object has templateid property which is a readonly property according to doc. So naturally I didn't use it, but I've been told to use hostid property as template id to add an item to template. Again the explanation on templateids and hostids are interchangable as you suggest would again be very useful in the doc for newbies like me.

Comment by Marina Generalova (Inactive) [ 2020 Feb 14 ]

Documentation updated:

  • API->trigger-> trigger.adddependencies "See also" section: 4.0, 4.4 and 5.0

 

Further API documentation updates are in progress as part of ZBX-15579.

Generated at Fri Apr 19 19:34:05 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.