ports/net-mgmt/check_mk_agent/files/patch-check__mk__agent.freebsd
Xavier Beaudouin d2757d98eb
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
2024-11-01 18:03:23 +01:00

24 lines
1.2 KiB
Text

--- check_mk_agent.freebsd.orig 2024-10-02 06:30:56 UTC
+++ check_mk_agent.freebsd
@@ -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 '>>>'