Page 1 of 1

XI and check_wmi_plus - check if Exchange DB get unmounted

Posted: Thu Mar 12, 2015 3:07 pm
by brdr
Hi,

We have XI 2014R2.6.

I've tried many ways to get a check_wmi_plus.pl command to return CRITICAL when a Exchange DB instance becomes unmounted but still can't get it to return critical. Here is the command:

./check_wmi_plus59.pl -H hostA -u xxxx/xxxxx -p xxxxx -m checkexchange -s DBInstances -a 'Information Store/xxx-MBX01'

I've tried using --nodatastring, --nodatamode, --excludedata, -c _Itemcount=0. I've used the -d (debug mode) to see if I'm missing something... :x

I know this isn't a Nagios issue but any help would be apprecited to get a status of CRITICAL back if the database get unmounted.

Thank you!

Re: XI and check_wmi_plus - check if Exchange DB get unmount

Posted: Thu Mar 12, 2015 3:25 pm
by lmiltchev
What is the actual output of this check?

Code: Select all

./check_wmi_plus59.pl -H hostA -u xxxx/xxxxx -p xxxxx -m checkexchange -s DBInstances -a 'Information Store/xxx-MBX01'
What is the exit code?

Code: Select all

echo $?

Re: XI and check_wmi_plus - check if Exchange DB get unmount

Posted: Thu Mar 12, 2015 3:40 pm
by brdr
Ah. i don't know why i didn't check that....

Successful return code (if database is mounted is 0).

If i use the same command and add "-c _ItemCount=0" at the end it returns 2.
./check_wmi_plus59.pl -H hostA -u xxxx/xxxxx -p xxxxx -m checkexchange -s DBInstances -a 'Information Store/xxx-MBX0111' -c _ItemCount=0

command above returns string "WMI Query returned no data. The item you were looking for may NOT exist or the software that creates the WMI Class may not be running, or all data has been excluded."

# echo $?
2

How could I then get Nagios to say "Critical: Exchange Databse is unmounted"?

Thanks for helping me!!!!

Re: XI and check_wmi_plus - check if Exchange DB get unmount

Posted: Thu Mar 12, 2015 4:27 pm
by lmiltchev
The exit code is 2, so this is fine. I suppose you can modify the plugin to return the string that you want to see. Do this at your own risk. I would recommend making a backup of your original plugin before making any mods.

Open the plugin in a text editor and change the string (around line 120) from this:

Code: Select all

_nodatastring=> "WMI Query returned no data. The item you were looking for may NOT exist or the software that creates the WMI Class may not be running, or all data has been excluded.\n",
to this:

Code: Select all

_nodatastring=> "Critical: Exchange Database is unmounted"?\n",
I am not sure if this will have any negative effect on other checks. If it doesn't work as intended, revert to your backup.

Re: XI and check_wmi_plus - check if Exchange DB get unmount

Posted: Fri Mar 13, 2015 6:57 am
by brdr
Ok. What I did instead is NOT change the plugin. Rather, I used --nodatastring as ARG3 in command

-m checkexchange
-s DBInstances
-a 'Information Store/databae name goes here' --nodatastring="Critical: Exchange Database is unmounted"

since return code is 2 the check goes CRITICAL and displays the string above in status information...

All set. Thank you!
brdr