commit 6db6f46311c8b70367601d1e33550fef88caa9b0 Author: rainer Date: Wed Dec 27 18:41:07 2023 +0100 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b3aed04 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM zabbix/zabbix-agent2:alpine-6.4.10 + +USER root + +# force installation of python3 and pip3 +RUN apk add --update --no-cache python3 py3-pip \ + && rm -rf /var/cache/apk/* + +RUN pip3 install urbackup-server-web-api-wrapper + +COPY urbackup-discovery.py /usr/local/bin +RUN chmod +x /usr/local/bin/urbackup-discovery.py diff --git a/urbackup-discovery.py b/urbackup-discovery.py new file mode 100644 index 0000000..cb1d131 --- /dev/null +++ b/urbackup-discovery.py @@ -0,0 +1,30 @@ +#!/usr/bin/python3 +#!/usr/bin/env python3 +# +# ###################################### +# urbackup-discovery.py +# Part of urbackup-zabbix-template +# [https://github.com/rbicelli/urbackup-zabbix-template] +# ###################################### +# +# Requires urbackup-server-python-web-api-wrapper: https://github.com/uroni/urbackup-server-python-web-api-wrapper +# +# Short test to local urbackup server instance: +# urbackup-discovery.py "http://127.0.0.1:55414/x" "admin" "pasword" + +import urbackup_api +import json +import sys +import ssl + +# Disable certificate verification when connecting via HTTPS (otherwise, if the certificate is self-signed, connection will fail) +ssl._create_default_https_context = ssl._create_unverified_context + +server = urbackup_api.urbackup_server(sys.argv[1],sys.argv[2],sys.argv[3]) +i = 0 +print ("[", end='') +for client in server.get_status(): + if i > 0 : print("," , end='') + print(json.dumps(client)) + i += 1 +print ("]", end='')