Page 2 of 2

Re: check_wmi_plus checkdrivesize buggy

Posted: Wed Apr 22, 2015 10:18 am
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:'

Re: check_wmi_plus checkdrivesize buggy

Posted: Wed Apr 22, 2015 10:41 am
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.

Re: check_wmi_plus checkdrivesize buggy

Posted: Wed Apr 22, 2015 10:53 am
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?

Re: check_wmi_plus checkdrivesize buggy

Posted: Wed Apr 22, 2015 11:49 am
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

Re: check_wmi_plus checkdrivesize buggy

Posted: Wed Apr 22, 2015 3:55 pm
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.

Re: check_wmi_plus checkdrivesize buggy

Posted: Thu Apr 23, 2015 1:50 am
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

Re: check_wmi_plus checkdrivesize buggy

Posted: Thu Apr 23, 2015 4:25 am
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