Page 2 of 2

Re: WMI_Authorization_File

Posted: Fri Oct 25, 2019 1:16 pm
by lmiltchev
Have you tried changing your password to something simple (no special characters)?

Re: WMI_Authorization_File

Posted: Mon Oct 28, 2019 2:58 pm
by mamir
Yes i have made this password below, still the same error message. Please, help

WELcome12345678

Re: WMI_Authorization_File

Posted: Mon Oct 28, 2019 4:52 pm
by lmiltchev
Can you run the following commands from the command line, and show the output?

Code: Select all

/usr/local/nagios/libexec/check_wmi_plus.pl -H <ip address> -u 'test.account' -p 'WELcome12345678' -m checkcpu -w '80' -c '90'
/usr/local/nagios/libexec/check_wmi_plus.pl -H <ip address> -A /usr/local/nagios/etc/authorization.txt -m checkcpu -w '80' -c '90'

Re: WMI_Authorization_File

Posted: Tue Oct 29, 2019 10:36 am
by mamir
Attachment.

Re: WMI_Authorization_File

Posted: Tue Oct 29, 2019 10:52 am
by mamir
Please, keep in mind, when I try it the normal way, putting in username & password. It works perfectly fine, so there is no issues with the permission from the server side neither the credentials issue. It just this file method of authentication not working.

Re: WMI_Authorization_File

Posted: Tue Oct 29, 2019 11:23 am
by lmiltchev
I am not sure what you mean by "normal" way... It's totally normal to test your checks from the command line, and they should work... If they don't, this means that you are either using a wrong credentials or you don't have sufficient permissions.

Example of a working check from the command line (with username/password and an auth file):

Code: Select all

[root@main-nagios-xi libexec]# /usr/local/nagios/libexec/check_wmi_plus.pl -H x.x.x.x -u 'my username' -p 'my password' -m checkcpu -w '80' -c '90'
OK (Sample Period 13 sec) - Average CPU Utilisation 9.75%|'Avg CPU Utilisation'=9.75%;80;90;

[root@main-nagios-xi libexec]# /usr/local/nagios/libexec/check_wmi_plus.pl -H x.x.x.x -A /usr/local/nagios/etc/authorization.txt -m checkcpu -w '80' -c '90'
OK (Sample Period 3 sec) - Average CPU Utilisation 0.37%|'Avg CPU Utilisation'=0.37%;80;90;

Re: WMI_Authorization_File

Posted: Tue Oct 29, 2019 1:58 pm
by mamir
The credentials are correct, by normal way I meant is to use the Auth Info method instead of the file. The same exact credentials works fine when using the Auth Info method, but same exact credentials don't work when using the file method. Do you think the file created not correctly or format is not correct? I created file by simply right clicking in the directory and create a text file. Please help.

Re: WMI_Authorization_File

Posted: Tue Oct 29, 2019 2:29 pm
by lmiltchev
It is possible that the format (EOL) of the auth file is set to "dos", not "unix", which can cause issues. Open the auth file in "vi" text editor:

Code: Select all

vi /usr/local/nagios/etc/authorization.txt
type:

Code: Select all

:set ff?
and hit "Enter". You should see:

Code: Select all

fileformat=unix
If you see "dos", then you would need to fix it by typing:

Code: Select all

:set ff=unix
and hitting "Enter", then save and exit by typing:

Code: Select all

:wq
and hitting "Enter".

You could also set line endings to "unix" via Notepad++ (if you have a GUI).

Edit > EOL Conversion > Unix (LF)

Note: Having said that, I would like to mention this again - if you check is NOT working when using " -u 'my username' -p 'my password' " this means it is NOT going to work with the auth file either... if you are using the same credentials that is. This check must work from the CLI:

Code: Select all

/usr/local/nagios/libexec/check_wmi_plus.pl -H <ip address> -u 'test.account' -p 'WELcome12345678' -m checkcpu -w '80' -c '90'
It was not working for you. Please double check your credentials. If your user is on a domain, you may need to use:

Code: Select all

/usr/local/nagios/libexec/check_wmi_plus.pl -H <ip address> -u 'domain\test.account' -p 'WELcome12345678' -m checkcpu -w '80' -c '90'

Re: WMI_Authorization_File

Posted: Tue Oct 29, 2019 3:00 pm
by mamir
Please, see the attachment.

I followed the instruction, I saw the format was fileformat=unix. I'm thinking since the file was created manually by simply right click create a text file is it right method? also at the end I have extension as .txt is it correct as well? What permissions should be setup on the authorization file itself?

Re: WMI_Authorization_File

Posted: Tue Oct 29, 2019 3:23 pm
by lmiltchev
Here's the permissions of the auth file on my test Nagios XI server:

Code: Select all

[root@main-nagios-xi libexec]# ll /usr/local/nagios/etc/authorization.txt
-rw-rw-r-- 1 apache nagios 37 Oct 28 16:12 /usr/local/nagios/etc/authorization.txt
I don't think this is your issue though... In the screenshot you posted, you are not even using the auth file, and your check is still failing. Please, review the KB article below on WMI troubleshooting:

https://support.nagios.com/kb/article/n ... g-579.html

This is a good starting point for dealing with WMI issues.