$OpenBSD: patch-plugins_node_d_openbsd_systat_in,v 1.1 2010/10/23 15:52:23 sthen Exp $
--- plugins/node.d.openbsd/systat.in.orig	Mon Jul 13 19:53:38 2009
+++ plugins/node.d.openbsd/systat.in	Sat Oct 23 16:27:57 2010
@@ -1,11 +1,11 @@
 #!/bin/sh
-# System statistics for FreeBSD
-# Author: Gergely Czuczy <phoemix@harmless.hu>
+# System statistics for OpenBSD, adapted from FreeBSD plugin
+# Author: Gergely Czuczy <phoemix@harmless.hu>, adapted sthen@openbsd.org
 #
 #%# family=auto
 #%# capabilities=autoconf
 
-sysctl='/sbin/sysctl'
+sysctl='/usr/bin/vmstat'
 
 case $1 in
     config)
@@ -40,11 +40,11 @@ EOF
 	    exit 0
 	fi
 	ostype=`uname -s`
-	if [ ${ostype} = "FreeBSD" ]; then
+	if [ ${ostype} = "OpenBSD" ]; then
 	    echo "yes"
 	    exit 0
 	fi
-	echo "no (You're OS is not supported by this plugin)"
+	echo "no (Your OS is not supported by this plugin)"
 	exit 0
 	;;
     suggest)
@@ -52,13 +52,12 @@ EOF
 	;;
 esac
 
-${sysctl} vm.stats.sys.v_soft vm.stats.sys.v_intr vm.stats.sys.v_syscall vm.stats.sys.v_trap vm.stats.sys.v_swtch \
-    vm.stats.vm.v_forks vm.stats.vm.v_rforks vm.stats.vm.v_vforks| awk '
+vmstat -s | awk '
 BEGIN {forks=0;}
-/^vm.stats.sys.v_soft/{print "softint.value",$2}
-/^vm.stats.sys.v_intr/{print "hardint.value",$2}
-/^vm.stats.sys.v_syscall/{print "syscall.value",$2}
-/^vm.stats.sys.v_swtch/{print "cs.value",$2}
-/^vm.stats.vm.v_[rv]?forks/ {forks+=$2}
+/^[ 0-9]*software interrupts/{print "softint.value",$1}
+/^[ 0-9]*interrupts/{print "hardint.value",$1}
+/^[ 0-9]*syscalls/{print "syscall.value",$1}
+/^[ 0-9]*cpu context switches/{print "cs.value",$1}
+/^[ 0-9]*forks/ {forks+=$1}
 END {print "forks.value",forks;}
 '
