Compare commits

...

12 Commits

Author SHA1 Message Date
abf007d7d8 add mqtt python lib sys wide
All checks were successful
build container icinga2 / build (push) Successful in -1h28m58s
2025-09-20 18:48:51 +02:00
bf7edebbfa remove duble entry
All checks were successful
build container icinga2 / build (push) Successful in 5m15s
2025-03-03 17:24:19 +01:00
9e9074454a add python requests
Some checks failed
build container icinga2 / build (push) Has been cancelled
2025-03-03 17:23:38 +01:00
4822fbe7c9 add python requests
All checks were successful
build container icinga2 / build (push) Successful in 2m42s
2025-02-23 01:35:53 +01:00
d012912572 add timesync between host and container 2025-02-22 20:56:21 +01:00
ee48ad39dd move root api pw set before other users
All checks were successful
build container icinga2 / build (push) Successful in 2m12s
2025-02-07 03:04:17 +01:00
1653e5e44b move api pass set to init only
Some checks failed
build container icinga2 / build (push) Has been cancelled
2025-02-07 03:03:29 +01:00
7a2c0f21ce add nagiosplugin python lib
All checks were successful
build container icinga2 / build (push) Successful in 2m40s
2025-02-07 01:19:29 +01:00
5f207e3e4a remove not now needed sourcelist update
All checks were successful
build container icinga2 / build (push) Successful in 2m43s
2025-02-07 00:53:44 +01:00
2b56d04054 add snmp python lib
Some checks failed
build container icinga2 / build (push) Has been cancelled
2025-02-07 00:52:53 +01:00
0b34e5351f optimize basic installs
All checks were successful
build container icinga2 / build (push) Successful in 2m34s
2025-02-07 00:13:34 +01:00
038d7c7cfd add aliase for easy config handling
All checks were successful
build container icinga2 / build (push) Successful in 59s
2025-02-03 16:08:53 +01:00
3 changed files with 28 additions and 7 deletions

View File

@@ -1,9 +1,9 @@
FROM debian:bookworm-slim
LABEL maintainer="docker@ao-it.net"
ARG DEBIAN_FRONTEND=noninteractive
## prepare requirements
RUN ["bash", "-exo", "pipefail", "-c", "\
export DEBIAN_FRONTEND=noninteractive ; \
apt update ; \
apt install -y wget gnupg ; \
wget -O - https://packages.icinga.com/icinga.key | \
@@ -16,7 +16,6 @@ RUN ["bash", "-exo", "pipefail", "-c", "\
## install icinga2
RUN ["bash", "-exo", "pipefail", "-c", "\
export DEBIAN_FRONTEND=noninteractive ; \
apt update ; \
apt install -y icinga2 monitoring-plugins ; \
mkdir -p /run/icinga2 ; \
@@ -24,6 +23,20 @@ RUN ["bash", "-exo", "pipefail", "-c", "\
apt clean all ; \
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
RUN ["bash", "-exo", "pipefail", "-c", "\
mkdir -p /data ; \
@@ -37,6 +50,11 @@ RUN ["bash", "-exo", "pipefail", "-c", "\
ln -vs /data/var/icinga2 /var/lib/icinga2 ; \
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
EXPOSE 5665

View File

@@ -61,6 +61,7 @@ services:
restart: always
volumes:
- ./files/icinga2:/data
- /etc/localtime:/etc/localtime:ro
ports:
- ${ICINGA_API_PORT:-5665}:5665 # only need if you plan to use api from other sources as icingaweb2
networks:

12
init.sh
View File

@@ -23,6 +23,12 @@ if [ -z "$(ls -A /data)" ]; then
mv $ICINGA2_CONF_DIR/*.conf $ICINGA2_GLOBAL_TEMPLATES/
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
## permission source: https://icinga.com/docs/icinga-web/latest/modules/monitoring/doc/05-Command-Transports/
if [ ! -z "$ICINGA2_API_USER_ICINGAWEB_PASS" ]; then
@@ -43,14 +49,10 @@ if [ -z "$(ls -A /data)" ]; then
echo '}' >> $ICINGA2_FILE_API_USER_CONF
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