NSClient - ERROR: Invalid password


Hi, just found this site - hope I can get some help.
I’m kind of new to nagios and have got up an running. I recently installed NSclient++ on my test Win2008 Server R2. I’ve got the service up and running - as far as I can tell have the NSC.ini file configured.

port=12489 – Uncommented
password=secret-password – Uncommented
password=####### – Password matched on my commands.cfg on the nagios server

But when I run a “check_nt” command, I get an error about password being invalid.

/usr/local/nagios/libexec/check_nt -H 'hostname' -p 12489 -v CPULOAD -w 80 -c 90 -l 5,80,90,10,80,90

Here is my commnads.cfg

# 'check_nt' command definition
define command{
        command_name    check_nt
        command_line    $USER1$/check_nt -H $HOSTADDRESS$ -p 12489 -s M0n1tor -v $ARG1$ $ARG2$

Is there another file that I need to change/configure or something that I’m missing?



I’ve also tried using NRPE to check.

/usr/local/nagios/libexec/check_nrpe -H 'host ip' -c CheckCPU -a warn=80 crit=90 time=20m time=10s time=4

CHECK_NRPE: Received 0 bytes from daemon.  Check the remote server logs for error messages

From nsclient.log

2011-05-05 10:43:51: error:modules\NRPEListener\NRPEListener.cpp:393: Request contained arguments (not currently allowed, check the allow_arguments option).
2011-05-05 10:43:51: error:modules\NRPEListener\NRPEListener.cpp:365: NRPEException: Request contained arguments (not currently allowed, check the allow_arguments option).

Where would I configure this on the INI file to set to ‘allow’?


have you tried running check_nt from command line as user nagios? can you get any info returned in this way?


Yes, I’ve run the command as my self and as nagios user - and get the same result.

[adminusr@nagiossrv objects]$ su nagios
[nagios@nagiossrv objects]$ whoami
[nagios@nagiossrv objects]$ /usr/local/nagios/libexec/check_nt -H 'hostname' -p 12489 -v CPULOAD -w 80 -c 90 -l 5,80,90,10,80,90
NSClient - ERROR: Invalid password.


I don’t have a windows box available to test it… do you have a password set in NSC.ini ? (can’t find where to declare the pwd in check_nt… )



Yes, I’ve put the password in the nsc.ini file. Here’s the settings.

;  This is the same as the password option but here you can store the password in an obfuscated manner.
;  *NOTICE* obfuscation is *NOT* the same as encryption, someone with access to this file can still figure out the 
;  password. Its just a bit harder to do it at first glance.
;  This is the password (-s) that is required to access NSClient remotely. If you leave this blank everyone will be able to access the daemon remotly.
;  This is a comma-delimited list of IP address of hosts that are allowed to talk to the all daemons.
;  If leave this blank anyone can access the deamon remotly (NSClient still requires a valid password).
;  The syntax is host or ip/mask so will allow anyone on that subnet access
;  Use the INI file as opposed to the registry if this is 0 and the use_reg in the registry is set to 1 
;  the registry will be used instead.
;  This is the "new" way for using the system tray based on an IPC framework on top shared memmory channels and events.
;  It is brand new and (probably has bugs) so dont enable this unless for testing!
;  If set to 1 shared channels will be created and system tray icons created and such and such...

A matching ‘nagpasswd’ in on the commands.cfg

# 'check_nt' command definition
define command{
        command_name    check_nt
        command_line    $USER1$/check_nt -H $HOSTADDRESS$ -p 12489 -s nagpasswd -v $ARG1$ $ARG2$


Did you try with -s secret-password ?


Yup…/usr/local/nagios/libexec/check_nt -H 'hostname' -s nagpasswd -p 12489 -v CPULOAD -w 80 -c 90 -l 5,80,90,10,80,9 NSClient - ERROR: Invalid password.


I meant, -s secret-password rather than nagpasswd.


Holly cow! :shock: The -s secret-password worked! Thank you.

[nagios@nagios3 objects]$  /usr/local/nagios/libexec/check_nt -H hostname-p 12489 -s secret-password -v MEMUSE -w 80 -c 90
Memory usage: total:8189.38 Mb - used: 613.83 Mb (7%) - free: 7575.55 Mb (93%) | 'Memory usage'=613.83Mb;6551.50;7370.44;0.00;8189.38
[nagios@nagios3 objects]$

During the install of NSClient++, it asked for a password to use. So, I typed in ‘nagpasswd’. I assumed that it was using that password and I added it on the commands.cfg.

Here’s a question, Why can’t I change the password from secret-password to nagpasswd? I mean I did on the nsc.ini file. I then re-started the nsclient++ service, manually ran the command and got the invalid password. But, tried it with the secret-password and it still took. Why?

[nagios@nagios3 objects]$  /usr/local/nagios/libexec/check_nt -H hostname -p 12489 -s nagpasswd -v MEMUSE -w 80 -c 90
NSClient - ERROR: Invalid password.

[nagios@nagios3 objects]$  /usr/local/nagios/libexec/check_nt -H hostname -p 12489 -s secret-password -v MEMUSE -w 80 -c 90
Memory usage: total:8189.38 Mb - used: 598.66 Mb (7%) - free: 7590.72 Mb (93%) | 'Memory usage'=598.66Mb;6551.50;7370.44;0.00;8189.38
[nagios@nagios3 objects]$

Is there other place where the secret-password reside besides nsc.ini?


GOT IT! Figured it out late yesterday. Thanks for all the help.