Page 1 of 1

Please tell me how to properly escape: '123password^%$'

Posted: Wed Feb 12, 2014 5:49 pm
by mattx3210
Requested info:

1. What version of Nagios XI are you using? 2012R2.8c
2. Linux Distribution and version? CentOS release 6.5 (Final)
3. 32 or 64bit? 64bit
4. VMware Image or Manual Install of XI? Manual Install of XI
5. Are there special configurations on your system? No

Short version:

Please tell me how to properly escape this password: 123password^%$

Full detail:

I can run the following command from the command line no problem...

Code: Select all

./check_wmi_plus.pl -H 10.0.0.10 -u 'NACORP/svc-nagios' -p '123password^%$' -m checkservice -a 'W3SVC'
OK - Found 1 Services(s), 1 OK and 0 with problems (0 excluded). 'World Wide Web Publishing Service' (W3SVC) is Running.|'Total Service Count'=1; 'Service Count OK State'=1; 'Service Count Problem State'=0; 'Excluded Service Count'=0;
However, in the CCM > Service Management > Common Settings tab of the check_xi_service_wmiplus check command...

Code: Select all

$USER1$/check_wmi_plus.pl -H $HOSTADDRESS$ -u $ARG1$ -p $ARG2$ -m $ARG3$ $ARG4$
$ARG1$ = 'NACORP/svc-nagios'
$ARG2$ = '123password^%$'
$ARG3$ = checkservice
$ARG4$ = -a 'W3SVC'
If click the Test Check Command button, I get...

Code: Select all

/usr/local/nagios/libexec/check_wmi_plus.pl -H 10.0.0.10 -u 'NACORP/svc-nagios' -p '123password\^%\$' -m checkservice -a 'W3SVC'
OUTPUT: UNKNOWN - The WMI query had problems. You might have your username/password wrong or the user's access level is too low. Wmic error text on the next line.
[librpc/rpc/dcerpc_util.c:1290:dcerpc_pipe_auth_recv()] Failed to bind to uuid 4d9f4ab8-7d1c-11cf-861e-0020af6e7c57 - NT_STATUS_NET_WRITE_FAULT
[librpc/rpc/dcerpc_connect.c:790:dcerpc_pipe_connect_b_recv()] failed NT status (c0000022) in dcerpc_pipe_connect_b_recv
[wmi/wmic.c:196:main()] ERROR: Login to remote object.
NTSTATUS: NT_STATUS_ACCESS_DENIED - Access denied
It looks like the "Test Commands" button attempts to insert '\' escape back-slashes before the '^' and '$' characters.
I read in another post that this might only be a limitation of the "Test Commands" button in CCM (scottwilkerson).
However, if I apply the configuration and check the Service Status Detail...

Code: Select all

UNKNOWN - The WMI query had problems. You might have your username/password wrong or the user's access level is too low. Wmic error text on the next line.

[librpc/rpc/dcerpc_util.c:1290:dcerpc_pipe_auth_recv()] Failed to bind to uuid 4d9f4ab8-7d1c-11cf-861e-0020af6e7c57 - NT_STATUS_NET_WRITE_FAULT
[librpc/rpc/dcerpc_connect.c:790:dcerpc_pipe_connect_b_recv()] failed NT status (c0000022) in dcerpc_pipe_connect_b_recv
[wmi/wmic.c:196:main()] ERROR: Login to remote object.
NTSTATUS: NT_STATUS_ACCESS_DENIED - Access denied
The Configure Service > Monitoring tab shows the command as...

Code: Select all

check_xi_service_wmiplus!'NACORP/svc-nagios'!'123password^%$'!checkservice!-a 'W3SVC'!!!!
Unfortunately I do not have the option of changing the password.

Please tell me how to properly escape this password: 123password^%$

Re: Please tell me how to properly escape: '123password^%$'

Posted: Wed Feb 12, 2014 5:55 pm
by abrist
You can usually escape '$' with another '$': ie. '$$'. This does not always work depending on the plugin and the shell. You can also use /usr/local/nagios/etc/resource.cfg
Add a line to the resource.cfg file, for example, we will use $USER9$:

Code: Select all

$USER9$=your$$crazy!!!password
Save out and then change your password in the check to $USER9$. Save the check and restart nagios/apply configuration.
One note: $USERn$ macros do not work with the "test check command" feature of the web ui, so you will have to configure the check and allow nagios to run the check on its own (or just schedule an immediate check)..

Re: Please tell me how to properly escape: '123password^%$'

Posted: Wed Feb 12, 2014 9:44 pm
by mattx3210
Thank you, abrist... the resource.cfg trick worked like a charm. Best regards

Re: Please tell me how to properly escape: '123password^%$'

Posted: Thu Feb 13, 2014 10:20 am
by tmcdonald
Nice quick fix. I'll be locking this up now, but feel free to open a new thread if need be.