Compare commits
22 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
c925be77c5
|
|||
|
e6f5f4092c
|
|||
|
47d32d669b
|
|||
|
f05bb63007
|
|||
|
7759ca9ec7
|
|||
|
bcba8d258f
|
|||
|
1045ebebd0
|
|||
|
e0737632f8
|
|||
|
c37da6b538
|
|||
|
83e7d0bc1f
|
|||
|
eee92ba7f2
|
|||
|
3b8cab00ad
|
|||
|
c975d7d2b6
|
|||
|
46c224cd9f
|
|||
|
c2eef2b279
|
|||
|
b9fedb034e
|
|||
|
aac9975a01
|
|||
|
e09df09c87
|
|||
|
596b7d37b1
|
|||
|
ddba94f72d
|
|||
|
7309257569
|
|||
|
27a52b53e4
|
144
.drone.yml
144
.drone.yml
@@ -1,23 +1,159 @@
|
||||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: default
|
||||
name: build-amd64
|
||||
|
||||
platform:
|
||||
arch: amd64
|
||||
os: linux
|
||||
|
||||
steps:
|
||||
- name: build
|
||||
image: plugins/docker:linux-amd64
|
||||
settings:
|
||||
dockerfile: Dockerfile.amd64
|
||||
dry_run: true
|
||||
repo: docker.asperti.com/paspo/hassio-zabbix-agent2
|
||||
when:
|
||||
event:
|
||||
- push
|
||||
|
||||
- name: build_and_publish
|
||||
image: plugins/docker:linux-amd64
|
||||
settings:
|
||||
dockerfile: Dockerfile.amd64
|
||||
password:
|
||||
from_secret: docker_password
|
||||
registry: docker.asperti.com
|
||||
repo: docker.asperti.com/paspo/hassio-zabbix-agent2
|
||||
tags:
|
||||
- latest
|
||||
- ${DRONE_TAG}
|
||||
- ${DRONE_SEMVER_MAJOR}.${DRONE_SEMVER_MINOR}
|
||||
- latest-amd64
|
||||
- ${DRONE_TAG}-amd64
|
||||
- ${DRONE_SEMVER_MAJOR}.${DRONE_SEMVER_MINOR}-amd64
|
||||
username:
|
||||
from_secret: docker_username
|
||||
when:
|
||||
event:
|
||||
- tag
|
||||
|
||||
trigger:
|
||||
event:
|
||||
- tag
|
||||
- push
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: build-arm64
|
||||
|
||||
platform:
|
||||
arch: arm64
|
||||
os: linux
|
||||
|
||||
steps:
|
||||
- name: build
|
||||
image: plugins/docker:linux-arm64
|
||||
settings:
|
||||
dockerfile: Dockerfile.arm64
|
||||
dry_run: true
|
||||
repo: docker.asperti.com/paspo/hassio-zabbix-agent2
|
||||
when:
|
||||
event:
|
||||
- push
|
||||
|
||||
- name: build_and_publish
|
||||
image: plugins/docker:linux-arm64
|
||||
settings:
|
||||
dockerfile: Dockerfile.arm64
|
||||
password:
|
||||
from_secret: docker_password
|
||||
registry: docker.asperti.com
|
||||
repo: docker.asperti.com/paspo/hassio-zabbix-agent2
|
||||
tags:
|
||||
- latest-arm64
|
||||
- ${DRONE_TAG}-arm64
|
||||
- ${DRONE_SEMVER_MAJOR}.${DRONE_SEMVER_MINOR}-arm64
|
||||
username:
|
||||
from_secret: docker_username
|
||||
when:
|
||||
event:
|
||||
- tag
|
||||
|
||||
trigger:
|
||||
event:
|
||||
- tag
|
||||
- push
|
||||
|
||||
# ---
|
||||
# kind: pipeline
|
||||
# type: docker
|
||||
# name: build-arm
|
||||
|
||||
# platform:
|
||||
# arch: arm
|
||||
# os: linux
|
||||
|
||||
# steps:
|
||||
# - name: build
|
||||
# image: plugins/docker:linux-arm
|
||||
# settings:
|
||||
# dockerfile: Dockerfile.arm
|
||||
# dry_run: true
|
||||
# repo: docker.asperti.com/paspo/hassio-zabbix-agent2
|
||||
# when:
|
||||
# event:
|
||||
# - push
|
||||
|
||||
# - name: build_and_publish
|
||||
# image: plugins/docker:linux-arm
|
||||
# settings:
|
||||
# dockerfile: Dockerfile.arm
|
||||
# password:
|
||||
# from_secret: docker_password
|
||||
# registry: docker.asperti.com
|
||||
# repo: docker.asperti.com/paspo/hassio-zabbix-agent2
|
||||
# tags:
|
||||
# - latest-arm
|
||||
# - ${DRONE_TAG}-arm
|
||||
# - ${DRONE_SEMVER_MAJOR}.${DRONE_SEMVER_MINOR}-arm
|
||||
# username:
|
||||
# from_secret: docker_username
|
||||
# when:
|
||||
# event:
|
||||
# - tag
|
||||
|
||||
# trigger:
|
||||
# event:
|
||||
# - tag
|
||||
# - push
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: manifest
|
||||
|
||||
steps:
|
||||
- name: manifest
|
||||
image: plugins/manifest
|
||||
settings:
|
||||
force_tag: true
|
||||
ignore_missing: true
|
||||
spec: manifest.tmpl
|
||||
username:
|
||||
from_secret: docker_username
|
||||
password:
|
||||
from_secret: docker_password
|
||||
tags:
|
||||
- latest
|
||||
- ${DRONE_TAG}
|
||||
- ${DRONE_SEMVER_MAJOR}.${DRONE_SEMVER_MINOR}
|
||||
- ${DRONE_SEMVER_MAJOR}
|
||||
|
||||
trigger:
|
||||
event:
|
||||
- tag
|
||||
|
||||
depends_on:
|
||||
- build-amd64
|
||||
- build-arm64
|
||||
# - build-arm
|
||||
|
||||
12
Dockerfile
12
Dockerfile
@@ -1,12 +0,0 @@
|
||||
ARG BUILD_FROM=hassioaddons/base:8.0.6
|
||||
FROM $BUILD_FROM
|
||||
|
||||
ENV LANG C.UTF-8
|
||||
|
||||
# Copy scripts for add-on
|
||||
COPY run.sh /
|
||||
|
||||
RUN apk add -U jq zabbix-agent2=5.0.14-r1 sudo && \
|
||||
chmod a+x /run.sh
|
||||
|
||||
CMD [ "/run.sh" ]
|
||||
17
Dockerfile.amd64
Normal file
17
Dockerfile.amd64
Normal file
@@ -0,0 +1,17 @@
|
||||
ARG BUILD_FROM=ghcr.io/hassio-addons/base/amd64:16.2.0
|
||||
FROM $BUILD_FROM
|
||||
|
||||
ENV LANG C.UTF-8
|
||||
|
||||
COPY rootfs /
|
||||
|
||||
RUN \
|
||||
apk add --no-cache --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community zabbix-agent2=7.0.2-r0 zabbix-agent2-plugin-postgresql zabbix-agent2-plugin-alpine && \
|
||||
apk add --no-cache sudo && \
|
||||
addgroup -g 102 -S docker && \
|
||||
addgroup zabbix docker
|
||||
|
||||
LABEL \
|
||||
io.hass.version="0.3.0" \
|
||||
io.hass.type="addon" \
|
||||
io.hass.arch="amd64"
|
||||
17
Dockerfile.arm
Normal file
17
Dockerfile.arm
Normal file
@@ -0,0 +1,17 @@
|
||||
ARG BUILD_FROM=ghcr.io/hassio-addons/base/armhf:16.2.0
|
||||
FROM $BUILD_FROM
|
||||
|
||||
ENV LANG C.UTF-8
|
||||
|
||||
COPY rootfs /
|
||||
|
||||
RUN \
|
||||
apk add --no-cache --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community zabbix-agent2=7.0.2-r0 zabbix-agent2-plugin-postgresql zabbix-agent2-plugin-alpine && \
|
||||
apk add --no-cache sudo && \
|
||||
addgroup -g 102 -S docker && \
|
||||
addgroup zabbix docker
|
||||
|
||||
LABEL \
|
||||
io.hass.version="0.3.0" \
|
||||
io.hass.type="addon" \
|
||||
io.hass.arch="armhf"
|
||||
17
Dockerfile.arm64
Normal file
17
Dockerfile.arm64
Normal file
@@ -0,0 +1,17 @@
|
||||
ARG BUILD_FROM=ghcr.io/hassio-addons/base/aarch64:16.2.0
|
||||
FROM $BUILD_FROM
|
||||
|
||||
ENV LANG C.UTF-8
|
||||
|
||||
COPY rootfs /
|
||||
|
||||
RUN \
|
||||
apk add --no-cache --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community zabbix-agent2=7.0.2-r0 zabbix-agent2-plugin-postgresql zabbix-agent2-plugin-alpine && \
|
||||
apk add --no-cache sudo && \
|
||||
addgroup -g 102 -S docker && \
|
||||
addgroup zabbix docker
|
||||
|
||||
LABEL \
|
||||
io.hass.version="0.3.0" \
|
||||
io.hass.type="addon" \
|
||||
io.hass.arch="aarch64"
|
||||
@@ -2,4 +2,8 @@
|
||||
|
||||
This addon enables a zabbix agent2 for the hassio instance.
|
||||
|
||||
You obviously neead a zabbix server for it to be meaningful.
|
||||
You obviously need a zabbix server for it to be meaningful.
|
||||
|
||||
## Docker access
|
||||
|
||||
If you need the agent to access the underlying docker, you need to disable the "Protection mode" switch and restart the container.
|
||||
|
||||
13
config.json
13
config.json
@@ -2,23 +2,26 @@
|
||||
"name": "Zabbix Agent 2",
|
||||
"url": "https://git.asperti.com/paspo/hassio-addons",
|
||||
"image": "docker.asperti.com/paspo/hassio-zabbix-agent2",
|
||||
"version": "0.1.3",
|
||||
"version": "0.3.0",
|
||||
"slug": "zabbix-agent2",
|
||||
"description": "Zabbix Agent 2 for hass.io",
|
||||
"description": "Zabbix Agent 2 for hass.io (7.0 LTS)",
|
||||
"startup": "services",
|
||||
"boot": "auto",
|
||||
"hassio_api": true,
|
||||
"docker_api": true,
|
||||
"audio": false,
|
||||
"gpio": false,
|
||||
"init": false,
|
||||
"arch": [
|
||||
"aarch64",
|
||||
"amd64",
|
||||
"armhf",
|
||||
"i386"
|
||||
"amd64"
|
||||
],
|
||||
"ports": {
|
||||
"10050/tcp": 10050
|
||||
},
|
||||
"ports_description": {
|
||||
"10050/tcp": "Zabbix Agent port (used by Zabbix Server and/or proxies)"
|
||||
},
|
||||
"map": [
|
||||
"share"
|
||||
],
|
||||
|
||||
25
manifest.tmpl
Normal file
25
manifest.tmpl
Normal file
@@ -0,0 +1,25 @@
|
||||
image: docker.asperti.com/paspo/hassio-zabbix-agent2:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}}
|
||||
{{#if build.tags}}
|
||||
tags:
|
||||
{{#each build.tags}}
|
||||
- {{this}}
|
||||
{{/each}}
|
||||
{{/if}}
|
||||
manifests:
|
||||
-
|
||||
image: docker.asperti.com/paspo/hassio-zabbix-agent2:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}amd64
|
||||
platform:
|
||||
architecture: amd64
|
||||
os: linux
|
||||
-
|
||||
image: docker.asperti.com/paspo/hassio-zabbix-agent2:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}arm64
|
||||
platform:
|
||||
variant: v8
|
||||
architecture: arm64
|
||||
os: linux
|
||||
-
|
||||
image: docker.asperti.com/paspo/hassio-zabbix-agent2:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}arm
|
||||
platform:
|
||||
variant: v7
|
||||
architecture: arm
|
||||
os: linux
|
||||
9
rootfs/etc/cont-init.d/require_unprotected.sh
Executable file
9
rootfs/etc/cont-init.d/require_unprotected.sh
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Instead of enforcing this requirement, we let the user choose
|
||||
# if he/she wants to access docker: if so, disabling the "protection mode" is mandatory
|
||||
|
||||
exit 0
|
||||
|
||||
#!/usr/bin/with-contenv bashio
|
||||
#bashio::require.unprotected
|
||||
8
rootfs/etc/services.d/zabbix-agent2/finish
Executable file
8
rootfs/etc/services.d/zabbix-agent2/finish
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/execlineb -S0
|
||||
# ==============================================================================
|
||||
# Take down the S6 supervision tree when zabbix-agent2 fails
|
||||
# ==============================================================================
|
||||
if { s6-test ${1} -ne 0 }
|
||||
if { s6-test ${1} -ne 256 }
|
||||
|
||||
s6-svscanctl -t /var/run/s6/services
|
||||
41
rootfs/etc/services.d/zabbix-agent2/run
Executable file
41
rootfs/etc/services.d/zabbix-agent2/run
Executable file
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# ==============================================================================
|
||||
# Start zabbix-agent2 service if enabled
|
||||
# ==============================================================================
|
||||
|
||||
set -e
|
||||
|
||||
CONFIG_PATH=/data/options.json
|
||||
CUSTOM_CFG_PATH=/share/zabbix-agent2
|
||||
|
||||
SERVER_OLD=$(jq --raw-output ".server" $CONFIG_PATH)
|
||||
SERVER="$(bashio::config 'server' $SERVER_OLD)"
|
||||
HOSTNAME_OLD=$(jq --raw-output ".hostname" $CONFIG_PATH)
|
||||
HOSTNAME="$(bashio::config 'hostname' $HOSTNAME_OLD)"
|
||||
|
||||
if [ ! -d "$CUSTOM_CFG_PATH" ] ; then
|
||||
bashio::log.info "Creating a folder for custom configuration"
|
||||
mkdir -p "$CUSTOM_CFG_PATH"
|
||||
fi
|
||||
|
||||
echo "
|
||||
Server=$SERVER
|
||||
ServerActive=$SERVER
|
||||
Hostname=$HOSTNAME
|
||||
LogType=console
|
||||
PidFile=/var/run/zabbix/zabbix_agent2.pid
|
||||
Include=${CUSTOM_CFG_PATH}/*.conf
|
||||
" > /etc/zabbix/zabbix_agent2.conf
|
||||
|
||||
bashio::log.info "Starting zabbix-agent2"
|
||||
sudo -u zabbix zabbix_agent2 -f &
|
||||
AGENT_PID=$!
|
||||
|
||||
# Register stop
|
||||
function stop_agent() {
|
||||
killall zabbix_agent2
|
||||
exit 0
|
||||
}
|
||||
trap "stop_agent" SIGTERM SIGHUP
|
||||
|
||||
wait "${AGENT_PID}"
|
||||
22
run.sh
22
run.sh
@@ -1,22 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
CONFIG_PATH=/data/options.json
|
||||
CUSTOM_CFG_PATH=/share/zabbix-agent2
|
||||
|
||||
SERVER=$(jq --raw-output ".server" $CONFIG_PATH)
|
||||
HOSTNAME=$(jq --raw-output ".hostname" $CONFIG_PATH)
|
||||
|
||||
if [ ! -d "$CUSTOM_CFG_PATH" ] ; then
|
||||
mkdir -p "$CUSTOM_CFG_PATH"
|
||||
fi
|
||||
|
||||
echo "
|
||||
Server=$SERVER
|
||||
ServerActive=$SERVER
|
||||
Hostname=$HOSTNAME
|
||||
LogType=console
|
||||
Include=${CUSTOM_CFG_PATH}/*.conf
|
||||
" > /etc/zabbix/zabbix_agent2.conf
|
||||
|
||||
sudo -u zabbix zabbix_agent2 -f
|
||||
Reference in New Issue
Block a user