You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
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
The text was updated successfully, but these errors were encountered: