Compare commits

...

2 Commits

Author SHA1 Message Date
81b70f3a5e Added PR #723 2024-09-09 11:17:40 +02:00
53b60cbc27 Import check_mk_agent from ports 2024-09-09 11:15:45 +02:00
5 changed files with 144 additions and 0 deletions

View File

@ -0,0 +1,70 @@
PORTNAME= check_mk_agent
DISTVERSIONPREFIX= v
DISTVERSION= 2.3.0p12
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 \
https://raw.githubusercontent.com/Checkmk/checkmk/${DISTVERSIONFULL}/:license
DISTFILES= ${_CHECKMK_AGENT}:agent \
README.FreeBSD:doc \
COPYING:license
DIST_SUBDIR= ${PORTNAME}-${PORTVERSION}
MAINTAINER= ivalentine@arizona.edu
COMMENT= Checkmk agent to monitor *nix style systems
WWW= https://checkmk.com/
LICENSE= GPLv2
LICENSE_FILE= ${WRKSRC}/COPYING
RUN_DEPENDS= bash:shells/bash \
ipmitool:sysutils/ipmitool \
statgrab:devel/libstatgrab \
wget:ftp/wget
USES= perl5 python:3.4+ shebangfix
USE_PERL5= run
SHEBANG_FILES= ${_CHECKMK_AGENT}
EXTRACT_CMD= ${CP}
EXTRACT_BEFORE_ARGS= # none
EXTRACT_AFTER_ARGS= ${WRKSRC}
NO_ARCH= yes
NO_BUILD= yes
NO_TEST= yes
SUB_FILES= pkg-message
SUB_LIST= PORTNAME=${PORTNAME}
NO_WRKSUBDIR= yes
PLIST_FILES= bin/${PORTNAME}
PORTDOCS= README.FreeBSD
OPTIONS_DEFINE= DOCS
_CHECKMK_AGENT= ${PORTNAME}.freebsd
_CHECKMK_LIBDIR= ${PREFIX}/lib/check_mk_agent
_CHECKMK_CONFDIR= ${PREFIX}/etc/check_mk
post-patch:
@${REINPLACE_CMD} \
-e 's|%%CHECKMK_LIBDIR%%|${_CHECKMK_LIBDIR}|' \
-e 's|%%CHECKMK_CONFDIR%%|${_CHECKMK_CONFDIR}|' \
-e 's|%%LOCALBASE%%|${LOCALBASE}|g' \
${WRKSRC}/${_CHECKMK_AGENT}
do-install:
${INSTALL_SCRIPT} ${WRKSRC}/${_CHECKMK_AGENT} \
${STAGEDIR}${PREFIX}/bin/${PORTNAME}
post-install-DOCS-on:
@${MKDIR} ${STAGEDIR}${DOCSDIR}
${INSTALL_DATA} ${WRKSRC}/README.FreeBSD \
${STAGEDIR}${DOCSDIR}
.include <bsd.port.mk>

View File

@ -0,0 +1,7 @@
TIMESTAMP = 1723755628
SHA256 (check_mk_agent-2.3.0.p12/check_mk_agent.freebsd) = e90757599339de56cab8f5059a1006d20f6bdfe9cb5cfd8460b95deee8039ffd
SIZE (check_mk_agent-2.3.0.p12/check_mk_agent.freebsd) = 32404
SHA256 (check_mk_agent-2.3.0.p12/README.FreeBSD) = 01094a2197ca0a3a43ac16098c0f800d2ee808db2fd9a2f133f4bad04062ec5f
SIZE (check_mk_agent-2.3.0.p12/README.FreeBSD) = 1349
SHA256 (check_mk_agent-2.3.0.p12/COPYING) = fbaab079995bef694ef8451f0f763b91b44e5b57b8e2a487d2a240b395187a7f
SIZE (check_mk_agent-2.3.0.p12/COPYING) = 15174

View File

@ -0,0 +1,35 @@
--- check_mk_agent.freebsd.orig 2024-09-09 09:16:10 UTC
+++ check_mk_agent.freebsd
@@ -118,8 +118,8 @@ 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_CONFDIR:=/usr/local/etc/check_mk}"
+ : "${MK_VARDIR:=/var/db/check_mk_agent}"
: "${MK_LOGDIR:=/var/log/check_mk_agent}"
# some 'booleans'
@@ -597,6 +597,21 @@ run_purely_synchronous_sections() {
rm -f "${tmpfile}"
fi
+
+ 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
}
#

View File

@ -0,0 +1,16 @@
[
{ type: install
message: <<EOM
Checkmk may collect additional data if the following ports are installed:
- sysutils/megacli
- mail/postfix
- mail/qmail
See the code of the agent (%%PREFIX%%/bin/%%PORTNAME%%) for details.
Configuration instructions may be found in one of the following places:
- %%DOCSDIR%%/README.FreeBSD
- https://docs.checkmk.com/latest/en/agent_freebsd.html
EOM
}
]

View File

@ -0,0 +1,16 @@
For a monitoring system to receive more information from an endpoint
other than that it is simply accessible, help is required from the
target system. For example - how else can Checkmk know how full a
server's storage volume is without that system somehow providing the
information? The component that provides this information is always an
active piece of software - namely a monitoring agent, usually just
referred to as an agent. An agent collects data relevant to monitoring
from a host at specified intervals and transmits that data to the
monitoring server.
For servers and workstations, Checkmk provides its own agents, these
are known as Checkmk agents. Checkmk agents are available for a wide
variety of operating systems - from the commonplace such as Windows and
Linux to exotics such as OpenVMS. The agents are passive and listen on
TCP port 6556. Only on receiving a Checkmk server query will these
agents be activated and respond with the required data.