NSClient++

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: NSClient++

Post by tgriep »

In one of your earlier posts, you said that you were getting the following error
NSClient - ERROR: Invalid password.
Where are you seeing that error and can you provide a screen capture of the error?

Have you created and service check commands on the Nagios server to check that windows host?
If so, you would edit those configs and change the password there.
Be sure to check out our Knowledgebase for helpful articles and solutions!
donnyforbes
Posts: 357
Joined: Tue Jun 13, 2017 2:17 pm

Re: NSClient++

Post by donnyforbes »

Here is the output of /usr/local/nagios/etc/objects/windows.cfg

Code: Select all

[code]
############################################
# WINDOWS.CFG - SAMPLE CONFIG FILE FOR MONITORING A WINDOWS MACHINE
#
#
# NOTES: This config file assumes that you are using the sample configuration
#        files that get installed with the Nagios quickstart guide.
#
###############################################################################


###############################################################################
###############################################################################
#
# HOST DEFINITIONS
#
###############################################################################
###############################################################################

# Define a host for the Windows machine we'll be monitoring
# Change the host_name, alias, and address to fit your situation

define host{
        use             windows-server  ; Inherit default values from a template
        host_name       ori     ; The name we're giving to this host
        alias           My Windows Server       ; A longer name associated with the host
        address         192.168.1.20    ; IP address of the host
        }

define host{
        use             windows-server  ; Inherit default values from a template
        host_name       tollan     ; The name we're giving to this host
        alias           My Windows Server       ; A longer name associated with the host
        address         192.168.1.60    ; IP address of the host
        }

define host{
        use             windows-server  ; Inherit default values from a template
        host_name       drazi     ; The name we're giving to this host
        alias           My Windows Server       ; A longer name associated with the host
        address         192.168.1.23    ; IP address of the host
        }

define host{
        use             windows-server  ; Inherit default values from a template
        host_name       drakh     ; The name we're giving to this host
        alias           My Windows Server       ; A longer name associated with the host
        address         192.168.1.22    ; IP address of the host
        }

define host{
        use             windows-server  ; Inherit default values from a template
        host_name       netmon     ; The name we're giving to this host
        alias           My Windows Server       ; A longer name associated with the host
        address         192.168.1.49    ; IP address of the host
        }
"windows.cfg" 1204L, 39608C
[/code]

Also here is the out put from the /usr/local/nagios/etc/objects/commands.cfg

Code: Select all

###############################################################################
# COMMANDS.CFG - SAMPLE COMMAND DEFINITIONS FOR NAGIOS 4.3.2
#
#
# NOTES: This config file provides you with some example command definitions
#        that you can reference in host, service, and contact definitions.
#
#        You don't need to keep commands in a separate file from your other
#        object definitions.  This has been done just to make things easier to
#        understand.
#
###############################################################################

#check_nrpe

define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}

#host and service definitions

define host{
name linux-box ; Name of this template
use generic-host ; Inherit default values
check_period 24x7
check_interval 5
retry_interval 1
max_check_attempts 10
check_command check-host-alive
notification_period 24x7
notification_interval 30
notification_options d,r
contact_groups admins
register 0 ; DONT REGISTER THIS - ITS A TEMPLATE
}

#remote Linux/Unix hosts

define host{
use linux-box ; Inherit default values from a template
host_name huey  ; The name or IP or remote server
alias RHEL 7.3 ; A longer name for the server
address 192.168.1.186 ; IP address of the nagios server
}

define host{
use linux-box ; Inherit default values from a template
host_name duey  ; The name or IP or remote server
alias RHEL 7.3 ; A longer name for the server
address 192.168.1.186 ; IP address of the nagios server
"commands.cfg" 525L, 13565C
see attached file
Attachments
Capture.PNG
Capture.PNG
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: NSClient++

Post by tgriep »

The windows.cfg file only has the host checks and not the service checks.
That is not the file you will have to edit, but it should be in the /usr/local/nagios/etc/objects/ folder.
One way to find the correct file is to grep for one of the service descriptions that are having the error. Use this example below.

Code: Select all

grep -R "CPU Load" /usr/local/nagios/etc/
The output of the grep should show you the file you will have update the NSClient password.

One thing you should do is keep track of the files you are editing so if you have to change something, you know what was done, and when it was done.
Be sure to check out our Knowledgebase for helpful articles and solutions!
donnyforbes
Posts: 357
Joined: Tue Jun 13, 2017 2:17 pm

Re: NSClient++

Post by donnyforbes »

Here the result of the command you

Code: Select all

[root@nag objects]# grep -R "CPU Load" /usr/local/nagios/etc/
/usr/local/nagios/etc/objects/commands.cfg:#This service will monitor the CPU Load
/usr/local/nagios/etc/objects/commands.cfg:service_description CPU Load
/usr/local/nagios/etc/objects/commands.cfg:service_description CPU Load
/usr/local/nagios/etc/objects/commands.cfg:service_description CPU Load
/usr/local/nagios/etc/objects/commands.cfg:service_description CPU Load
/usr/local/nagios/etc/objects/commands.cfg:service_description CPU Load
/usr/local/nagios/etc/objects/commands.cfg:service_description CPU Load
/usr/local/nagios/etc/objects/commands.cfg:service_description CPU Load
/usr/local/nagios/etc/objects/windows.cfg:      service_description     CPU Load
/usr/local/nagios/etc/objects/windows.cfg:        service_description     CPU Load
/usr/local/nagios/etc/objects/windows.cfg:        service_description     CPU Load
/usr/local/nagios/etc/objects/windows.cfg:        service_description     CPU Load
/usr/local/nagios/etc/objects/windows.cfg:        service_description     CPU Load
/usr/local/nagios/etc/objects/windows.cfg:        service_description     CPU Load
/usr/local/nagios/etc/objects/windows.cfg:        service_description     CPU Load
/usr/local/nagios/etc/objects/windows.cfg:        service_description     CPU Load
/usr/local/nagios/etc/objects/windows.cfg:        service_description     CPU Load
/usr/local/nagios/etc/objects/windows.cfg:        service_description     CPU Load
/usr/local/nagios/etc/objects/windows.cfg:        service_description     CPU Load
/usr/local/nagios/etc/objects/windows.cfg:        service_description     CPU Load
/usr/local/nagios/etc/objects/windows.cfg:        service_description     CPU Load
/usr/local/nagios/etc/objects/windows.cfg:        service_description     CPU Load
/usr/local/nagios/etc/objects/windows.cfg:        service_description     CPU Load
/usr/local/nagios/etc/objects/windows.cfg:        service_description     CPU Load
/usr/local/nagios/etc/objects/windows.cfg:        service_description     CPU Load
/usr/local/nagios/etc/objects/windows.cfg:        service_description     CPU Load
/usr/local/nagios/etc/objects/windows.cfg:        service_description     CPU Load
/usr/local/nagios/etc/objects/windows.cfg:        service_description     CPU Load
[root@nag objects]#
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: NSClient++

Post by tgriep »

Open those files, find the password and change it to the same password that you set in the nsclient.ini file.
Be sure to check out our Knowledgebase for helpful articles and solutions!
donnyforbes
Posts: 357
Joined: Tue Jun 13, 2017 2:17 pm

Re: NSClient++

Post by donnyforbes »

I checked both of these files.
/usr/local/nagios/etc/objects/commands.cfg
/usr/local/nagios/etc/objects/windows.cfg

I don't see anywhere in these files for NSClient password. Am I missing something here?
donnyforbes
Posts: 357
Joined: Tue Jun 13, 2017 2:17 pm

Re: NSClient++

Post by donnyforbes »

Do I need to add something to both those files? I checked both locations for those files and did not see anything to do with password in them.
This is really strange...
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: NSClient++

Post by tgriep »

Take a look at this link.
https://assets.nagios.com/downloads/nag ... ndows.html
Especially the section called "Password Protection". It explains where to put the password in the nagios config files that is used in the nsclient.ini file.
Be sure to check out our Knowledgebase for helpful articles and solutions!
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: NSClient++

Post by dwhitfield »

You need to give us the full config. It looks like you are just giving us what is showing on the screen at a particular time.

The following should aid you in your search:

Code: Select all

grep -n check_nt /usr/local/nagios/etc/objects/commands.cfg
grep -n check_nt /usr/local/nagios/etc/objects/windows.cfg
donnyforbes
Posts: 357
Joined: Tue Jun 13, 2017 2:17 pm

Re: NSClient++

Post by donnyforbes »

found it. See below.

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

That is the old password I will add the new one there then restart the nagios server. I will let you know. I remember doing this before just couldn't remember where it was done at.

Thanks
Locked