From 0a44237cfab91dd92aa2f3302330335ddd2497c5 Mon Sep 17 00:00:00 2001 From: 3err0 Date: Tue, 25 Jun 2019 14:27:34 +0800 Subject: [PATCH] change filter to search host --- zabbixhost.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/zabbixhost.py b/zabbixhost.py index e957737..6f7602a 100644 --- a/zabbixhost.py +++ b/zabbixhost.py @@ -122,14 +122,17 @@ class ZabbixAPI: "jsonrpc": "2.0", "method": "host.get", "params": { - "filter": { + "output": [ + "host" + ], + "search": { "host": hostname } - }, + }, "auth": self.auth, "id": 1 }) response = requests.post(self.zabbix_url, parameter, headers=self.header).text 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) \ No newline at end of file