1
0
Fork 0
mirror of https://github.com/librenms/docker.git synced 2026-01-23 02:14:48 +00:00

Handle LibreNMS plugins (#175)

Co-authored-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax 2021-03-10 23:58:45 +01:00 committed by GitHub
parent cddc5e906a
commit 96c67e9204
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 32 additions and 4 deletions

View file

@ -1,5 +1,9 @@
# Changelog
## 21.2.0-r2 (2021/03/10)
* Handle LibreNMS plugins (#171)
## 21.2.0-r1 (2021/03/04)
* Switch to `yasu`

View file

@ -80,6 +80,7 @@ Image: librenms/librenms:latest
* [LNMS command](doc/notes/lnms-command.md)
* [Validate](doc/notes/validate.md)
* [Dispatcher service](doc/notes/dispatcher-service.md)
* [Add a LibreNMS plugin](doc/notes/plugins.md)
* [Syslog-ng](doc/notes/syslog-ng.md)
* [Additional Monitoring plugins (Nagios)](doc/notes/additional-monitoring-plugins.md)
* [Custom alert templates](doc/notes/alert-templates.md)

View file

@ -1,5 +1,6 @@
## Volumes
* `/data`: Contains configuration, rrd database, logs, additional Monitoring plugins, additional syslog-ng config files
* `/data`: Contains configuration, plugins, rrd database, logs, additional Monitoring plugins, additional syslog-ng config files
> :warning: Note that the volume should be owned by the user/group with the specified `PUID` and `PGID`. If you don't give the volume correct permissions, the container may not start.
> :warning: Note that the volume should be owned by the user/group with the specified `PUID` and `PGID`. If you don't
> give the volume correct permissions, the container may not start.

6
doc/notes/plugins.md Normal file
View file

@ -0,0 +1,6 @@
## Add a LibreNMS plugin
You can add [plugins for LibreNMS](https://docs.librenms.org/Extensions/Plugin-System/) in `/data/plugins/`. If you
add a plugin that already exists in LibreNMS, it will be removed and yours will be used (except for Weathermap).
> ⚠️ Container has to be restarted to propagate changes

View file

@ -83,7 +83,7 @@ sed -i -e "s/RANDOMSTRINGGOESHERE/${LIBRENMS_SNMP_COMMUNITY}/" /etc/snmp/snmpd.c
# Init files and folders
echo "Initializing LibreNMS files / folders..."
mkdir -p /data/config /data/logs /data/monitoring-plugins /data/rrd /data/weathermap /data/alert-templates
mkdir -p /data/config /data/logs /data/monitoring-plugins /data/plugins /data/rrd /data/weathermap /data/alert-templates
ln -sf /data/weathermap ${LIBRENMS_PATH}/html/plugins/Weathermap/configs
touch /data/logs/librenms.log
rm -rf ${LIBRENMS_PATH}/logs
@ -185,9 +185,25 @@ cat > ${LIBRENMS_PATH}/config.d/dispatcher.php <<EOL
\$config['service_watchdog_enabled'] = false;
EOL
# Check plugins
echo "Checking LibreNMS plugins..."
plugins=$(ls -l /data/plugins | egrep '^d' | awk '{print $9}')
for plugin in ${plugins}; do
if [ "${plugin}" == "Weathermap" ]; then
echo " WARNING: Plugin Weathermap cannot be overriden. Skipping..."
continue
fi
echo " Linking plugin ${plugin}..."
if [ -d "${LIBRENMS_PATH}/html/plugins/${plugin}" ]; then
rm -rf "${LIBRENMS_PATH}/html/plugins/${plugin}"
fi
ln -sf "/data/plugins/${plugin}" "${LIBRENMS_PATH}/html/plugins/${plugin}"
chown -h librenms. "${LIBRENMS_PATH}/html/plugins/${plugin}"
done
# Fix perms
echo "Fixing perms..."
chown librenms. /data/config /data/monitoring-plugins /data/rrd /data/weathermap /data/alert-templates
chown librenms. /data/config /data/monitoring-plugins /data/plugins /data/rrd /data/weathermap /data/alert-templates
chown -R librenms. /data/logs ${LIBRENMS_PATH}/config.d ${LIBRENMS_PATH}/bootstrap ${LIBRENMS_PATH}/logs ${LIBRENMS_PATH}/storage
chmod ug+rw /data/logs /data/rrd ${LIBRENMS_PATH}/bootstrap/cache ${LIBRENMS_PATH}/storage ${LIBRENMS_PATH}/storage/framework/*