change filter to search host
This commit is contained in:
parent
f01bea9824
commit
0a44237cfa
@ -122,14 +122,17 @@ class ZabbixAPI:
|
|||||||
"jsonrpc": "2.0",
|
"jsonrpc": "2.0",
|
||||||
"method": "host.get",
|
"method": "host.get",
|
||||||
"params": {
|
"params": {
|
||||||
"filter": {
|
"output": [
|
||||||
|
"host"
|
||||||
|
],
|
||||||
|
"search": {
|
||||||
"host": hostname
|
"host": hostname
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"auth": self.auth,
|
"auth": self.auth,
|
||||||
"id": 1
|
"id": 1
|
||||||
})
|
})
|
||||||
response = requests.post(self.zabbix_url, parameter, headers=self.header).text
|
response = requests.post(self.zabbix_url, parameter, headers=self.header).text
|
||||||
for i in json.loads(response)['result']:
|
for i in json.loads(response)['result']:
|
||||||
self.host_id.append(str(i['hostid']))
|
self.host_id.append(str(i['hostid']))
|
||||||
print(self.host_id)
|
print(self.host_id)
|
Loading…
Reference in New Issue
Block a user