Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 1 Nov 2024 17:04:02 GMT
From:      Bernhard Froehlich <decke@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: d2757d98eb2f - main - net-mgmt/check_mk_agent: Add sysctl_mem feature
Message-ID:  <202411011704.4A1H42km078826@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by decke:

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

commit d2757d98eb2f6c0b2e95da75f95397a59c8f0bf3
Author:     Xavier Beaudouin <kiwi@oav.net>
AuthorDate: 2024-11-01 17:00:38 +0000
Commit:     Bernhard Froehlich <decke@FreeBSD.org>
CommitDate: 2024-11-01 17:03:23 +0000

    net-mgmt/check_mk_agent: Add sysctl_mem feature
    
    PR:             281384
    Approved by:    Ian Valentine <ivalentine@arizona.edu> (maintainer)
    See:            https://github.com/Checkmk/checkmk/pull/723
---
 net-mgmt/check_mk_agent/Makefile                   | 11 +++---
 .../files/patch-check__mk__agent.freebsd           | 42 +++++++++++-----------
 2 files changed, 27 insertions(+), 26 deletions(-)

diff --git a/net-mgmt/check_mk_agent/Makefile b/net-mgmt/check_mk_agent/Makefile
index 075b3bcba506..674faa3870fe 100644
--- a/net-mgmt/check_mk_agent/Makefile
+++ b/net-mgmt/check_mk_agent/Makefile
@@ -1,6 +1,7 @@
 PORTNAME=	check_mk_agent
 DISTVERSIONPREFIX=	v
 DISTVERSION=	2.3.0p16
+PORTREVISION=	1
 CATEGORIES=	net-mgmt
 MASTER_SITES=	https://raw.githubusercontent.com/Checkmk/checkmk/${DISTVERSIONFULL}/agents/:agent \
 		https://raw.githubusercontent.com/Checkmk/checkmk/${DISTVERSIONFULL}/doc/agents/:doc \
@@ -22,7 +23,7 @@ RUN_DEPENDS=	bash:shells/bash \
 		statgrab:devel/libstatgrab \
 		wget:ftp/wget
 
-USES=		perl5 python:3.4+ shebangfix
+USES=		perl5 python:3.4+,run shebangfix
 USE_PERL5=	run
 
 SHEBANG_FILES=	${_CHECKMK_AGENT}
@@ -49,12 +50,14 @@ OPTIONS_DEFINE=	DOCS
 _CHECKMK_AGENT=		${PORTNAME}.freebsd
 _CHECKMK_LIBDIR=	${PREFIX}/lib/check_mk_agent
 _CHECKMK_CONFDIR=	${PREFIX}/etc/check_mk
+_CHECKMK_VARDIR=	/var/db/check_mk_agent
 
 post-patch:
 	@${REINPLACE_CMD} \
-		-e 's|%%CHECKMK_LIBDIR%%|${_CHECKMK_LIBDIR}|' \
-		-e 's|%%CHECKMK_CONFDIR%%|${_CHECKMK_CONFDIR}|' \
-		-e 's|%%LOCALBASE%%|${LOCALBASE}|g' \
+		-e 's|/usr/local/lib/check_mk_agent|${_CHECKMK_LIBDIR}|' \
+		-e 's|/etc/check_mk|${_CHECKMK_CONFDIR}|' \
+		-e 's|/var/lib/check_mk_agent|${_CHECKMK_VARDIR}|' \
+		-e 's|/usr/local|${LOCALBASE}|g' \
 		${WRKSRC}/${_CHECKMK_AGENT}
 
 do-install:
diff --git a/net-mgmt/check_mk_agent/files/patch-check__mk__agent.freebsd b/net-mgmt/check_mk_agent/files/patch-check__mk__agent.freebsd
index 09e7ebd944c3..43c62cdc052e 100644
--- a/net-mgmt/check_mk_agent/files/patch-check__mk__agent.freebsd
+++ b/net-mgmt/check_mk_agent/files/patch-check__mk__agent.freebsd
@@ -1,26 +1,24 @@
---- check_mk_agent.freebsd.orig	2024-08-15 18:32:18 UTC
+--- check_mk_agent.freebsd.orig	2024-10-02 06:30:56 UTC
 +++ check_mk_agent.freebsd
-@@ -117,9 +117,9 @@ set_variable_defaults() {
- #
- 
- set_variable_defaults() {
--    : "${MK_LIBDIR:=/usr/local/lib/check_mk_agent}"
--    : "${MK_CONFDIR:=/etc/check_mk}"
--    : "${MK_VARDIR:=/var/lib/check_mk_agent}"
-+    : "${MK_LIBDIR:=%%CHECKMK_LIBDIR%%}"
-+    : "${MK_CONFDIR:=%%CHECKMK_CONFDIR%%}"
-+    : "${MK_VARDIR:=/var/db/check_mk_agent}"
-     : "${MK_LOGDIR:=/var/log/check_mk_agent}"
- 
-     # some 'booleans'
-@@ -138,8 +138,8 @@ preamble_1() {
-     # Make sure locally installed binaries are found
-     # Only add binaries if they are not already in the path! If you append to path in a loop the process will
-     # eventually each the 128k size limit for the environment and become a zombie process. See execve manpage.
--    [ "${PATH#*"/usr/local/bin"}" != "${PATH}" ] || PATH="${PATH}:/usr/local/bin"
--    [ "${PATH#*"/usr/local/sbin"}" != "${PATH}" ] || PATH="${PATH}:/usr/local/sbin"
-+    [ "${PATH#*"%%LOCALBASE%%/bin"}" != "${PATH}" ] || PATH="${PATH}:%%LOCALBASE%%/bin"
-+    [ "${PATH#*"%%LOCALBASE%%/sbin"}" != "${PATH}" ] || PATH="${PATH}:%%LOCALBASE%%/sbin"
+@@ -142,6 +142,21 @@ preamble_1() {
+     [ "${PATH#*"/usr/local/sbin"}" != "${PATH}" ] || PATH="${PATH}:/usr/local/sbin"
      [ -d "/var/qmail/bin" ] && { [ "${PATH#*"/var/qmail/bin"}" != "${PATH}" ] || PATH="${PATH}:/var/qmail/bin"; }
  
++    echo '<<<sysctl_mem>>>'
++    _page_size=$( sysctl -n vm.stats.vm.v_page_size )
++    echo "mem.cache $(( _page_size * $( sysctl -n vm.stats.vm.v_cache_count ) ))"
++    echo "mem.free $(( _page_size * $( sysctl -n vm.stats.vm.v_free_count ) ))"
++    echo "mem.total $( sysctl -n hw.physmem )"
++    echo "mem.used $(( _page_size * ( $( sysctl -n vm.stats.vm.v_active_count ) + $( sysctl -n vm.stats.vm.v_wire_count ) ) ))"
++    _swap_total=$( sysctl -n vm.swap_total )
++    _swap_used=$(( $( swapinfo | tail -1 | awk '{print $3}' ) * 1024 ))
++    echo "swap.free $(( _swap_total - _swap_used ))"
++    echo "swap.total ${_swap_total}"
++    echo "swap.used ${_swap_used}"
++    unset -v _page_size
++    unset -v _swap_total
++    unset -v _swap_used
++
      # All executables in PLUGINSDIR will simply be executed and their
+     # ouput appended to the output of the agent. Plugins define their own
+     # sections and must output headers with '<<<' and '>>>'



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202411011704.4A1H42km078826>