Page 1 of 1

check_wmi_plus options

Posted: Fri Dec 13, 2019 1:13 pm
by TechnicallyTrue
Hello,
I am in the process of implementing the check_wmi_plus plugin for agentless active checking, and I was wondering if anyone here could help me with a couple of things.
Having read through the documentation at https://github.com/speartail/checkwmipl ... README.txt, there are two things I'm unsure of how to do that I'd like to be able to:
1) Boolean "and" for the warning/critical criteria. They give an example of how to use an inclusive "or" in lines 231 to 241 of the README file, but I'm not sure if they have a way to do this.
2) Pass arguments to the actual WMI check getting executed. I was wondering if it's possible (probably not, but worth the ask) to pass arguments like -filter "DriveType=3" to the wmi commands being run by the check.
Just wondering if anyone's had experience with these. If these aren't possible without extensive modification, I might just make my own checks using WMIC.
Thank you very much.

Re: check_wmi_plus options

Posted: Fri Dec 13, 2019 5:05 pm
by mbellerue
For #1, I think the only way to do boolean and would be to essentially make 2 service checks in 1. Basically by writing a little wrapper script that runs the check twice, once for each metric, and then sorts out the results for a single return to Nagios. That would be all good and well, except...

For #2 I don't think that plugin allows you to set a filter in the WMI query. It looks like it only has a filter for the output of the query.

So with that, you might have to make your own check. But hey, if you make a more robust WMI check, you could post it to the Nagios Exchange, and help out the next person who comes looking for such functionality.

Re: check_wmi_plus options

Posted: Mon Dec 16, 2019 9:42 am
by mcapra
You can define modules (custom queries) and pass args into them, yeah:
https://edcint.co.nz/checkwmiplus/ini-f ... mentation/

It's not super well documented, though. They're basically just templated WQL queries and should allow you to do all the above.

I wrote this thing a while back if Python is more accessible in terms of understanding WMI things:
https://github.com/mcapra/nagios-check_ ... eck_wmi.py

Re: check_wmi_plus options

Posted: Mon Dec 16, 2019 12:31 pm
by TechnicallyTrue
mbellerue wrote:So with that, you might have to make your own check. But hey, if you make a more robust WMI check, you could post it to the Nagios Exchange, and help out the next person who comes looking for such functionality.
I think I might do exactly that, even if @mcapra's suggestion works out. All for paying it forward (and I've asked enough questions on this forum that I think I owe it to the community at this point).
Thank you very much.