Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- from pyzabbix.api import ZabbixAPI
- zapi = ZabbixAPI(url='http://localhost/zabbix/', user='ZABBIXUSERNAME', password='ZABBIXPASSWORD')
- TechHostName = str(sys.argv[1])
- def GetHostInformationZabbix(HostName):
- hostInformation = zapi.do_request('host.get',
- {
- "output":"extend",
- "filter":{
- "host":[HostName]
- }
- })
- HostID = hostInformation['result'][0]['hostid']
- return HostID,
- def DeleteHost(HostID):
- DeleteInterface = zapi.do_request('host.delete', # Deletes Host
- [HostID]
- )
- def Main(HostName):
- HostInfo= GetHostInformationZabbix(HostName) #passes back (hostid, Listofinterfaces) associated with that HOSTNAME in zabbix
- HostID = HostInformation[0]
- DeleteHost(HostID)
- Main(TechHostName)
Advertisement
Add Comment
Please, Sign In to add comment