1
0
Fork 0
mirror of https://github.com/librenms/docker.git synced 2026-07-26 11:44:59 +00:00

Add alert templates (#142)

This commit is contained in:
Hayden 2020-11-17 13:38:26 -08:00 committed by GitHub
parent 06d918843a
commit d933e76783
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 2 deletions

View file

@ -28,6 +28,7 @@ If you are interested, [check out](https://hub.docker.com/r/crazymax/) my other
* Syslog-ng support through a ["sidecar" container](doc/docker/environment-variables.md#syslog-ng)
* Built-in LibreNMS [Weathermap plugin](https://docs.librenms.org/Extensions/Weathermap/)
* Ability to add custom Monitoring plugins (Nagios)
* Ability to add custom alert templates
* OPCache enabled to store precompiled script bytecode in shared memory
* [s6-overlay](https://github.com/just-containers/s6-overlay/) as process supervisor
* [Traefik](https://github.com/containous/traefik-library-image) as reverse proxy and creation/renewal of Let's Encrypt certificates (see [this template](examples/traefik))
@ -68,6 +69,7 @@ Image: librenms/librenms:latest
* [Dispatcher service](doc/notes/dispatcher-service.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)
* [Upgrade](doc/upgrade.md)
## How can I help?

View file

@ -0,0 +1,5 @@
## Alert templates
You can add [Laravel alert templates](https://docs.librenms.org/Alerting/Templates/#base-templates) in `/data/alert-templates/`.
> :warning: 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
mkdir -p /data/config /data/logs /data/monitoring-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
@ -189,7 +189,7 @@ EOL
# Fix perms
echo "Fixing perms..."
chown librenms. /data/config /data/monitoring-plugins /data/rrd /data/weathermap
chown librenms. /data/config /data/monitoring-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/*
@ -212,3 +212,19 @@ for mon_plugin in ${mon_plugins}; do
echo " Adding ${mon_plugin} Monitoring plugin"
ln -sf /data/monitoring-plugins/${mon_plugin} /usr/lib/monitoring-plugins/${mon_plugin}
done
# Check alert templates
echo "Checking alert templates..."
templates=$(ls -l /data/alert-templates | egrep '^-' | awk '{print $9}')
for template in ${templates}; do
if [ -f "${LIBRENMS_PATH}/resources/views/alerts/templates/${template}" ]; then
echo " WARNING: Default alert template ${template} cannot be overriden. Skipping..."
continue
fi
if [[ ${template} != *.php ]]; then
echo " WARNING: Alert template filename ${template} invalid. It must end with '.php'. Skipping..."
continue
fi
echo " Adding ${template} alert template"
ln -sf /data/alert-templates/${template} ${LIBRENMS_PATH}/resources/views/alerts/templates/${template}
done