#!/usr/bin/perl
$CheckNTPath='/usr/lib/nagios/plugins';

$AggregateDeliveryQueueLengthAllQueues  = `$CheckNTPath/check_nt -H $ARGV[0] -p 12489 -v COUNTER -l "\\MSExchangeTransport Queues(_total)\\Aggregate Delivery Queue Length (All Queues)"`;
chomp $AggregateDeliveryQueueLengthAllQueues;
$MessagesSubmittedPerSecond      = `$CheckNTPath/check_nt -H $ARGV[0] -p 12489 -v COUNTER -l "\\MSExchangeTransport Queues(_total)\\Messages Submitted Per Second"`;
chomp $MessagesSubmittedPerSecond;
$MessagesCompletedDeliveryPerSec      = `$CheckNTPath/check_nt -H $ARGV[0] -p 12489 -v COUNTER -l "\\MSExchangeTransport Queues(_total)\\Messages Completed Delivery Per Second"`;
chomp $MessagesCompletedDeliveryPerSec;
$Averagebytesmessage     = `$CheckNTPath/check_nt -H $ARGV[0] -p 12489 -v COUNTER -l "\\MSExchangeTransport SmtpReceive(_total)\\Average bytes/message"`;
chomp $Averagebytesmessage;
$MessagesReceivedsec         = `$CheckNTPath/check_nt -H $ARGV[0] -p 12489 -v COUNTER -l "\\MSExchangeTransport SmtpReceive(_total)\\Messages Received/sec"`;
chomp $MessagesReceivedsec;
$MessagesSentsec         = `$CheckNTPath/check_nt -H $ARGV[0] -p 12489 -v COUNTER -l "\\MSExchangeTransport SmtpSend(_total)\\Messages Sent/sec"`;
chomp $MessagesSentsec;


print "AggregateDeliveryQueueLengthAllQueues:"    	  . $AggregateDeliveryQueueLengthAllQueues .
     " MessagesSubmittedPerSecond:"   				  . $MessagesSubmittedPerSecond .
     " MessagesCompletedDeliveryPerSec:"   		      . $MessagesCompletedDeliveryPerSec .
     " Averagebytesmessage:"  	     				  . $Averagebytesmessage .
     " MessagesReceivedsec:"   				          . $MessagesReceivedsec .
     " MessagesSentsec:"				   		      . $MessagesSentsec .
     "\n";	 
	 
