check_wmi_plus options

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
TechnicallyTrue
Posts: 25
Joined: Mon May 13, 2019 11:57 am

check_wmi_plus options

Post 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.
User avatar
mbellerue
Posts: 1403
Joined: Fri Jul 12, 2019 11:10 am

Re: check_wmi_plus options

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: check_wmi_plus options

Post 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
Former Nagios employee
https://www.mcapra.com/
TechnicallyTrue
Posts: 25
Joined: Mon May 13, 2019 11:57 am

Re: check_wmi_plus options

Post 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.
Locked