From e8e79c650f4ced982142440d92636e6b67e99ec1 Mon Sep 17 00:00:00 2001 From: Fabian Keil Date: Mon, 16 May 2016 15:30:22 +0200 Subject: [PATCH] sysutils/munin-node: Fix swap accounting if there are multiple devices If there's more than one swap device, swapinfo adds the totals in the last line: [fk@elektrobier ~]$ swapinfo -k Device 1K-blocks Used Avail Capacity /dev/gpt/swap-ada0.eli 4194304 1775064 2419240 42% /dev/gpt/swap-ada1.eli 4194304 1714180 2480124 41% /dev/gpt/swap-ada3.eli 4194304 1012152 3182152 24% /dev/gpt/swap-ada2.eli 4194304 1012636 3181668 24% Total 16777216 5514032 11263184 33% Let the memory plugin filter out the "Total" line before adding the columns to prevent inflated values. Looks like upstreaming would require executing proprietary and unsigned software and a Github account, oh well ... Obtained from: ElectroBSD --- sysutils/munin-node/Makefile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sysutils/munin-node/Makefile b/sysutils/munin-node/Makefile index 38cc459..ca91596 100644 --- a/sysutils/munin-node/Makefile +++ b/sysutils/munin-node/Makefile @@ -3,7 +3,7 @@ PORTNAME= munin PORTVERSION= ${MUNIN_VERSION} -PORTREVISION= 4 +PORTREVISION= 5 CATEGORIES= sysutils perl5 MASTER_SITES= ${MUNIN_SITES} PKGNAMESUFFIX= -node @@ -69,6 +69,12 @@ post-patch: -e 's|^\(PYTHON[[:space:]]*:=\).*|\1 ${python_CMD}|' \ -e 's|^\(RUBY[[:space:]]*:=\).*|\1 ${ruby_CMD}|' \ ${WRKSRC}/Makefile.config +# If there's more than one swap device, swapinfo adds the totals +# in the last line. Suppress the line to prevent value duplication. +# If there's only a single swap device, the totals are omitted for +# obvious reasons, therefore we can't simple grep for them. + @${REINPLACE_CMD} -E -e 's@(swapinfo -k)@\1 | grep -v ^Total@' \ + ${WRKSRC}/plugins/node.d.freebsd/memory.in @${FIND} ${WRKSRC}/node/sbin -type f -name "*.orig" -delete post-install: -- 2.7.4