#!/bin/sh
#
############################################################
# The apan-plugin that needs this file has been obsoleted!
# The new plugin only depends on check_nt from NSClient
############################################################
#
# This plugin is used by Apan to get CPU and Memory usage from an
# Windows-server.
# The plugin uses NSClient (http://nsclient.ready2run.nl/).
#
#
# Change this if you don't have a default installation
. /usr/local/nagios/apan/apan.defs


HOST=$1
CHK=$2

case $CHK in
	CPULOAD)
	VAL=`$PLUGINSDIR/check_nt -H $HOST -v CPULOAD -l 10,100,100`
	RES=$?
	#echo $VAL
	VAL=`echo $VAL|grep "%"|awk '{print $NF}'|cut -d "%" -f 1|tr -d " "`
	;;
	MEMUSE)
	VAL=`$PLUGINSDIR/check_nt -H $HOST -v MEMUSE -w 100 -c 100`
	RES=$?
	#echo $VAL
	VAL=`echo $VAL|grep "%"|cut -d "-" -f 2|awk '{print $NF}'|tr -d "()% "`
	;;
	*)
	VAL=3
	;;
esac

echo "$RES:$VAL"
