1
0
Fork 0
mirror of https://github.com/librenms/docker.git synced 2026-07-20 01:57:54 +00:00

Ability to add custom nagios plugins through /data/nagios-plugins

Install official nagios-plugins package
Services enabled by default
This commit is contained in:
CrazyMax 2018-09-29 03:38:09 +02:00
parent e53856e09f
commit 486e371fd4
No known key found for this signature in database
GPG key ID: 3248E46B6BB8C7F7
5 changed files with 45 additions and 1 deletions

View file

@ -1,5 +1,11 @@
# Changelog
## 1.43-RC5 (2018/09/29)
* Ability to add custom nagios plugins through `/data/nagios-plugins`
* Install official nagios-plugins package
* Services enabled by default
## 1.43-RC4 (2018/09/26)
* Add `ttf-dejavu` package

View file

@ -28,11 +28,14 @@ RUN apk --update --no-cache add \
imagemagick \
mtr \
mysql-client \
nagios-plugins \
nagios-plugins-all \
net-snmp \
net-snmp-tools \
nginx \
nmap \
openssl \
perl \
php7 \
php7-cli \
php7-ctype \

View file

@ -21,6 +21,8 @@ If you are interested, [check out](https://hub.docker.com/r/crazymax/) my other
* Alpine Linux 3.8, Nginx, PHP 7.2
* Cron tasks as a ["sidecar" container](#cron)
* Syslog-ng support through a ["sidecar" container](#syslog-ng)
* [Distributed poller](https://docs.librenms.org/#Extensions/Distributed-Poller/#distributed-poller)
* Ability to add custom nagios plugins
* OPCache enabled to store precompiled script bytecode in shared memory
### From docker-compose
@ -85,7 +87,7 @@ If you are interested, [check out](https://hub.docker.com/r/crazymax/) my other
### Volumes
* `/data` : Contains configuration, rrd database, logs, additional syslog-ng config files
* `/data` : Contains configuration, rrd database, logs, additional nagios plugins, additional syslog-ng config files
### Ports
@ -218,6 +220,12 @@ You have to create a configuration file to enable syslog in LibreNMS too. Create
$config['enable_syslog'] = 1;
```
## Additional nagios plugins
You can add a custom nagios plugin in `/data/nagios-plugins/`.
> ⚠️ Container has to be restarted to propagate changes
## Upgrade
To upgrade to the latest version of LibreNMS, pull the newer image and launch the container. LibreNMS will upgrade automatically :

View file

@ -103,6 +103,7 @@ sed -i -e "s/RANDOMSTRINGGOESHERE/${LIBRENMS_SNMP_COMMUNITY}/" /etc/snmp/snmpd.c
echo "Initializing LibreNMS files / folders..."
mkdir -p ${DATA_PATH}/config \
${DATA_PATH}/logs \
${DATA_PATH}/nagios-plugins \
${DATA_PATH}/rrd
rm -f ${LIBRENMS_PATH}/config.d/*
@ -158,6 +159,13 @@ cat > ${LIBRENMS_PATH}/config.d/autoupdate.php <<EOL
\$config['update'] = 0;
EOL
# Config : Services
cat > ${LIBRENMS_PATH}/config.d/services.php <<EOL
<?php
\$config['show_services'] = 1;
\$config['nagios_plugins'] = "/usr/lib/nagios/plugins";
EOL
# Config : Memcached
if [ ! -z "${MEMCACHED_HOST}" ]; then
cat > ${LIBRENMS_PATH}/config.d/memcached.php <<EOL
@ -200,6 +208,23 @@ chmod ug+rw ${DATA_PATH}/logs \
${LIBRENMS_PATH}/bootstrap/cache \
${LIBRENMS_PATH}/storage \
${LIBRENMS_PATH}/storage/framework/*
chmod +x ${DATA_PATH}/nagios-plugins/*
# Check additional nagios plugins
echo "Checking additional nagios plugins..."
nagios_plugins=$(ls -l ${DATA_PATH}/nagios-plugins | egrep '^-' | awk '{print $9}')
for nagios_plugin in ${nagios_plugins}; do
if [ -f "/usr/lib/nagios/plugins/${nagios_plugin}" ]; then
echo " WARNING: Official Nagios plugin ${nagios_plugin} cannot be overriden"
continue
fi
if [[ ${nagios_plugin} != check_* ]]; then
echo " WARNING: Nagios plugin filename ${nagios_plugin} invalid. It must start with 'check_'"
continue
fi
echo " Adding ${nagios_plugin} nagios plugin"
ln -sf ${DATA_PATH}/nagios-plugins/${nagios_plugin} /usr/lib/nagios/plugins/${nagios_plugin}
done
# Sidecar cron container ?
if [ "$1" == "/usr/local/bin/cron" ]; then

View file

@ -23,9 +23,11 @@ services:
- target: 80
published: 80
protocol: tcp
mode: host
- target: 443
published: 443
protocol: tcp
mode: host
volumes:
- "./acme.json:/acme.json"
- "/var/run/docker.sock:/var/run/docker.sock"