added zabbix-agent

This commit is contained in:
Paolo Asperti 2019-03-19 19:16:52 +01:00
parent eef1ac29d3
commit d9bcc160fc
Signed by: paspo
GPG Key ID: 06D46905D19D5182
3 changed files with 61 additions and 0 deletions

12
zabbix-agent/Dockerfile Normal file
View File

@ -0,0 +1,12 @@
ARG BUILD_FROM
FROM $BUILD_FROM
ENV LANG C.UTF-8
# Copy scripts for add-on
COPY run.sh /
RUN apk add -U jq zabbix-agent sudo && \
chmod a+x /run.sh
CMD [ "/run.sh" ]

31
zabbix-agent/config.json Normal file
View File

@ -0,0 +1,31 @@
{
"name": "Zabbix Agent",
"url": "https://git.asperti.com/paspo/hassio-addons",
"version": "0.1.0",
"slug": "zabbix-agent",
"description": "Zabbix Agent for hass.io",
"startup": "services",
"boot": "auto",
"audio": false,
"gpio": false,
"arch": [
"aarch64",
"amd64",
"armhf",
"i386"
],
"ports": {
"10050/tcp": 10050
},
"map": [
"config"
],
"options": {
"server": "zabbix-server",
"hostname": "hassio"
},
"schema": {
"server": "str",
"hostname": "str"
}
}

18
zabbix-agent/run.sh Normal file
View File

@ -0,0 +1,18 @@
#!/bin/bash
set -e
CONFIG_PATH=/data/options.json
CUSTOM_CFG_PATH=/config/zabbix-agent
SERVER=$(jq --raw-output ".server" $CONFIG_PATH)
HOSTNAME=$(jq --raw-output ".hostname" $CONFIG_PATH)
echo "
Server=$SERVER
ServerActive=$SERVER
Hostname=$HOSTNAME
LogType=console
Include=/config/zabbix-agent/*.conf
" > /etc/zabbix/zabbix_agentd.conf
sudo -u zabbix zabbix_agentd -f