[Nagiosplug-devel] [patch] check_swap for NetBSD/OpenBSD

sean finney seanius at seanius.net
Sat Aug 14 18:18:10 CEST 2004


hey there,

after taking a look to see how it was done with the swap/swapinfo
commands, i've added the functionality to the configure script
to detect the NetBSD/OpenBSD swapctl command and configure
itself accordingly.  i've kept the patch as minimal as possible
(basically copying what was done for swap/swapinfo in configure.in),
and it's based off of a cvs checkout from earlier this afternoon.

fwiw, i've tested this on NetBSD macppc and i386, as well as 
OpenBSD i386.


	sean
-------------- next part --------------
--- configure.in.old	2004-08-14 00:40:12.000000000 -0400
+++ configure.in	2004-08-14 00:42:51.000000000 -0400
@@ -1362,6 +1362,32 @@
 dnl end if for PATH_TO_SWAPINFO
 fi
 
+AC_PATH_PROG(PATH_TO_SWAPCTL,swapctl,,[$PATH:/sbin])
+if (test -n "$PATH_TO_SWAPCTL")
+then
+AC_MSG_CHECKING([for $PATH_TO_SWAPCTL format])
+if [$PATH_TO_SWAPCTL -l 2>&1 >/dev/null]
+then
+	ac_cv_have_swap=yes
+	ac_cv_swap_command="$PATH_TO_SWAPCTL -l"
+	if [$PATH_TO_SWAPCTL -l 2>/dev/null | \
+		egrep -i "^Device +1K-blocks +Used +Avail +Capacity +Priority" >/dev/null ]
+	then
+		ac_cv_swap_format=["%*s %llu %*d %llu %*d"]
+		ac_cv_swap_conv=1024
+		AC_MSG_RESULT([using 1K BSD format swapctl])
+
+	elif [$PATH_TO_SWAPCTL -l 2>/dev/null | \
+		egrep -i "^Device +512-blocks +Used +Avail +Capacity +Priority" >/dev/null ]
+	then
+		ac_cv_swap_format=["%*s %llu %*d %llu %*d"]
+		ac_cv_swap_conv=2048
+		AC_MSG_RESULT([using 512 byte BSD format swapctl])
+	fi
+fi
+dnl end if for PATH_TO_SWAPCTL
+fi
+
 if test "x$ac_cv_have_swap" != "x" 
 then
 	AC_DEFINE(HAVE_SWAP,1,[Define if swap/swapinfo command is found])
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <https://www.monitoring-plugins.org/archive/devel/attachments/20040814/e89b95a9/attachment.sig>


More information about the Devel mailing list