Created
May 30, 2019 11:51
-
-
Save ironbishop/1d4dffa89bf6e12614a159c1487f1a99 to your computer and use it in GitHub Desktop.
zabbix recursive template inclusion list
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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