Advertisement
Guest User

Untitled

a guest
May 24th, 2018
336
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. from pyzabbix import ZabbixAPI
  2.  
  3. api_address=raw_input("enter correct URL to api_jsonrpc.php, like http://192.168.56.102/zabbix/api_jsonrpc.php"": \n")
  4.  
  5. #zbx_sessionid= raw_input("enter zbx_sessionid: \n")
  6.  
  7. user= raw_input("enter username: \n")
  8.  
  9. password= raw_input("enter password: \n")
  10.  
  11. #zapi = ZabbixAPI(api_address)
  12.  
  13. #zapi.login(user, password)
  14.  
  15. zapi = ZabbixAPI(url=api_address, user=user, password=password)
  16.  
  17. print("Connected to Zabbix API Version %s" % zapi.api_version())
  18.  
  19. for h in zapi.host.get(output="extend"):
  20.  
  21. hostid=h['hostid']
  22.  
  23. host=h['host']
  24.  
  25. print ("found host: ",host,"hostid: ",hostid)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement