We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8a53ed1 commit 114aa4bCopy full SHA for 114aa4b
zabbix_host_delete.py
@@ -57,7 +57,11 @@ def errmsg(msg):
57
host_list = f.readlines()
58
for hostname in host_list:
59
hostname = hostname.rstrip()
60
- hostid=zapi.host.get({"filter":{"host":hostname},"output":"hostid"})[0]["hostid"]
+ try:
61
+ hostid=zapi.host.get({"filter":{"host":hostname},"output":"hostid"})[0]["hostid"]
62
+ except Exception as e:
63
+ print "can not get hostid for host:{0}".format(hostname)
64
+ continue
65
print hostname,'\t',hostid
66
try:
67
result = zapi.host.delete([hostid])
0 commit comments