librenms-plugins / Weathermap

MIT License
64 stars 51 forks source link

Search for libreNMS installation to allow more flexibility. #20

Closed BarbarossaTM closed 8 years ago

BarbarossaTM commented 8 years ago

The current code worked under the assumption that the Weathermap plugin is installed in the '/html/plugins/Weathermap' directory which is fine. This code breaks if the plugin were to be installed in a separate directory somewhere else and then symlinked into the above mentioned place.

This patch introduces a "search" for libreNMS config.php file to determine libreNMS' installation directory to calculate the correct paths. The config file is searched in the following places in the following order:

* /etc/librenms/config.php
* /opt/librenms/config.php
* ../../../config.php

/etc/librenms/config.php will be used in some (hopefully sonn) upcoming libreNMS packages for some Distribution(s).

Signed-off-by: Maximilian Wilhelm max@rfc2324.org