paulbsd-salt/states/zabbix/scripts/ipblc.py
Paul 6c524f303e
All checks were successful
continuous-integration/drone/push Build is passing
updated zabbix state
2025-07-14 10:02:54 +02:00

24 lines
435 B
Python

#!/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.settimeout(2)
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()))