git: c9d3ef9898f4 - main - net-mgmt/p5-OSLV-Monitor: Add new port

From: Dan Langille <dvl_at_FreeBSD.org>
Date: Wed, 11 Sep 2024 01:25:42 UTC
The branch main has been updated by dvl:

URL: https://cgit.FreeBSD.org/ports/commit/?id=c9d3ef9898f4c2e7b836c8ad907e9fb6399e95b9

commit c9d3ef9898f4c2e7b836c8ad907e9fb6399e95b9
Author:     Dan Langille <dvl@FreeBSD.org>
AuthorDate: 2024-09-11 01:20:24 +0000
Commit:     Dan Langille <dvl@FreeBSD.org>
CommitDate: 2024-09-11 01:25:33 +0000

    net-mgmt/p5-OSLV-Monitor: Add new port
    
    This is an OS level virtualization monitoring extend for LibreNMS
    
    It can also monitor individual FreeBSD jails.
    
    The next release of LibreNMS should support this.
---
 net-mgmt/Makefile                             |  1 +
 net-mgmt/p5-OSLV-Monitor/Makefile             | 27 +++++++++++++++++++++
 net-mgmt/p5-OSLV-Monitor/distinfo             |  3 +++
 net-mgmt/p5-OSLV-Monitor/files/pkg-message.in | 35 +++++++++++++++++++++++++++
 net-mgmt/p5-OSLV-Monitor/pkg-descr            | 13 ++++++++++
 net-mgmt/p5-OSLV-Monitor/pkg-plist            |  8 ++++++
 6 files changed, 87 insertions(+)

diff --git a/net-mgmt/Makefile b/net-mgmt/Makefile
index 127eeaea27c7..ab80920924b8 100644
--- a/net-mgmt/Makefile
+++ b/net-mgmt/Makefile
@@ -270,6 +270,7 @@
     SUBDIR += p5-NetAddr-IP
     SUBDIR += p5-NetAddr-IP-Lite
     SUBDIR += p5-NetApp
+    SUBDIR += p5-OSLV-Monitor
     SUBDIR += p5-POE-Component-SNMP
     SUBDIR += p5-Prometheus-Tiny
     SUBDIR += p5-Prometheus-Tiny-Shared
diff --git a/net-mgmt/p5-OSLV-Monitor/Makefile b/net-mgmt/p5-OSLV-Monitor/Makefile
new file mode 100644
index 000000000000..85a510ff07b0
--- /dev/null
+++ b/net-mgmt/p5-OSLV-Monitor/Makefile
@@ -0,0 +1,27 @@
+PORTNAME=	OSLV-Monitor
+PORTVERSION=	0.0.1
+CATEGORIES=	net-mgmt
+MASTER_SITES=	#
+PKGNAMEPREFIX=	p5-
+
+MAINTAINER=	dan@langille.org
+COMMENT=	OS level virtualization monitoring extend
+WWW=		https://github.com/VVelox/OSLV-Monitor
+
+LICENSE=	GPLv3
+
+RUN_DEPENDS=	p5-Clone>0:devel/p5-Clone \
+		p5-ExtUtils-MakeMaker>0:devel/p5-ExtUtils-MakeMaker \
+		p5-File-Slurp>0:devel/p5-File-Slurp \
+		p5-JSON>0:converters/p5-JSON \
+		p5-MIME-Base64>0:converters/p5-MIME-Base64
+
+USES=		perl5
+USE_PERL5=	configure
+USE_GITHUB=	yes
+GH_ACCOUNT=	VVelox
+NO_BUILD=	YES
+
+SUB_FILES=	pkg-message
+
+.include <bsd.port.mk>
diff --git a/net-mgmt/p5-OSLV-Monitor/distinfo b/net-mgmt/p5-OSLV-Monitor/distinfo
new file mode 100644
index 000000000000..59502004bd60
--- /dev/null
+++ b/net-mgmt/p5-OSLV-Monitor/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1726013918
+SHA256 (VVelox-OSLV-Monitor-0.0.1_GH0.tar.gz) = 49bde2f580f57477e9acbac81a95e66787d75067103ce96b1f7a4c92fb2f2ecd
+SIZE (VVelox-OSLV-Monitor-0.0.1_GH0.tar.gz) = 25507
diff --git a/net-mgmt/p5-OSLV-Monitor/files/pkg-message.in b/net-mgmt/p5-OSLV-Monitor/files/pkg-message.in
new file mode 100644
index 000000000000..b6dff9563483
--- /dev/null
+++ b/net-mgmt/p5-OSLV-Monitor/files/pkg-message.in
@@ -0,0 +1,35 @@
+[
+{ type: install
+  message: <<EOM
+Assuming you are running net-mgmt/net-snmp as non-root (i.e. snmpd):
+
+1 - Create %%LOCALBASE%%/etc/cron.d/oslv with this (adjust the meil address)
+
+# use /bin/sh to run commands, overriding the default set by cron
+SHELL=/bin/sh
+# mail any output to here, no matter whose crontab this is
+MAILTO=me@example.org
+
+#minute	hour	mday	month	wday	who	    command
+4/5     *       *       *       *       snmpd       sudo %%LOCALBASE%%/bin/oslv_monitor -q
+
+2 - Create this directory:
+
+mkdir /var/cache/oslv_monitor
+chown snmpd:snmpd /var/cache/oslv_monitor
+
+3 - Create these sudo permissions:
+
+% cat %%LOCALBASE%%/etc/sudoers.d/snmpd 
+snmpd   ALL=(ALL) NOPASSWD:%%LOCALBASE%%/bin/oslv_monitor -q
+
+4 - add this line to %%LOCALBASE%%/etc/snmpd.conf:
+
+extend oslv_monitor     /bin/cat /var/cache/oslv_monitor/snmp
+
+5 - restart snmpd
+
+
+EOM
+}
+]
diff --git a/net-mgmt/p5-OSLV-Monitor/pkg-descr b/net-mgmt/p5-OSLV-Monitor/pkg-descr
new file mode 100644
index 000000000000..5890256a2d76
--- /dev/null
+++ b/net-mgmt/p5-OSLV-Monitor/pkg-descr
@@ -0,0 +1,13 @@
+OS level virtualization monitoring extend
+
+Designed for snmpd with LibreNMS
+
+Works with FreeBSD jails to provide jail-level metrics.
+
+Create a cronjob:
+
+*/5 * * * * /usr/local/bin/oslv_monitor -q
+
+The snmpd.conf extends:
+
+extend oslv_monitor     /bin/cat /var/cache/oslv_monitor/snmp
diff --git a/net-mgmt/p5-OSLV-Monitor/pkg-plist b/net-mgmt/p5-OSLV-Monitor/pkg-plist
new file mode 100644
index 000000000000..ec478e108231
--- /dev/null
+++ b/net-mgmt/p5-OSLV-Monitor/pkg-plist
@@ -0,0 +1,8 @@
+bin/oslv_monitor
+%%SITE_PERL%%/OSLV/Monitor.pm
+%%SITE_PERL%%/OSLV/Monitor/Backends/FreeBSD.pm
+%%SITE_PERL%%/OSLV/Monitor/Backends/cgroups.pm
+%%PERL5_MAN1%%/oslv_monitor.1.gz
+%%PERL5_MAN3%%/OSLV::Monitor.3.gz
+%%PERL5_MAN3%%/OSLV::Monitor::Backends::FreeBSD.3.gz
+%%PERL5_MAN3%%/OSLV::Monitor::Backends::cgroups.3.gz