Skip to content

Commit

Permalink
Fix devices import
Browse files Browse the repository at this point in the history
  • Loading branch information
trick77 committed Dec 29, 2023
1 parent d655008 commit e857afb
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 18 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand Down
2 changes: 2 additions & 0 deletions observium/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 0 additions & 5 deletions observium/compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}`)"
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
# <hostname> [community] [v1|v2c] [port] [udp|udp6|tcp|tcp6]
# <hostname> [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
12 changes: 1 addition & 11 deletions observium/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}
Expand Down

0 comments on commit e857afb

Please sign in to comment.