#!/bin/bash

#########################################################################################################
#													#
#	Author		:	Gourav Joshi								#
#	Date		:	16 June 2011								#
#	Email		:	gouravjoshi@gmail.com							#	
#	Objective	:	NRPE plugin to send output to Nagios server.				#
#	Usage		:	Put this file into libexec directory of Nagios installation		#
#				and configure in nrpe config file e.g. 					#
#				command[check_postfix]=/usr/local/nagios/libexec/check_queue /tmp/que	#
#				where /tmp/que is the output file name of quemon script.		#
#													#
#########################################################################################################

if [ $# == 1 ]

then 

FILE=$1
CAT='/bin/cat'
HEAD='/usr/bin/head'


$CAT $FILE | $HEAD -n 1

exitstatus=`$CAT $FILE | grep exitstatus | cut -d "=" -f 2`

else

echo "Please provide file name to check"

fi

exit $exitstatus
