Compare commits
12 Commits
c8aca90278
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| abf007d7d8 | |||
| bf7edebbfa | |||
| 9e9074454a | |||
| 4822fbe7c9 | |||
| d012912572 | |||
| ee48ad39dd | |||
| 1653e5e44b | |||
| 7a2c0f21ce | |||
| 5f207e3e4a | |||
| 2b56d04054 | |||
| 0b34e5351f | |||
| 038d7c7cfd |
22
Dockerfile
22
Dockerfile
@@ -1,9 +1,9 @@
|
|||||||
FROM debian:bookworm-slim
|
FROM debian:bookworm-slim
|
||||||
LABEL maintainer="docker@ao-it.net"
|
LABEL maintainer="docker@ao-it.net"
|
||||||
|
|
||||||
|
ARG DEBIAN_FRONTEND=noninteractive
|
||||||
## prepare requirements
|
## prepare requirements
|
||||||
RUN ["bash", "-exo", "pipefail", "-c", "\
|
RUN ["bash", "-exo", "pipefail", "-c", "\
|
||||||
export DEBIAN_FRONTEND=noninteractive ; \
|
|
||||||
apt update ; \
|
apt update ; \
|
||||||
apt install -y wget gnupg ; \
|
apt install -y wget gnupg ; \
|
||||||
wget -O - https://packages.icinga.com/icinga.key | \
|
wget -O - https://packages.icinga.com/icinga.key | \
|
||||||
@@ -16,7 +16,6 @@ RUN ["bash", "-exo", "pipefail", "-c", "\
|
|||||||
|
|
||||||
## install icinga2
|
## install icinga2
|
||||||
RUN ["bash", "-exo", "pipefail", "-c", "\
|
RUN ["bash", "-exo", "pipefail", "-c", "\
|
||||||
export DEBIAN_FRONTEND=noninteractive ; \
|
|
||||||
apt update ; \
|
apt update ; \
|
||||||
apt install -y icinga2 monitoring-plugins ; \
|
apt install -y icinga2 monitoring-plugins ; \
|
||||||
mkdir -p /run/icinga2 ; \
|
mkdir -p /run/icinga2 ; \
|
||||||
@@ -24,6 +23,20 @@ RUN ["bash", "-exo", "pipefail", "-c", "\
|
|||||||
apt clean all ; \
|
apt clean all ; \
|
||||||
rm -vrf /var/lib/apt/lists/* "]
|
rm -vrf /var/lib/apt/lists/* "]
|
||||||
|
|
||||||
|
## install easysnmp
|
||||||
|
# need for full-features (add maybe if need): libsnmp-dev snmp-mibs-downloader
|
||||||
|
# sed -i 's|main|main non-free|g' $SOURCELIST_FILE ; \
|
||||||
|
# ARG SOURCELIST_FILE="/etc/apt/sources.list.d/debian.sources"
|
||||||
|
RUN ["bash", "-exo", "pipefail", "-c", "\
|
||||||
|
apt update ; \
|
||||||
|
apt-get install -y \
|
||||||
|
python3-requests \
|
||||||
|
python3-easysnmp \
|
||||||
|
python3-paho-mqtt \
|
||||||
|
python3-nagiosplugin; \
|
||||||
|
apt clean all ; \
|
||||||
|
rm -vrf /var/lib/apt/lists/* "]
|
||||||
|
|
||||||
## create persistend data store
|
## create persistend data store
|
||||||
RUN ["bash", "-exo", "pipefail", "-c", "\
|
RUN ["bash", "-exo", "pipefail", "-c", "\
|
||||||
mkdir -p /data ; \
|
mkdir -p /data ; \
|
||||||
@@ -37,6 +50,11 @@ RUN ["bash", "-exo", "pipefail", "-c", "\
|
|||||||
ln -vs /data/var/icinga2 /var/lib/icinga2 ; \
|
ln -vs /data/var/icinga2 /var/lib/icinga2 ; \
|
||||||
ln -vs /data/plugins /usr/lib/nagios/plugins "]
|
ln -vs /data/plugins /usr/lib/nagios/plugins "]
|
||||||
|
|
||||||
|
## basic aliases
|
||||||
|
RUN ["bash", "-exo", "pipefail", "-c", "\
|
||||||
|
echo alias icinga2reload=\"'/usr/lib/icinga2/safe-reload /etc/default/icinga2'\" >> /root/.bashrc ; \
|
||||||
|
echo alias icinga2checkconfig=\"'icinga2 daemon -C -X'\" >> /root/.bashrc "]
|
||||||
|
|
||||||
COPY init.sh /root/init.sh
|
COPY init.sh /root/init.sh
|
||||||
|
|
||||||
EXPOSE 5665
|
EXPOSE 5665
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ services:
|
|||||||
restart: always
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
- ./files/icinga2:/data
|
- ./files/icinga2:/data
|
||||||
|
- /etc/localtime:/etc/localtime:ro
|
||||||
ports:
|
ports:
|
||||||
- ${ICINGA_API_PORT:-5665}:5665 # only need if you plan to use api from other sources as icingaweb2
|
- ${ICINGA_API_PORT:-5665}:5665 # only need if you plan to use api from other sources as icingaweb2
|
||||||
networks:
|
networks:
|
||||||
|
|||||||
12
init.sh
12
init.sh
@@ -23,6 +23,12 @@ if [ -z "$(ls -A /data)" ]; then
|
|||||||
mv $ICINGA2_CONF_DIR/*.conf $ICINGA2_GLOBAL_TEMPLATES/
|
mv $ICINGA2_CONF_DIR/*.conf $ICINGA2_GLOBAL_TEMPLATES/
|
||||||
mv $ICINGA2_GLOBAL_TEMPLATES/api-users.conf $ICINGA2_CONF_DIR/
|
mv $ICINGA2_GLOBAL_TEMPLATES/api-users.conf $ICINGA2_CONF_DIR/
|
||||||
|
|
||||||
|
## only on inital setup replace one time the api root user password if a env var is set
|
||||||
|
if [ ! -z "$ICINGA2_API_USER_ROOT_PASS" ]; then
|
||||||
|
echo set inital api root user password
|
||||||
|
sed -i "s|password = \".*\"|password = \"$ICINGA2_API_USER_ROOT_PASS\"|g" $ICINGA2_FILE_API_USER_CONF
|
||||||
|
fi
|
||||||
|
|
||||||
## only on inital setup create a icingaweb api user if env var is set
|
## only on inital setup create a icingaweb api user if env var is set
|
||||||
## permission source: https://icinga.com/docs/icinga-web/latest/modules/monitoring/doc/05-Command-Transports/
|
## permission source: https://icinga.com/docs/icinga-web/latest/modules/monitoring/doc/05-Command-Transports/
|
||||||
if [ ! -z "$ICINGA2_API_USER_ICINGAWEB_PASS" ]; then
|
if [ ! -z "$ICINGA2_API_USER_ICINGAWEB_PASS" ]; then
|
||||||
@@ -43,14 +49,10 @@ if [ -z "$(ls -A /data)" ]; then
|
|||||||
echo '}' >> $ICINGA2_FILE_API_USER_CONF
|
echo '}' >> $ICINGA2_FILE_API_USER_CONF
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
## only on inital setup replace one time the api root user password if a env var is set
|
|
||||||
if [ ! -z "$ICINGA2_API_USER_ROOT_PASS" ]; then
|
|
||||||
echo set inital api root user password
|
|
||||||
sed -i "s|password = \".*\"|password = \"$ICINGA2_API_USER_ROOT_PASS\"|g" $ICINGA2_FILE_API_USER_CONF
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
## enable icingadb feature if not active
|
## enable icingadb feature if not active
|
||||||
|
|||||||
Reference in New Issue
Block a user