diff options
author | Dan Langille <dvl@FreeBSD.org> | 2020-05-03 19:31:28 +0000 |
---|---|---|
committer | Dan Langille <dvl@FreeBSD.org> | 2020-05-03 19:31:28 +0000 |
commit | 830eec636e3de489692689a510ca5fa08bee60af (patch) | |
tree | f4dc6b1783fa5e9f450f298d524b6a616b3b9fbd /net-mgmt | |
parent | f0286287c061199570c7c59fcfe5559e1073412e (diff) |
Notes
Diffstat (limited to 'net-mgmt')
-rw-r--r-- | net-mgmt/librenms/Makefile | 28 | ||||
-rw-r--r-- | net-mgmt/librenms/files/librenms.in | 49 | ||||
-rw-r--r-- | net-mgmt/librenms/files/pkg-message.in | 75 |
3 files changed, 138 insertions, 14 deletions
diff --git a/net-mgmt/librenms/Makefile b/net-mgmt/librenms/Makefile index ac816a46244a..163801dd7c2c 100644 --- a/net-mgmt/librenms/Makefile +++ b/net-mgmt/librenms/Makefile @@ -3,8 +3,8 @@ PORTNAME= librenms PORTVERSION= 1.63 +PORTREVISION= 1 PORTEPOCH= 1 -PORTREVISION= 0 CATEGORIES= net-mgmt MASTER_SITES= LOCAL/dvl:vendor DISTFILES= ${PORTNAME}-vendor-${DISTVERSIONPREFIX}${DISTVERSION}${DISTVERSIONSUFFIX}${EXTRACT_SUFX}:vendor @@ -14,7 +14,7 @@ COMMENT= Autodiscovering PHP/MySQL/SNMP based network monitoring LICENSE= GPLv3 -USES= python${PY_MYSQL} shebangfix +USES= shebangfix # RELEASE_TIMESTAMP is used for a patch inside the vendor code # it represents the release date via: git show --pretty='%H|%ct' -s 1.42.01 @@ -37,18 +37,24 @@ USE_PHP= ctype curl dom fileinfo filter gd hash json ldap mbstring \ USE_GITHUB= yes GH_ACCOUNT= librenms +USE_RC_SUBR= librenms + USERS= www -WWW_USER= www NO_BUILD= yes -OPTIONS_DEFINE= FPING IPMITOOL LIBVIRT MYSQLD NAGPLUGINS NMAP PYPOLLER WMIC DOCS EXAMPLES X11 +OPTIONS_DEFINE= FPING IPMITOOL LIBVIRT MYSQLD NAGPLUGINS NMAP WMIC DOCS EXAMPLES X11 OPTIONS_DEFAULT= FPING IPMITOOL LIBVIRT NAGPLUGINS NMAP PYPOLLER WMIC + +OPTIONS_SINGLE= POLLERSYSTEM +OPTIONS_SINGLE_POLLERSYSTEM= PYPOLLER PYSERVICE #conflicting python versions + FPING_DESC= Enable fping support ping monitoring IPMITOOL_DESC= Enable support for monitoring hardware IPMI MYSQLD_DESC= Use local MySQL server WMIC_DESC= Enable support for WMI polling -PYPOLLER_DESC= Enable Python Poller Wrapper +PYPOLLER_DESC= Support for polling using cron entries +PYSERVICE_DESC= Support for polling using a daemon FPING_RUN_DEPENDS= fping:net/fping IPMITOOL_RUN_DEPENDS= ipmitool:sysutils/ipmitool @@ -56,7 +62,10 @@ LIBVIRT_RUN_DEPENDS= virsh:devel/libvirt NAGPLUGINS_RUN_DEPENDS= ${LOCALBASE}/libexec/nagios/check_nagios:net-mgmt/nagios-plugins NMAP_RUN_DEPENDS= nmap:security/nmap PYPOLLER_RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}MySQLdb>=1.2.3:databases/py-MySQLdb@${PY_FLAVOR} -PYPOLLER_VARS= PY_MYSQL=:2.7 +PYPOLLER_USES= python:2.7 +PYSERVICE_RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}python-dotenv>0:www/py-python-dotenv@${PY_FLAVOR} \ + ${PYTHON_PKGNAMEPREFIX}pymysql>0:databases/py-pymysql@${PY_FLAVOR} +PYSERVICE_USES= python:3.6+ X11_RUN_DEPENDS= Magick-config:graphics/ImageMagick6 \ mtr:net/mtr X11_RUN_DEPENDS_OFF= Magick-config:graphics/ImageMagick6-nox11 \ @@ -92,7 +101,8 @@ SHEBANG_FILES= scripts/auth_test.php scripts/deploy-docs.sh scripts/github-remov ../${PORTNAME}-vendor-${PORTVERSION}/tecnickcom/tcpdf/tools/tcpdf_addfont.php SUB_FILES+= pkg-message -SUB_LIST+= PHP="${PHPBASE}/bin/php" PYTHON=${PYTHON_CMD} +SUB_LIST+= PHP="${PHPBASE}/bin/php" PYTHON=${PYTHON_CMD} \ + USER="${WWWOWN}" GROUP="${WWWGRP}" WWWDIR="${WWWDIR}" ROOT_FILES= addhost.php adduser.php alerts.php artisan billing-calculate.php \ build-base.php build.sql check-services.php composer.json \ @@ -135,7 +145,7 @@ NO_ARCH= yes post-patch: @${REINPLACE_CMD} 's|%%PORTNAME%%|${PORTNAME}|g' ${WRKSRC}/config.php.default - @${REINPLACE_CMD} 's|%%WWW_USER%%|${WWW_USER}|g' ${WRKSRC}/config.php.default + @${REINPLACE_CMD} 's|%%WWW_USER%%|${WWWOWN}|g' ${WRKSRC}/config.php.default @${REINPLACE_CMD} 's|%%LOCALBASE%%|${LOCALBASE}|g' ${WRKSRC}/poller-wrapper.py ${WRKSRC}/poller.php @${REINPLACE_CMD} 's|%%PORTVERSION%%|${PORTVERSION}|g' ${WRKSRC}/includes/common.php @${REINPLACE_CMD} 's|%%RELEASE_TIMESTAMP%%|${RELEASE_TIMESTAMP}|g' ${WRKSRC}/includes/common.php @@ -168,6 +178,7 @@ do-install: # these values should be outside the www tree now ${MKDIR} ${STAGEDIR}/var/log/${PORTNAME} ${MKDIR} ${STAGEDIR}/var/db/${PORTNAME} + ${MKDIR} ${STAGEDIR}/var/run/${PORTNAME} do-install-DOCS-on: ${MKDIR} ${STAGEDIR}/${DOCSDIR} @@ -200,6 +211,7 @@ post-install: @${ECHO_CMD} "@dir(www,www,0775) ${WWWDIR}/storage/framework/views" >> ${TMPPLIST} @${ECHO_CMD} "@dir(www,www,0775) /var/log/${PORTNAME}" >> ${TMPPLIST} @${ECHO_CMD} "@dir(www,www,0775) /var/db/${PORTNAME}" >> ${TMPPLIST} + @${ECHO_CMD} "@dir(www,www,0775) /var/run/${PORTNAME}" >> ${TMPPLIST} .for f in ${OTHER_DIRS} @${ECHO_CMD} "@dir(root,www,0775) ${WWWDIR}/${f}" >> ${TMPPLIST} .endfor diff --git a/net-mgmt/librenms/files/librenms.in b/net-mgmt/librenms/files/librenms.in new file mode 100644 index 000000000000..0394394e6cea --- /dev/null +++ b/net-mgmt/librenms/files/librenms.in @@ -0,0 +1,49 @@ +#!/bin/sh + +# $FreeBSD$ +# +# PROVIDE: librenms +# REQUIRE: SERVERS +# KEYWORD: shutdown +# +# Add the following lines to /etc/rc.conf.local or /etc/rc.conf +# to enable this service: +# +# librenms_enable: Set to NO by default. +# Set it to YES to enable librenms +# librenms_user: The user account used to run the daemon. +# Default: %%USER%% +# librenms_group: The group account used to run the daemon. +# Default: %%GROUP%% +# librenms_pid: Path of the pid file. +# Default /var/run/librenms/librenms.pid +# +# Contributed by: Dries Michiels (driesm.michiels@gmail.com) + +. /etc/rc.subr + +name=librenms +rcvar="${name}_enable" + +load_rc_config $name + +: ${librenms_enable:="NO"} +: ${librenms_user:="%%USER%%"} +: ${librenms_group:="%%GROUP%%"} +: ${librenms_pid:="/var/run/librenms/librenms.pid"} + +pidfile="$librenms_pid" +procname="%%PYTHON%%" +command="/usr/sbin/daemon" + +start_precmd=librenms_precmd + +librenms_precmd() +{ + [ -f /var/log/$name/$name-service.log ] || install -g $librenms_user -o $librenms_user -m 644 /var/log/$name/$name-service.log + [ -f /var/log/$name/$name.log ] || install -g $librenms_user -o $librenms_user -m 644 /var/log/$name/$name.log +} + +command_args="-T $name -o /var/log/$name/$name-service.log -p $pidfile $procname %%WWWDIR%%/librenms-service.py -m" + +run_rc_command "$1" diff --git a/net-mgmt/librenms/files/pkg-message.in b/net-mgmt/librenms/files/pkg-message.in index 009ed85427a8..702412ed6233 100644 --- a/net-mgmt/librenms/files/pkg-message.in +++ b/net-mgmt/librenms/files/pkg-message.in @@ -1,15 +1,33 @@ [ { type: install message: <<EOM -NOTE: setting sql-mode="" is no longer required. You can remove -it from /usr/local/etc/mysql/my.cnf You can mostly follow the guide at: http://docs.librenms.org/ with the following notes: - Installation directory is %%WWWDIR%% -- The following lines should be added to /etc/crontab: + +NOTE: setting sql-mode="" is no longer required. You can remove +it from /usr/local/etc/mysql/my.cnf + +HEADS UP + +Polling via cron job is now deprecated. Please use the Dispatcher. + +LibreNMS will be dropping support for PHP 7.1 and Python 2 in the next release +expected May 31 2020. see https://community.librenms.org/t/dropping-support-for-php-7-1-and-python-2/11851 + +Your existing crontab entries for the PYPOLLER option will be going away. + +You can migrate to the PYSERVICE option of LibreNMS now +(also known as the Dispatcher Service). + +The next release will not include the the PYPOLLER option. + +PYROLLER (deprecated) configuration (default): + +The following lines should be added to /etc/crontab: PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin 33 */6 * * * www cd %%WWWDIR%% && %%PHP%% discovery.php -h all >> /dev/null 2>&1 @@ -21,18 +39,49 @@ PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin 01 * * * * www %%PHP%% %%WWWDIR%%/billing-calculate.php >> /dev/null 2>&1 */5 * * * * www %%PHP%% %%WWWDIR%%/check-services.php >> /dev/null 2>&1 -For a fresh install, you need to create an APP_KEY: +PYSERVICE configuration (non-default): + +Enable the poller service with this command: + +sysrc librenms_enable="YES" + +The service will log to /var/log/librems/librenms-service.log + +see also https://docs.librenms.org/Extensions/Dispatcher-Service/ + +When converting from PYPOLLER to the Dispatcher Service (PYSERVICE), +these steps will help you get started: + +* compile with PYSERVICE enabled and PYPOLLER disabled +* comment out the crontab entries listed above under PYPOLLER +* populate %%WWWDIR%%/.env with: + * APP_KEY - see farther below for how to create + * NODE_ID - see just below for how to create + * DB_HOST + * DB_DATABASE + * DB_USERNAME + * DB_PASSWORD +* you can create a NODE_ID with: php -r 'echo uniqid() . "\n";' + +When setting up a new install, you need a %%WWWDIR%%/.env file. + +You need an APP_KEY. + +To create: cd %%WWWDIR%% cp -i .env.example .env That file will eventually contain secrets. Make sure it is not world-readable. +When migrating to PYSERVICE (also known as the Dispatcher Service): + It is also a good idea to: cd %%WWWDIR%% ./validate -You might need to set your database details in that file +Database connection details are required in that file. + Then run: php artisan key:generate @@ -61,7 +110,21 @@ cd %%WWWDIR%% re: https://docs.librenms.org/#General/Updating/ -Make sure your %%WWWDIR%%/.env file is not world-readable. +HEADS UP HEADS UP HEADS UP HEADS UP HEADS UP HEADS UP HEADS UP HEADS UP + +Polling via cron job is now deprecated. Please use the Dispatcher. + +LibreNMS will be dropping support for PHP 7.1 and Python 2 in the next release +expected May 31 2020. see https://community.librenms.org/t/dropping-support-for-php-7-1-and-python-2/11851 + +Your existing crontab entries for the PYPOLLER option will be going away. + +You can migrate to the PYSERVICE option of LibreNMS now +(also known as the Dispatcher Service). + +The next release will not include the PYPOLLER option. + +For more information, see pkg info --pkg-message librenms EOM } |