I have some windows domain information that I want to collect state information from. I have identified the WMI that I want and figured out how to make it work with nc_net, but I am not sure how to get Nagios to interprest the results of my query.
/usr/local/nagios/libexec/check_nc_nt -H $DCIP$ -v WMICHECK -t 40 -l "MicrosoftActiveDirectory&select FlatName,TrustStatus from Microsoft_DomainTrustStatus where FlatName='DOMAINA'" -w 1
Nagios complains with (No output returned from plugin), but I assume that because the output is not per the Nagios plugin API standard. I am not sure how to get it that way either.
If you can offer some advice that would be great.
Thanks
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I see. So WMICAT and WMICOUNTER do not support where statement, correct? Because of the nature of my environment Microsoft_DomainTrustStatus returns multiple instances. I created a shell wrapper for WMICHECK and it gets me the info I need. Its kind of hacky, but I am happy with the result. Thanks Tony!
case "$dtstatus" in
*)
if test $dtstatus -eq 0; then
echo "OK - $domain:$statusmessage"
exit 0
elif test $dtstatus -ne 0 ; then
echo "CRITICAL - $domain:$statusmessage"
exit 2
fi
if test $dtstatus -z; then
echo "CRITICAL - Invalid Data"
exit 2
else
echo ok
exit 0
fi
;;
esac
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Actually I thought they took the same syntex as WMICHECK thus I thought the where clause was accepted.
The WMICOUNTER should evaluate to a collection of items that are Numbers then the numbers are compared to the -w and -c values (if they were given) and the MAx/MIn value is then reported based on exact conditions of the command.
But if the script works thats good as well, thanks for posting it.
Tony
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have some windows domain information that I want to collect state information from. I have identified the WMI that I want and figured out how to make it work with nc_net, but I am not sure how to get Nagios to interprest the results of my query.
/usr/local/nagios/libexec/check_nc_nt -H $DCIP$ -v WMICHECK -t 40 -l "MicrosoftActiveDirectory&select FlatName,TrustStatus from Microsoft_DomainTrustStatus where FlatName='DOMAINA'" -w 1
instance of Microsoft_DomainTrustStatus { FlatName = "DOMAINA"; TrustStatus = 0; };
Nagios complains with (No output returned from plugin), but I assume that because the output is not per the Nagios plugin API standard. I am not sure how to get it that way either.
If you can offer some advice that would be great.
Thanks
Correct WMICHECK is for viewing WMI remotly
this is due to many WMI Queries may be an Undetermined Size and have an undetermined amount of instances.
while WMICAT and WMICOUNTER are for reporting to nagios
use check_nc_net help to get the syntex
check_nc_net --help
check_nc_net --help=WMICAT
check_nc_net --help=MWICOUNTER
let us know if this resolves your issues
TOny
I see. So WMICAT and WMICOUNTER do not support where statement, correct? Because of the nature of my environment Microsoft_DomainTrustStatus returns multiple instances. I created a shell wrapper for WMICHECK and it gets me the info I need. Its kind of hacky, but I am happy with the result. Thanks Tony!
cat check_dtstat
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
PROGNAME=`basename $0`
PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'`
REVISION=`echo '$Revision: 0.2 $' | sed -e 's/[^0-9.]//g'`
. $PROGPATH/utils.sh
dc=$1
domain=$2
dtstatus=`/usr/local/nagios/libexec/check_nc_nt -H $dc -v WMICHECK -t 40 -l "MicrosoftActiveDirectory&select FlatName,TrustStatus from Microsoft_DomainTrustStatus where FlatName='$domain'" -w 1|grep "TrustStatus ="|awk -F ";" '{print $1}'|awk '{print $3}'`
statusmessage=`/usr/local/nagios/libexec/check_nc_nt -H $dc -v WMICHECK -t 40 -l "MicrosoftActiveDirectory&select FlatName,TrustStatusString from Microsoft_DomainTrustStatus where FlatName='$domain'" -w 1|grep "TrustStatusString ="|awk -F \" '{print $2}'`
case "$dtstatus" in
*)
if test $dtstatus -eq 0; then
echo "OK - $domain:$statusmessage"
exit 0
elif test $dtstatus -ne 0 ; then
echo "CRITICAL - $domain:$statusmessage"
exit 2
fi
if test $dtstatus -z; then
echo "CRITICAL - Invalid Data"
exit 2
else
echo ok
exit 0
fi
;;
esac
Actually I thought they took the same syntex as WMICHECK thus I thought the where clause was accepted.
The WMICOUNTER should evaluate to a collection of items that are Numbers then the numbers are compared to the -w and -c values (if they were given) and the MAx/MIn value is then reported based on exact conditions of the command.
But if the script works thats good as well, thanks for posting it.
Tony