#!/bin/sh
# Sample agent file for bcnu Version 1
#
# The agent can be called from another script as follows
# agentname master agent loglevel
#
# where	agentname is the dir/file name of the agent
# 	master		is the name of the master host
#	agent		is the name which appears on alerts etc
#	logint		is the current logging interval (0 will log immediately)
#
# if the command line arguments are not supplied, then the following environment
# variables can be set to supply the values
#
#	BCNUHOST	N.B. this should not normally be changed
#	BCNUAGENT	change if you want the agent's name to be different
#	BCNULOGINT	if > 0 alerts will not be sent, but logged in the logfile
#
# if none of the above are set, sensible defaults will apply
#
# N.B. if embedding the agent in another script, e.g. some housekeeping routine
# then you should clear any command line variables before invoking as it may
# confuse the agent
#
#
# set up the environment
. /usr/local/bcnu/etc/bcnuenv
. $BCNUHOME/agent/agent_head

# checks for warning condition
	 if your warning condition
	   then
		BCNUMSG="$BCNU -m 'warning - your message' -f your file -e $BCNU_WARN -t $BCNUHOSTTYPE $BCNUHOST"
		bcnu_warn_send
		OK=

# checks for error condition
	 elif your error condition
	   then
		BCNUMSG="$BCNU -m 'error - your message' -f your file -e $BCNU_ERR -t $BCNUHOSTTYPE $BCNUHOST"
		bcnu_err_send
		OK=
	 fi

# if the OK variable is still set then we're OK
if [ $OK ]
	then
		BCNUMSG="$BCNU -m 'ok - your message' -e $BCNU_OK -t $BCNUHOSTTYPE $BCNUHOST"
		bcnu_send
fi
