This commit is contained in:
12
Dockerfile
Normal file
12
Dockerfile
Normal file
@@ -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
|
||||
30
urbackup-discovery.py
Normal file
30
urbackup-discovery.py
Normal file
@@ -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='')
|
||||
Reference in New Issue
Block a user