mirror of
https://github.com/librenms/docker.git
synced 2026-01-23 02:14:48 +00:00
Sidecar cron and syslog-ng are now respectively enabled through SIDECAR_CRON and SIDECAR_SYSLOGNG env vars
This commit is contained in:
parent
85df683447
commit
539a10f233
6 changed files with 52 additions and 18 deletions
|
|
@ -1,5 +1,14 @@
|
|||
# Changelog
|
||||
|
||||
## 1.51-RC2 (2019/05/01)
|
||||
|
||||
* Sidecar cron and syslog-ng are now respectively enabled through `SIDECAR_CRON` and `SIDECAR_SYSLOGNG` env vars
|
||||
* Fix snmpd command
|
||||
|
||||
> :warning: **UPGRADE NOTES**
|
||||
> Sidecar cron and syslog-ng are now respectively handled with `SIDECAR_CRON` and `SIDECAR_SYSLOGNG` env vars
|
||||
> See docker-compose example and README for more info.
|
||||
|
||||
## 1.51-RC1 (2019/05/01)
|
||||
|
||||
* LibreNMS 1.51
|
||||
|
|
|
|||
23
README.md
23
README.md
|
|
@ -64,6 +64,9 @@ It's a fork of [CrazyMax's LibreNMS Docker image repository](https://github.com/
|
|||
|
||||
#### Cron
|
||||
|
||||
> :warning: Only used if you enabled and run a [sidecar cron container](#crons)
|
||||
|
||||
* `SIDECAR_CRON` : Set to `1` to enable sidecar cron mode for this container (default `0`)
|
||||
* `LIBRENMS_CRON_DISCOVERY_ENABLE` : Enable LibreNMS discovery for this container cronjobs (default `true`)
|
||||
* `LIBRENMS_CRON_DAILY_ENABLE` : Enable LibreNMS daily script for this container cronjobs (default `true`)
|
||||
* `LIBRENMS_CRON_ALERTS_ENABLE` : Enable LibreNMS alerts generation for this container cronjobs (default `true`)
|
||||
|
|
@ -72,6 +75,12 @@ It's a fork of [CrazyMax's LibreNMS Docker image repository](https://github.com/
|
|||
* `LIBRENMS_CRON_CHECK_SERVICES_ENABLE` : Enable LibreNMS service checks for this container cronjobs (default `true`)
|
||||
* `LIBRENMS_CRON_POLLER_ENABLE` : Enable LibreNMS polling for this container cronjobs (default `true`)
|
||||
|
||||
#### Syslog-ng
|
||||
|
||||
> :warning: Only used if you enabled and run a [sidecar syslog-ng container](#syslog-ng)
|
||||
|
||||
* `SIDECAR_SYSLOGNG` : Set to `1` to enable sidecar syslog-ng mode for this container (default `0`)
|
||||
|
||||
#### Database
|
||||
|
||||
* `DB_HOST` : MySQL database hostname / IP address
|
||||
|
|
@ -96,7 +105,7 @@ It's a fork of [CrazyMax's LibreNMS Docker image repository](https://github.com/
|
|||
### Ports
|
||||
|
||||
* `80` : HTTP port
|
||||
* `514 514/udp` : Syslog ports
|
||||
* `514 514/udp` : Syslog ports (Only used if you enabled and run a [sidecar syslog-ng container](#syslog-ng))
|
||||
|
||||
## Use this image
|
||||
|
||||
|
|
@ -194,13 +203,14 @@ $ docker-compose exec --user librenms librenms php build-base.php
|
|||
|
||||
### Crons
|
||||
|
||||
If you want to enable the cron job, you have to run a "sidecar" container like in the [docker-compose file](examples/compose/docker-compose.yml) or run a simple container like this :
|
||||
If you want to enable the cronjob, you have to run a "sidecar" container (see cron service in [docker-compose.yml](examples/compose/docker-compose.yml) example) or run a simple container like this :
|
||||
|
||||
```bash
|
||||
docker run -d --name librenms_cron \
|
||||
--env-file $(pwd)/librenms.env \
|
||||
-e SIDECAR_CRON=1 \
|
||||
-v librenms:/data \
|
||||
librenms/librenms:latest /usr/local/bin/cron
|
||||
librenms/librenms:latest
|
||||
```
|
||||
|
||||
> `-v librenms:/data`<br />
|
||||
|
|
@ -208,14 +218,15 @@ docker run -d --name librenms_cron \
|
|||
|
||||
### Syslog-ng
|
||||
|
||||
If you want to enable syslog-ng, you have to run a "sidecar" container like in the [docker-compose file](examples/compose/docker-compose.yml) or run a simple container like this :
|
||||
If you want to enable syslog-ng, you have to run a "sidecar" container (see syslog-ng service in [docker-compose.yml](examples/compose/docker-compose.yml) example) or run a simple container like this :
|
||||
|
||||
```bash
|
||||
docker run -d --name librenms_syslog \
|
||||
--env-file $(pwd)/librenms.env \
|
||||
-e SIDECAR_SYSLOGNG=1 \
|
||||
-p 514 -p 514/udp \
|
||||
-v librenms:/data \
|
||||
librenms/librenms:latest /usr/sbin/syslog-ng -F
|
||||
librenms/librenms:latest
|
||||
```
|
||||
|
||||
You have to create a configuration file to enable syslog in LibreNMS too. Create a file called for example `/data/config/syslog.php` with this content :
|
||||
|
|
@ -229,7 +240,7 @@ $config['enable_syslog'] = 1;
|
|||
|
||||
You can add a custom Monitoring (Nagios) plugin in `/data/monitoring-plugins/`.
|
||||
|
||||
> ⚠️ Container has to be restarted to propagate changes
|
||||
> :warning: Container has to be restarted to propagate changes
|
||||
|
||||
## Upgrade
|
||||
|
||||
|
|
|
|||
6
assets/etc/supervisord/cron.conf
Normal file
6
assets/etc/supervisord/cron.conf
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
[program:cron]
|
||||
command = /usr/local/bin/cron
|
||||
stdout_logfile = /dev/stdout
|
||||
stdout_logfile_maxbytes = 0
|
||||
stderr_logfile = /dev/stderr
|
||||
stderr_logfile_maxbytes = 0
|
||||
6
assets/etc/supervisord/syslog-ng.conf
Normal file
6
assets/etc/supervisord/syslog-ng.conf
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
[program:syslog-ng]
|
||||
command = /usr/sbin/syslog-ng -F
|
||||
stdout_logfile = /dev/stdout
|
||||
stdout_logfile_maxbytes = 0
|
||||
stderr_logfile = /dev/stderr
|
||||
stderr_logfile_maxbytes = 0
|
||||
|
|
@ -15,9 +15,6 @@ REAL_IP_FROM=${REAL_IP_FROM:-"0.0.0.0/32"}
|
|||
REAL_IP_HEADER=${REAL_IP_HEADER:-"X-Forwarded-For"}
|
||||
LOG_IP_VAR=${LOG_IP_VAR:-remote_addr}
|
||||
|
||||
MEMCACHED_PORT=${MEMCACHED_PORT:-11211}
|
||||
RRDCACHED_PORT=${RRDCACHED_PORT:-42217}
|
||||
|
||||
LIBRENMS_POLLER_THREADS=${LIBRENMS_POLLER_THREADS:-16}
|
||||
LIBRENMS_POLLER_INTERVAL=${LIBRENMS_POLLER_INTERVAL:-5}
|
||||
|
||||
|
|
@ -27,6 +24,7 @@ LIBRENMS_DISTRIBUTED_POLLER_GROUP=${LIBRENMS_DISTRIBUTED_POLLER_GROUP:-'0'}
|
|||
LIBRENMS_DISTRIBUTED_POLLER_MEMCACHED_HOST=${LIBRENMS_DISTRIBUTED_POLLER_MEMCACHED_HOST:-${MEMCACHED_HOST}}
|
||||
LIBRENMS_DISTRIBUTED_POLLER_MEMCACHED_PORT=${LIBRENMS_DISTRIBUTED_POLLER_MEMCACHED_PORT:-${MEMCACHED_PORT}}
|
||||
|
||||
SIDECAR_CRON=${SIDECAR_CRON:-0}
|
||||
LIBRENMS_CRON_DISCOVERY_ENABLE=${LIBRENMS_CRON_DISCOVERY_ENABLE:-true}
|
||||
LIBRENMS_CRON_DAILY_ENABLE=${LIBRENMS_CRON_DAILY_ENABLE:-true}
|
||||
LIBRENMS_CRON_ALERTS_ENABLE=${LIBRENMS_CRON_ALERTS_ENABLE:-true}
|
||||
|
|
@ -35,6 +33,8 @@ LIBRENMS_CRON_BILLING_CALCULATE_ENABLE=${LIBRENMS_CRON_BILLING_CALCULATE_ENABLE:
|
|||
LIBRENMS_CRON_CHECK_SERVICES_ENABLE=${LIBRENMS_CRON_CHECK_SERVICES_ENABLE:-true}
|
||||
LIBRENMS_CRON_POLLER_ENABLE=${LIBRENMS_CRON_POLLER_ENABLE:-true}
|
||||
|
||||
SIDECAR_SYSLOGNG=${SIDECAR_SYSLOGNG:-0}
|
||||
|
||||
DB_PORT=${DB_PORT:-3306}
|
||||
DB_NAME=${DB_NAME:-librenms}
|
||||
DB_USER=${DB_USER:-librenms}
|
||||
|
|
@ -237,13 +237,14 @@ for mon_plugin in ${mon_plugins}; do
|
|||
ln -sf ${DATA_PATH}/monitoring-plugins/${mon_plugin} /usr/lib/monitoring-plugins/${mon_plugin}
|
||||
done
|
||||
|
||||
# Sidecar cron container ?
|
||||
if [ "$1" == "/usr/local/bin/cron" ]; then
|
||||
# Sidecar cron container
|
||||
if [ "$SIDECAR_CRON" = "1" ]; then
|
||||
echo ">>"
|
||||
echo ">> Sidecar cron container detected"
|
||||
echo ">>"
|
||||
|
||||
# Init
|
||||
rm /etc/supervisord/syslog-ng.conf
|
||||
if [ -z "$CRONTAB_PATH" ]; then
|
||||
>&2 echo "ERROR: CRONTAB_PATH must be defined"
|
||||
exit 1
|
||||
|
|
@ -291,15 +292,19 @@ EOL
|
|||
# Fix crontab perms
|
||||
echo "Fixing crontab permissions..."
|
||||
chmod -R 0644 ${CRONTAB_PATH}
|
||||
elif [ "$1" == "/usr/sbin/syslog-ng" ]; then
|
||||
elif [ "$SIDECAR_SYSLOGNG" = "1" ]; then
|
||||
echo ">>"
|
||||
echo ">> Sidecar syslog-ng container detected"
|
||||
echo ">>"
|
||||
|
||||
# Init
|
||||
rm /etc/supervisord/cron.conf
|
||||
mkdir -p ${DATA_PATH}/syslog-ng /run/syslog-ng
|
||||
chown -R librenms. ${DATA_PATH}/syslog-ng /run/syslog-ng
|
||||
else
|
||||
# Init
|
||||
rm /etc/supervisord/cron.conf /etc/supervisord/syslog-ng.conf
|
||||
|
||||
echo "Waiting ${DB_TIMEOUT}s for database to be ready..."
|
||||
counter=1
|
||||
while ! ${dbcmd} -e "show databases;" > /dev/null 2>&1; do
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
version: "3.2"
|
||||
version: "3.5"
|
||||
|
||||
services:
|
||||
traefik:
|
||||
|
|
@ -123,8 +123,6 @@ services:
|
|||
container_name: librenms_cron
|
||||
domainname: example.com
|
||||
hostname: librenms
|
||||
command:
|
||||
- "/usr/local/bin/cron"
|
||||
depends_on:
|
||||
- librenms
|
||||
volumes:
|
||||
|
|
@ -138,6 +136,7 @@ services:
|
|||
- "DB_USER=${MYSQL_USER}"
|
||||
- "DB_PASSWORD=${MYSQL_PASSWORD}"
|
||||
- "DB_TIMEOUT=30"
|
||||
- "SIDECAR_CRON=1"
|
||||
env_file:
|
||||
- "./librenms.env"
|
||||
restart: always
|
||||
|
|
@ -147,9 +146,6 @@ services:
|
|||
container_name: librenms_syslog
|
||||
domainname: example.com
|
||||
hostname: librenms
|
||||
command:
|
||||
- "/usr/sbin/syslog-ng"
|
||||
- "-F"
|
||||
depends_on:
|
||||
- librenms
|
||||
ports:
|
||||
|
|
@ -170,6 +166,7 @@ services:
|
|||
- "DB_USER=${MYSQL_USER}"
|
||||
- "DB_PASSWORD=${MYSQL_PASSWORD}"
|
||||
- "DB_TIMEOUT=30"
|
||||
- "SIDECAR_SYSLOGNG=1"
|
||||
env_file:
|
||||
- "./librenms.env"
|
||||
restart: always
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue