[SOLVED] check_wmi_plus checkdrivesize + commands

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: check_wmi_plus checkdrivesize buggy

Post by lmiltchev »

Your configuration is wrong. In $ARG3$ you should have:

Code: Select all

checkdrivesize
and in $ARG4$ you should have:

Code: Select all

-a 'C:' -w '_FreeGB=4:' -c '_FreeGB=3:'
The $USER13$ and $USER14$ macros won't be available from the CLI, so the following command won't work:

Code: Select all

/usr/local/nagios/libexec/check_wmi_plus.pl -H SERVER -u $USER13$ -p $USER14$ -m checkdrivesize -a 'C:' -w '_FreeGB=4:' -c '_FreeGB=3:'
However, you could probably run:

Code: Select all

USER13="username" && USER14="password5" && /usr/local/nagios/libexec/check_wmi_plus.pl -H SERVER -u $USER13 -p $USER14 -m checkdrivesize -a 'C:' -w '_FreeGB=1.6:' -c '_FreeGB=2:'
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
rseiwert
Posts: 196
Joined: Wed Jun 22, 2011 10:33 pm
Location: Somewhere between Here and Now

Re: check_wmi_plus checkdrivesize buggy

Post by rseiwert »

What I actually have is -u $USER8$ -p $USER9$ hardcoded into the check command. I try to avoid putting passwords into the service def. I think I have also put the single quotes around arguments in the past but in checking I didn't see any defined like this now. For example arg1 would be specified as '.' or '_FreeGB=:3'. The way you did it also works and might even be more readable when editing.
Grumpy Olde IT Guy
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: check_wmi_plus checkdrivesize buggy

Post by lmiltchev »

Well, I just gave you an example from the CLI, which works because we define these two variables prior to running the check...

I believe you are doing the right thing by putting the username/password in the "/usr/local/nagios/etc/resource.cfg".

http://assets.nagios.com/downloads/nagi ... Macros.pdf

This will work from the GUI just fine. If however, you would like to run the same check from the CLI (and use the macros, defined in the "resource.cfg") your check would fail, because the macros won't be available in the shell. I was just trying to answer your question. :)
Another question on this: can i use -u $USER13$ -p $USER14$ in the commandline?
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
rseiwert
Posts: 196
Joined: Wed Jun 22, 2011 10:33 pm
Location: Somewhere between Here and Now

Re: check_wmi_plus checkdrivesize buggy

Post by rseiwert »

Just want to start by saying there really is no right and wrong here. If the check runs, doesn't crash, gives you valid results in a timely fashion then that is right. I just wanted to share how I do it. Since I use PNP charts, I use a different check command for each "mode", this allows me to have custom chart templates for specific check_wmi_plus modes. Another note, the $USER8$ and $USER9$ variables are not expanded when you click the Test Check Command. I click this button then copy the command and paste to a command prompt and then edit the $USER8$ and $USER9$ for testing.
Image
Grumpy Olde IT Guy
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: check_wmi_plus checkdrivesize buggy

Post by lmiltchev »

Whatever works. :) Testing from within the CCM is not perfect - sometimes it fails, because of the escaping issues. I believe this is what is going on with macros, defined in the "resource.cfg". The CCM tries to escape the "$" and the check fails.
For this type of checks, you will be better off by clicking on the Service, and scheduling a "forced immediate check" to test it.
Be sure to check out our Knowledgebase for helpful articles and solutions!
litsupport.box
Posts: 80
Joined: Wed Apr 02, 2014 7:24 am

Re: check_wmi_plus checkdrivesize buggy

Post by litsupport.box »

:D ended up with a combination of both of your's advise's thank you!

This works for me.
Image

What doesnt work:
Next, I'm still looking at this screen since yesterday: I'm looking into this, if i've resolved it ill post my solution.
Image
Nagios XI Version : 2014R2.6
fqdn 2.6.32-431.17.1.el6.x86_64 x86_64
CentOS release 6.5 (Final)
Gnome is not installed
Proxy appears to be in use
VMware Image
Mod Gearman
litsupport.box
Posts: 80
Joined: Wed Apr 02, 2014 7:24 am

Re: check_wmi_plus checkdrivesize buggy

Post by litsupport.box »

I restarted the following and my errors disappeared:

Code: Select all


On NagiosXI server (master):
service nagios stop
service mod_gearman_worker stop
service gearmand restart
service mod_gearman_worker start
service nagios start

On workers:
service nagios stop
service mod_gearman_worker restart
service nagios start
But i also suspect that the workers needed time to sync or something, i removed all resource.cfg files from the workers and copied exactly the same content from the master server to them.

This topic can close now everything works really good now: Time to fix the following problems :D thanks again for all the support.

Image
Nagios XI Version : 2014R2.6
fqdn 2.6.32-431.17.1.el6.x86_64 x86_64
CentOS release 6.5 (Final)
Gnome is not installed
Proxy appears to be in use
VMware Image
Mod Gearman
Locked