diff --git a/README.md b/README.md index 1a0d45c..feaa5bd 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ This repository provides a Dockerized version of Observium, a network monitoring ## Usage 1. Edit `observium/.env` and set passwords and stuff -1. Edit `observium/devices.txt` to add one or more devices during container startup +1. Edit `observium/conf/observium/devices.txt` to add one or more devices during container startup 1. Start the containers with `docker compose up -d` 1. Watch for errors with `docker compose logs -f` diff --git a/observium/Dockerfile b/observium/Dockerfile index fbecfbf..63546c2 100644 --- a/observium/Dockerfile +++ b/observium/Dockerfile @@ -19,9 +19,11 @@ WORKDIR /opt ADD ${OBSERVIUM_BINARY} ./ WORKDIR /opt/observium +RUN sed -i 's/icon-apple/icon-laptop/g' ./html/includes/functions.inc.php RUN ln -sf /dev/stdout ./logs/observium.log RUN chown -R www-data:www-data ./ + # Configure Apache2 webserver COPY conf/apache2/site.conf /etc/apache2/sites-enabled/000-default.conf COPY conf/apache2/conf-enabled/*.conf /etc/apache2/conf-enabled diff --git a/observium/compose.yml b/observium/compose.yml index b127fda..b819d4a 100644 --- a/observium/compose.yml +++ b/observium/compose.yml @@ -44,7 +44,6 @@ services: ofelia.job-exec.cleanup-rrds.user: "www-data" ofelia.job-exec.cleanup-rrds.command: "/bin/bash -c \"/opt/observium/housekeeping.php -yrptb\"" ofelia.job-exec.smokeping-config.schedule: "@every 5m" - ofelia.job-exec.smokeping-config.user: "root" ofelia.job-exec.smokeping-config.command: "/bin/bash -c \"php /opt/observium/scripts/generate-smokeping.php > /etc/smokeping/config.d/Targets\"" traefik.enable: true traefik.http.routers.observium.rule: "Host(`${OBSERVIUM_FQDN}`)" @@ -113,19 +112,15 @@ services: ofelia.enabled: "true" ofelia.job-exec.backup-rrd.schedule: "@every 24h" ofelia.job-exec.backup-rrd.no-overlap: "true" - ofelia.job-exec.backup-rrd.user: "root" ofelia.job-exec.backup-rrd.command: "/bin/sh -c \"tar -czf /backup/destination/rrd_$(date '+%Y%m%d%H%M%S').tar.gz -C /backup observium-data smokeping-data && ls -t /backup/destination/*.tar.gz" ofelia.job-exec.backup-rrd-cleanup.schedule: "@every 24h" ofelia.job-exec.backup-rrd-cleanup.no-overlap: "true" - ofelia.job-exec.backup-rrd-cleanup.user: "root" ofelia.job-exec.backup-rrd-cleanup.command: "/bin/sh -c \"ls -t /backup/destination/rrd_*.gz | tail -n +10 | xargs rm -f\"" ofelia.job-exec.backup-db.schedule: "@every 24h" ofelia.job-exec.backup-db.no-overlap: "true" - ofelia.job-exec.backup-db.user: "root" ofelia.job-exec.backup-db.command: "/bin/sh -c \"mariadb-dump --user ${DB_USER} -p${DB_PASSWORD} --host db ${DB_NAME} | gzip > /backup/destination/db_$(date '+%Y%m%d%H%M%S').sql.gz\"" ofelia.job-exec.backup-db-cleanup.schedule: "@every 24h" ofelia.job-exec.backup-db-cleanup.no-overlap: "true" - ofelia.job-exec.backup-db-cleanup.user: "root" ofelia.job-exec.backup-db-cleanup.command: "/bin/sh -c \"ls -t /backup/destination/db_*.gz | tail -n +10 | xargs rm -f\"" networks: - observium diff --git a/observium/devices.txt b/observium/conf/observium/devices.txt similarity index 85% rename from observium/devices.txt rename to observium/conf/observium/devices.txt index 2c1bcd9..6580c1d 100644 --- a/observium/devices.txt +++ b/observium/conf/observium/devices.txt @@ -5,4 +5,5 @@ # [community] [v1|v2c] [port] [udp|udp6|tcp|tcp6] # [any|nanp|anp|ap] [v3] [user] [password] [enckey] [md5|sha|sha-224|sha-256|sha-384|sha-512] [des|aes|aes-192|aes-192-c|aes-256|aes-256-c] [port] [udp|udp6|tcp|tcp6] # -#myserver.somewhere.com anp v3 snmpadmin mysecret sha-256 udp6 +# Example: +# mydevice.somewhere.com.net anp v3 snmpadmin secret md5 udp6 diff --git a/observium/entrypoint.sh b/observium/entrypoint.sh index a2eaf76..465573e 100755 --- a/observium/entrypoint.sh +++ b/observium/entrypoint.sh @@ -59,7 +59,7 @@ create_config() { } import_devices() { - devices_file="/tmp/devices.txt" + devices_file="/conf/devices.txt" if [ -e "${devices_file}" ]; then echo "* Trying to import devices from devices-import file ${devices_file}..." while read -r params || [ -n "$params" ]; do @@ -70,16 +70,6 @@ import_devices() { fi } -import_alerts() { - alerts_file="/conf/alerts.xml" - if [ -e "${alerts_file}" ]; then - echo "* Trying to import alerts from alerts-import file ${alerts_file}..." - php ./add_device.php ${params} || true - else - echo "* Alerts-import file ${alerts_file} does not exist, not importing any alerts" - fi -} - generate_smokeping_config() { php /opt/observium/scripts/generate-smokeping.php > /etc/smokeping/config.d/Targets }