From f8f9881034f115c9475b39cfdf9fff137a53ae6f Mon Sep 17 00:00:00 2001 From: djerfy Date: Thu, 11 Jan 2024 19:55:27 +0100 Subject: [PATCH] misc: improve sender configuration Signed-off-by: djerfy --- src/zabbix-kubernetes-discovery.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/zabbix-kubernetes-discovery.py b/src/zabbix-kubernetes-discovery.py index fac1f77..543ae46 100644 --- a/src/zabbix-kubernetes-discovery.py +++ b/src/zabbix-kubernetes-discovery.py @@ -39,15 +39,16 @@ logging.debug(f"-> Cluster name: {config['kubernetes']['name']}") def executeSender(data): - try: - for d in data: - if len(d) != 3: - logging.error(f"Invalid zabbix format: {d}") - host, key, value = d[0], d[1], d[2] - logging.info(f"host={host} key={key} value={value}") - zabbix.send_value(host, key, value) - except Exception as e: - logging.error(e) + for d in data: + if len(d) != 3: + logging.error(f"Invalid format: {d}") + host, key, value = d[0], d[1], d[2] + logging.info(f"Zabbix server request: host={host} key={key} value={value}") + try: + resp = zabbix.send_value(host, key, value) + logging.info(f"Zabbix server response: {resp}") + except Exception as e: + logging.error(e) def executeJobs(): while True: