#!/usr/bin/perl
$CheckNTPath='/usr/lib/nagios/plugins';

$LDAPReadTime  = `$CheckNTPath/check_nt -H $ARGV[0] -p 12489 -v COUNTER -l "\\MSExchange ADAccess Domain Controllers(*)\\LDAP Read Time"`;
chomp $LDAPReadTime;
$LDAPSearchTime      = `$CheckNTPath/check_nt -H $ARGV[0] -p 12489 -v COUNTER -l "\\MSExchange ADAccess Domain Controllers(*)\\LDAP Search Time"`;
chomp $LDAPSearchTime;
$LDAPSearchestimedoutperminute      = `$CheckNTPath/check_nt -H $ARGV[0] -p 12489 -v COUNTER -l "\\MSExchange ADAccess Domain Controllers(*)\\LDAP Searches timed out per minute"`;
chomp $LDAPSearchestimedoutperminute;
$LongrunningLDAPoperationsMin     = `$CheckNTPath/check_nt -H $ARGV[0] -p 12489 -v COUNTER -l "\\MSExchange ADAccess Domain Controllers(*)\\Long running LDAP operations/Min"`;
chomp $LongrunningLDAPoperationsMin;
$LDAPSearchesSec         = `$CheckNTPath/check_nt -H $ARGV[0] -p 12489 -v COUNTER -l "\\MSExchange ADAccess Caches(*)\\LDAP Searches/Sec"`;
chomp $LDAPSearchesSec;


print "LDAPReadTime:"    					  . $LDAPReadTime .
     " LDAPSearchTime:"   					  . $LDAPSearchTime .
     " LDAPSearchestimedoutperminute:"        . $LDAPSearchestimedoutperminute .
     " LongrunningLDAPoperationsMin:"  	      . $LongrunningLDAPoperationsMin .
     " LDAPSearchesSec:"   				      . $LDAPSearchesSec .
     "\n";
