diff --git a/net-mgmt/observium/Makefile b/net-mgmt/observium/Makefile index 1291d92f7bc3..6a0e5a0b9695 100644 --- a/net-mgmt/observium/Makefile +++ b/net-mgmt/observium/Makefile @@ -1,139 +1,127 @@ -# Observium version can be found by looking at ${WRKSRC}/includes/definitions/version.inc.php - PORTNAME= observium -PORTVERSION= 0.19.8 -PORTREVISION= 3 +DISTVERSION= 24.12 CATEGORIES= net-mgmt -MASTER_SITES= http://www.observium.org/ -DISTNAME= ${PORTNAME}-community-latest -DIST_SUBDIR= ${PORTNAME}-${PORTVERSION} +MASTER_SITES= https://www.observium.org/ PKGNAMESUFFIX= ${PHP_PKGNAMESUFFIX} +DISTNAME= ${PORTNAME}-community-${DISTVERSION} -MAINTAINER= ports@FreeBSD.org +MAINTAINER= xaaports@dohd.org COMMENT= Autodiscovering PHP/MySQL/SNMP based network monitoring WWW= https://observium.org LICENSE= EULA LICENSE_NAME= "Observium License Version 1.0" LICENSE_FILE= ${WRKSRC}/LICENSE.COMMUNITY LICENSE_PERMS= dist-mirror dist-sell pkg-mirror pkg-sell auto-accept -WRKSRC= ${WRKDIR}/${PORTNAME} +LIB_DEPENDS= libpng.so:graphics/png +RUN_DEPENDS= rrdtool:databases/rrdtool \ + dot:graphics/graphviz \ + mtr:net/mtr@nox11 \ + ${LOCALBASE}/share/pear/Net/IPv4.php:net/pear-Net_IPv4@${PHP_FLAVOR} \ + ${LOCALBASE}/share/pear/Net/IPv6.php:net/pear-Net_IPv6@${PHP_FLAVOR} \ + snmpget:net-mgmt/net-snmp \ + sudo:security/sudo -USES= cpe php:cli,flavors python shebangfix -IGNORE_WITH_PHP= 82 83 84 +USES= cpe php:cli,flavors,mod python shebangfix +USE_PHP= ctype filter gd iconv mysqli posix session snmp tokenizer xml zlib SHEBANG_FILES= \ poller-wrapper.py \ poller.php \ scripts/ -USE_PHP= ctype filter gd iconv mcrypt mysqli posix session snmp tokenizer xml zlib - NO_ARCH= yes NO_BUILD= yes +WRKSRC= ${WRKDIR}/${PORTNAME} -RUN_DEPENDS+= rrdtool:databases/rrdtool \ - dot:graphics/graphviz \ - mtr:net/mtr@nox11 \ - ${LOCALBASE}/share/pear/Net/IPv4.php:net/pear-Net_IPv4@${PHP_FLAVOR} \ - ${LOCALBASE}/share/pear/Net/IPv6.php:net/pear-Net_IPv6@${PHP_FLAVOR} \ - snmpget:net-mgmt/net-snmp \ - sudo:security/sudo -LIB_DEPENDS+= libpng.so:graphics/png - -OPTIONS_DEFINE= APACHEMOD DOCS EXAMPLES FPING IPMITOOL LIBVIRT MYSQLD NAGPLUGINS NMAP PYPOLLER SUBVERSION WMIC -OPTIONS_DEFAULT= APACHEMOD FPING IPMITOOL LIBVIRT NAGPLUGINS NMAP PYPOLLER SUBVERSION WMIC +OPTIONS_DEFINE= APACHEMOD DOCS EXAMPLES FPING IPMITOOL LIBVIRT MYSQLD NAGPLUGINS PYPOLLER SUBVERSION WMIC +OPTIONS_DEFAULT= APACHEMOD FPING IPMITOOL LIBVIRT NAGPLUGINS PYPOLLER SUBVERSION WMIC APACHEMOD_DESC= Use PHP with Apache 2.4+ module 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 +WMIC_DESC= Enable support for WMI polling FPING_RUN_DEPENDS= fping:net/fping IPMITOOL_RUN_DEPENDS= ipmitool:sysutils/ipmitool 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}mysqlclient>=1.3.13:databases/py-mysqlclient@${PY_FLAVOR} -.if ${WITH_SUBVERSION_VER:U} == LTS -SUBVERSION_RUN_DEPENDS= svn:devel/subversion-lts -.else SUBVERSION_RUN_DEPENDS= svn:devel/subversion -.endif WMIC_RUN_DEPENDS= wmic:net-mgmt/wmi-client .include SUB_FILES+= pkg-message observium.conf.sample SUB_LIST+= PHP="${PREFIX}/bin/php" PYTHON="${PYTHON_CMD}" ROOT_FILES= add_device.php adduser.php alerter.php \ - check-errors.php check-services.php config_to_json.php \ - config.php.default delete_device.php discovery.php housekeeping.php \ - irc.php poller-wrapper.py poller.php rename_device.php \ - snmp.conf.example snmpd.conf.example \ - snmptrap.php snmptrap.php syslog.php test_alert.php test_code.php VERSION + config.php.default config_to_json.php \ + delete_device.php discovery.php housekeeping.php \ + irc.php notifications.php observium-wrapper poller-wrapper.py poller.php \ + rename_device.php snmp.conf.example snmpd.conf.example \ + snmptrap.php syslog.php test_alert.php test_code.php test_db.php test_geo.php VERSION ROOT_DIRS= html includes libs logs mibs rrd scripts templates tests update PORTDOCS= INSTALL README VERSION PORTEXAMPLES= snmp.conf.example snmpd.conf.example .if ${PORT_OPTIONS:MAPACHEMOD} USES+= apache:run .endif .if !defined(PACKAGE_BUILDING) USES+= php:mod .else -# Package builder doesn't create php5 with module +# Package builder doesn't create php8 with module USES+= php:web .endif .if ${PORT_OPTIONS:MMYSQLD} USES+= mysql:server .else USES+= mysql:client .endif -post-patch: +pre-install: ${REINPLACE_CMD} 's|%%LOCALBASE%%|${LOCALBASE}|g' ${WRKSRC}/poller-wrapper.py ${WRKSRC}/poller.php ${FIND} ${WRKSRC} -type d -empty -delete ${MKDIR} ${WRKSRC}/logs ${WRKSRC}/rrd do-install: ${MKDIR} ${STAGEDIR}/${WWWDIR} ${STAGEDIR}/${PREFIX}/${APACHEETCDIR}/Includes ${INSTALL_DATA} ${WRKDIR}/observium.conf.sample ${STAGEDIR}/${PREFIX}/${APACHEETCDIR}/Includes .for dir in ${ROOT_DIRS} ${MKDIR} ${STAGEDIR}/${WWWDIR}/${dir} (cd ${WRKSRC}/${dir} && ${COPYTREE_SHARE} . ${STAGEDIR}/${WWWDIR}/${dir}) .endfor .for f in ${ROOT_FILES} ${INSTALL_DATA} ${WRKSRC}/${f} ${STAGEDIR}/${WWWDIR} .endfor # Files in scripts dir should be executable ${FIND} ${STAGEDIR}/${WWWDIR}/scripts -type f -exec ${CHMOD} +x {} \; # Ensure PHP and Python scripts are executable ${FIND} ${STAGEDIR}/${WWWDIR} -type f -name '*.py' -or -type f -name \ '*.php' -exec ${CHMOD} +x {} \; do-install-DOCS-on: ${MKDIR} ${STAGEDIR}/${DOCSDIR} .for f in ${PORTDOCS} ${INSTALL_DATA} ${WRKSRC}/${f} ${STAGEDIR}/${DOCSDIR} .endfor do-install-EXAMPLES-on: ${MKDIR} ${STAGEDIR}/${EXAMPLESDIR} .for f in ${PORTEXAMPLES} ${INSTALL_DATA} ${WRKSRC}/${f} ${STAGEDIR}/${EXAMPLESDIR} .endfor post-install: @${ECHO_CMD} "@sample ${APACHEETCDIR}/Includes/observium.conf.sample" >> ${TMPPLIST} @${FIND} -s ${STAGEDIR}${WWWDIR} -type f '(' -name '*.orig' -or -name '*.bak' ')' -delete @${FIND} -s ${STAGEDIR}${WWWDIR} -not -type d | ${SORT} | \ ${SED} -e 's#^${STAGEDIR}${PREFIX}/##' >> ${TMPPLIST} @${ECHO_CMD} "@dir(www,www,0775) ${WWWDIR}/logs" >> ${TMPPLIST} @${ECHO_CMD} "@dir(www,www,0775) ${WWWDIR}/rrd" >> ${TMPPLIST} .include diff --git a/net-mgmt/observium/distinfo b/net-mgmt/observium/distinfo index c37487935100..33cc2457e319 100644 --- a/net-mgmt/observium/distinfo +++ b/net-mgmt/observium/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1577933625 -SHA256 (observium-0.19.8/observium-community-latest.tar.gz) = 0603cc81c1fede6b87b187fde64843e11d6ed44f32705c68c41ddccf05d90d5b -SIZE (observium-0.19.8/observium-community-latest.tar.gz) = 85994042 +TIMESTAMP = 1741551019 +SHA256 (observium-community-24.12.tar.gz) = 477c492f756caa8d2faba40b66a53b13754513d1f42fb777568a522db783a6fb +SIZE (observium-community-24.12.tar.gz) = 130705254 diff --git a/net-mgmt/observium/files/observium.conf.sample.in b/net-mgmt/observium/files/observium.conf.sample.in index dbcb702254cc..7e8de82ec22c 100644 --- a/net-mgmt/observium/files/observium.conf.sample.in +++ b/net-mgmt/observium/files/observium.conf.sample.in @@ -1,74 +1,74 @@ # Observium cannot be ran on a sub-uri (See the FAQ # http://observium.org/docs/faq/). Hence this strawman # config runs it as a virtual host on port 8080. # # Replace the '*:8080' by the actual virtual host(name) # you will be using; and consider enabling SSL. An example # can be found at /usr/local/etc/apache24/extra/httpd-ssl.conf # LoadModule rewrite_module libexec/apache24/mod_rewrite.so - -LoadModule php7_module libexec/apache24/libphp7.so + +LoadModule php_module libexec/apache24/libphp.so Listen *:8080 Documentroot "%%WWWDIR%%/html" AddHandler application/x-httpd-php .php # # CustomLog "/var/log/httpd-observium-access.log" common DirectoryIndex index.php Options Indexes FollowSymLinks Multiviews AllowOverride None # These:w statement mirror the .htaccess # files that are part of the normal # Observium distribution. See the URL: # # https://httpd.apache.org/docs/current/howto/htaccess.html#when # # for the various reasons to promote # these to an apache config file. # RedirectMatch 404 /\. RewriteEngine on RewriteBase / # Block access to hidden files/dirs RewriteRule ^\..*$ - [F,L] # Don't favicon! RewriteCond %{REQUEST_FILENAME} !^favicon\.ico RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !\.(js|ico|txt|gif|jpg|png|css|php) RewriteCond %{REQUEST_URI} !^api/ RewriteCond %{REQUEST_URI} !^rrd/ RewriteCond %{REQUEST_URI} !=/server-status RewriteRule ^(.*)$ index.php/$1/ AcceptPathInfo On Require all granted deny from all deny from all deny from all diff --git a/net-mgmt/observium/files/patch-includes_defaults.inc.php b/net-mgmt/observium/files/patch-includes_defaults.inc.php index eabe68f28e85..5ddafff92bc3 100644 --- a/net-mgmt/observium/files/patch-includes_defaults.inc.php +++ b/net-mgmt/observium/files/patch-includes_defaults.inc.php @@ -1,63 +1,54 @@ ---- includes/defaults.inc.php.orig 2019-08-23 07:09:46 UTC +--- includes/defaults.inc.php.orig 2024-12-23 01:13:57 UTC +++ includes/defaults.inc.php -@@ -57,7 +57,7 @@ $config['db']['debug'] = TRUE; // If TRUE +@@ -77,7 +77,7 @@ $config['db']['debug'] = FALSE; // If TRUE store // Default directories -#$config['install_dir'] = "/opt/observium"; -+$config['install_dir'] = "/usr/local/www/observium"; ++#$config['install_dir'] = "/usr/local/www/observium"; #$config['html_dir'] = $config['install_dir'] . "/html"; #$config['rrd_dir'] = $config['install_dir'] . "/rrd"; #$config['template_dir'] = $config['install_dir'] . "/templates"; -@@ -71,30 +71,30 @@ $config['db']['debug'] = TRUE; // If TRUE +@@ -93,26 +93,26 @@ $config['db']['debug'] = FALSE; // If TRUE store // Location of executables --$config['rrdtool'] = "/usr/bin/rrdtool"; --$config['fping'] = "/usr/bin/fping"; --$config['fping6'] = "/usr/bin/fping6"; --$config['snmpwalk'] = "/usr/bin/snmpwalk"; --$config['snmpget'] = "/usr/bin/snmpget"; --$config['snmpgetnext'] = "/usr/bin/snmpgetnext"; --$config['snmpbulkget'] = "/usr/bin/snmpbulkget"; --$config['snmpbulkwalk'] = "/usr/bin/snmpbulkwalk"; --$config['snmptranslate'] = "/usr/bin/snmptranslate"; -+$config['rrdtool'] = "/usr/local/bin/rrdtool"; -+$config['fping'] = "/usr/local/sbin/fping"; -+$config['fping6'] = "/usr/local/sbin/fping6"; -+$config['snmpwalk'] = "/usr/local/bin/snmpwalk"; -+$config['snmpget'] = "/usr/local/bin/snmpget"; -+$config['snmpgetnext'] = "/usr/local/bin/snmpgetnext"; -+$config['snmpbulkget'] = "/usr/local/bin/snmpbulkget"; -+$config['snmpbulkwalk'] = "/usr/local/bin/snmpbulkwalk"; -+$config['snmptranslate'] = "/usr/local/bin/snmptranslate"; - $config['whois'] = "/usr/bin/whois"; --$config['mtr'] = "/usr/bin/mtr"; --$config['nmap'] = "/usr/bin/nmap"; --$config['ipmitool'] = "/usr/bin/ipmitool"; --$config['virsh'] = "/usr/bin/virsh"; --$config['dot'] = "/usr/bin/dot"; --$config['unflatten'] = "/usr/bin/unflatten"; --$config['neato'] = "/usr/bin/neato"; --$config['sfdp'] = "/usr/bin/sfdp"; --$config['svn'] = "/usr/bin/svn"; --$config['git'] = "/usr/bin/git"; // Used in show device config feature for git-enabled repos and rancid >= 3.2 --$config['wmic'] = "/bin/wmic"; -+$config['mtr'] = "/usr/local/sbin/mtr"; -+$config['nmap'] = "/usr/local/bin/nmap"; -+$config['ipmitool'] = "/usr/local/bin/ipmitool"; -+$config['virsh'] = "/usr/local/bin/virsh"; -+$config['dot'] = "/usr/local/bin/dot"; -+$config['unflatten'] = "/usr/local/bin/unflatten"; -+$config['neato'] = "/usr/local/bin/neato"; -+$config['sfdp'] = "/usr/local/bin/sfdp"; -+$config['svn'] = "/usr/local/bin/svn"; -+$config['git'] = "/usr/local/bin/git"; // Used in show device config feature for git-enabled repos and rancid >= 3.2 -+$config['wmic'] = "/usr/local/bin/wmic"; - $config['file'] = "/usr/bin/file"; - $config['wc'] = "/usr/bin/wc"; --$config['sudo'] = "/usr/bin/sudo"; -+$config['sudo'] = "/usr/local/bin/sudo"; - $config['tail'] = "/usr/bin/tail"; - $config['cut'] = "/usr/bin/cut"; - $config['tr'] = "/usr/bin/tr"; +-$config['rrdtool'] = "/usr/bin/rrdtool"; +-$config['fping'] = "/usr/bin/fping"; +-$config['fping6'] = "/usr/bin/fping6"; // Note, for version 4+ not required +-$config['snmpwalk'] = "/usr/bin/snmpwalk"; +-$config['snmpget'] = "/usr/bin/snmpget"; +-$config['snmpgetnext'] = "/usr/bin/snmpgetnext"; +-$config['snmpbulkget'] = "/usr/bin/snmpbulkget"; +-$config['snmpbulkwalk'] = "/usr/bin/snmpbulkwalk"; +-$config['snmptranslate'] = "/usr/bin/snmptranslate"; ++$config['rrdtool'] = "/usr/local/bin/rrdtool"; ++$config['fping'] = "/usr/local/sbin/fping"; ++$config['fping6'] = "/usr/local/sbin/fping6"; // Note, for version 4+ not required ++$config['snmpwalk'] = "/usr/local/bin/snmpwalk"; ++$config['snmpget'] = "/usr/local/bin/snmpget"; ++$config['snmpgetnext'] = "/usr/local/bin/snmpgetnext"; ++$config['snmpbulkget'] = "/usr/local/bin/snmpbulkget"; ++$config['snmpbulkwalk'] = "/usr/local/bin/snmpbulkwalk"; ++$config['snmptranslate'] = "/usr/local/bin/snmptranslate"; + $config['whois'] = "/usr/bin/whois"; // ip_whois() +-$config['mtr'] = "/usr/bin/mtr"; // is_pingable() +-$config['ipmitool'] = "/usr/bin/ipmitool"; // ipmi module +-$config['virsh'] = "/usr/bin/virsh"; // libvirt module +-$config['wmic'] = "/bin/wmic"; // wmi_cmd() +-$config['dot'] = "/usr/bin/dot"; // Graphviz, networkmap (only) ++$config['mtr'] = "/usr/local/sbin/mtr"; // is_pingable() ++$config['ipmitool'] = "/usr/local/bin/ipmitool"; // ipmi module ++$config['virsh'] = "/usr/local/bin/virsh"; // libvirt module ++$config['wmic'] = "/usr/local/bin/wmic"; // wmi_cmd() ++$config['dot'] = "/usr/local/bin/dot"; // Graphviz, networkmap (only) + //$config['unflatten'] = "/usr/bin/unflatten"; // Graphviz, networkmap (only, unused) + //$config['neato'] = "/usr/bin/neato"; // Graphviz (unused) + //$config['sfdp'] = "/usr/bin/sfdp"; // Graphviz, networkmap (only, unused) +-$config['svn'] = "/usr/bin/svn"; +-$config['git'] = "/usr/bin/git"; // Used in show device config feature for git-enabled repos and rancid >= 3.2 ++$config['svn'] = "/usr/local/bin/svn"; ++$config['git'] = "/usr/local/bin/git"; // Used in show device config feature for git-enabled repos and rancid >= 3.2 + //$config['nmap'] = "/usr/bin/nmap"; // unused + //$config['file'] = "/usr/bin/file"; // unused + //$config['wc'] = "/usr/bin/wc"; // unused diff --git a/net-mgmt/observium/files/patch-poller-wrapper.py b/net-mgmt/observium/files/patch-poller-wrapper.py index 32438e9a36ff..8ad06711a42a 100644 --- a/net-mgmt/observium/files/patch-poller-wrapper.py +++ b/net-mgmt/observium/files/patch-poller-wrapper.py @@ -1,11 +1,10 @@ ---- poller-wrapper.py.orig 2017-12-02 14:04:45 UTC +--- poller-wrapper.py.orig 2025-03-15 14:27:22 UTC +++ poller-wrapper.py -@@ -72,6 +72,8 @@ except: - print("threading, sys, subprocess, os, json") +@@ -63,6 +63,7 @@ except ImportError: + print("threading, sys, subprocess, os, json, stat") sys.exit(2) +os.environ['PATH'] += ':%%LOCALBASE%%/sbin:%%LOCALBASE%%/bin' -+ - """ - Register global exepthook for ability stop execute wrapper by Ctrl+C - See: https://stackoverflow.com/questions/6598053/python-global-exception-handling + + def new_except_hook(exctype, value, traceback): + """ diff --git a/net-mgmt/observium/files/pkg-message.in b/net-mgmt/observium/files/pkg-message.in index 89c190cfb964..c63cad79ee50 100644 --- a/net-mgmt/observium/files/pkg-message.in +++ b/net-mgmt/observium/files/pkg-message.in @@ -1,81 +1,78 @@ [ { type: install message: </dev/null 2>&1 +# Run automated discovery of newly added devices every 5 minutes +*/5 * * * * www %%WWWDIR%%/observium-wrapper discovery --host new >/dev/null 2>&1 +# Run multithreaded poller wrapper every 5 minutes +*/5 * * * * www %%WWWDIR%%/observium-wrapper poller >/dev/null 2>&1 +# Run housekeeping script daily for syslog, eventlog and alert log +13 5 * * * www %%WWWDIR%%/housekeeping.php -ysel >/dev/null 2>&1 +# Run housekeeping script daily for rrds, ports, orphaned entries in the database and performance data +47 4 * * * www %%WWWDIR%%/housekeeping.php -yrptb >/dev/null 2>&1 Notes: -- With newer MySQL databases you may need to disable strict mode for - Observium to function: - - SET GLOBAL sql_mode = ''; - -- Apache needs mod_rewrite enabled; uncomment the line below in httpd.conf as needed. - - LoadModule rewrite_module libexec/apache24/mod_rewrite.so - - A minimal install can be created with the following steps and configuration file: 0: make sure apache and mysql are up and running. 1: create the database and a dbaccount with the following (my)SQL commands: CREATE DATABASE observium DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; GRANT ALL PRIVILEGES ON observium.* TO 'observium'@'localhost' IDENTIFIED BY 'notSecure'; - SET GLOBAL sql_mode = ''; -2: create a minimal config file at: +2: create config file starting with the sample config file - %%WWWDIR%%/config.php + cp %%WWWDIR%%/config.php.default %%WWWDIR%%/config.php - containing: + and make sure to set at least the following fields: -