Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

does it work with zabbix 3.2? #73

Open
mykolq opened this issue Aug 16, 2017 · 0 comments
Open

does it work with zabbix 3.2? #73

mykolq opened this issue Aug 16, 2017 · 0 comments

Comments

@mykolq
Copy link

mykolq commented Aug 16, 2017

Hello! i have zabbix 3.2 and one strange problem
#!/usr/bin/python3 from pyzabbix import ZabbixAPI import sys zabbix_server='http://localhost/zabbix' z = ZabbixAPI(zabbix_server) z.login('userhere','passhere') #z = ZabbixAPI('http://localhost/zabbix', user='kulikov',password='Dtctkjvjybnjhbv@2017') #get host name as parameter (it must be caught up from trigger) host_name=sys.argv[1] #template we add templateadd_name = 'Adaptec RAIDs SNMP_maxview_copy' #template we delete templatedel_name = 'test_raid_software' #get host_id hostinfo = z.host.get(filter={"host": host_name}, output="hostid") templateaddinfo = z.template.get(filter={"host": templateadd_name}, output="templateid") templatedelinfo = z.template.get(filter={"host": templatedel_name}, output="templateid") if hostinfo: host_id=hostinfo[0]["hostid"] #get template id for add templateadd_id=templateaddinfo[0]["templateid"] #get template id for delete (now we don't need template for checking software) templatedel_id=templatedelinfo[0]["templateid"] try: z.host.massadd(hosts={"hostid":host_id},templates={"templateid":templateadd_id},templates_clear={"templateid":templatedel_id}) #z.host.massadd(hosts={"hostid":host_id},templates_clear={"templateid":templatedel_id}) except ZabbixAPIException as e: print(e) sys.exit() else: print("No hosts found")
This script is working not any time and doesn't delete template

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant