From f2b91422c7c6a5ee6ca8000822a8143717c91213 Mon Sep 17 00:00:00 2001 From: Paul Lecuq Date: Fri, 10 Feb 2023 13:53:05 +0100 Subject: [PATCH] updated zabbix state --- states/zabbix/defaults.yaml | 2 ++ states/zabbix/scripts/ipblc.py | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 states/zabbix/scripts/ipblc.py diff --git a/states/zabbix/defaults.yaml b/states/zabbix/defaults.yaml index a70748f..d926acd 100644 --- a/states/zabbix/defaults.yaml +++ b/states/zabbix/defaults.yaml @@ -16,6 +16,8 @@ zabbix: LogFile: /var/log/zabbix/zabbix_server.log LogType: file PidFile: /run/zabbix/zabbix_server.pid + StartDBSyncers: 1 + CacheSize: 33554432 agent: enable: true user: zabbix diff --git a/states/zabbix/scripts/ipblc.py b/states/zabbix/scripts/ipblc.py new file mode 100644 index 0000000..770fc22 --- /dev/null +++ b/states/zabbix/scripts/ipblc.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python3 + +import socket +import json + +HOST = "127.0.0.1" +PORT = 8060 + +with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: + s.connect((HOST, PORT)) + s.sendall(b"1") + data = bytes() + while True: + recv = s.recv(512) + if len(recv) > 0: + data += recv + else: + break + out = data.decode() + jsout = json.loads(out) + +print(len(jsout.keys()))