Skip to content

Instantly share code, notes, and snippets.

@ironbishop
Created May 30, 2019 11:51
Show Gist options
  • Save ironbishop/1d4dffa89bf6e12614a159c1487f1a99 to your computer and use it in GitHub Desktop.
Save ironbishop/1d4dffa89bf6e12614a159c1487f1a99 to your computer and use it in GitHub Desktop.
zabbix recursive template inclusion list
from pyzabbix import ZabbixAPI
def get(z, templateid):
res = templateid
for t in templateid:
template = z.template.get(templateids=t, selectTemplates='extend')
parent_templates = [x['templateid'] for x in template[0]['templates']]
if parent_templates:
res = res + template_get(z, parent_templates)
return res
z = ZabbixAPI('http://.../api_jsonrpc.php')
z.login("...", "..")
print(get(z, ['15962']))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment