NSclient password

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.
spiderpig
Posts: 23
Joined: Thu Jun 21, 2012 7:23 pm

NSclient password

Post by spiderpig »

Hi,

I'm using Nagios core 3.0 and am trying to set password auth on the server.
I edited the command.cfg file and insert

define command{
command_name check_nt
command_line $USER1$/check_nt -H $HOSTADDRESS$ -p 12489 -s PASSWORD -v $ARG1$ $ARG2$
}

checked the config and restarted the nagios service.

the strange part is that I haven't even set the passwords on the clients and they still can communicate with the server? any ideas what I am missing?
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: NSclient password

Post by hsmith »

If you didn't update the configuration on the NSClient end, it's not looking for a password. If you set a password in NSClient, and then try to have them communicate, I believe that will change it.
Former Nagios Employee.
me.
spiderpig
Posts: 23
Joined: Thu Jun 21, 2012 7:23 pm

Re: NSclient password

Post by spiderpig »

Hi, I set the password on the client, and even tried the wrong password. The client gets checked any way.
this seems to be a very basic stuff, but there are something missing.
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: NSclient password

Post by hsmith »

Can you post your nsclient/nsc.ini file here for review? What version of NSClient are you using?
Former Nagios Employee.
me.
spiderpig
Posts: 23
Joined: Thu Jun 21, 2012 7:23 pm

Re: NSclient password

Post by spiderpig »

I updated to the newest client, NSClient 4.4.15


---


# If you want to fill this file with all avalible options run the followding command:
# nscp settings --generate --add-defaults --load-all
# If you want to activate a module and bring in all its options use:
# nscp settings --activate-module <MODULE NAME> --add-defaults
# For details run: nscp settings --help


; Undocumented section
[/settings/default]

; PASSWORD - Password used to authenticate against server
password = the password

; ALLOWED HOSTS - A comaseparated list of allowed hosts. You can use netmasks (/ syntax) or * to create ranges.
allowed hosts = nagiosserverip

; Undocumented section
[/modules]

; CheckSystem - Various system related checks, such as CPU load, process state, service state memory usage and PDH counters.
CheckSystem = 1

; NSClientServer - A server that listens for incoming check_nt connection and processes incoming requests.
NSClientServer = 1

; CheckExternalScripts - Execute external scripts
CheckExternalScripts = 1

; CheckHelpers - Various helper function to extend other checks.
CheckHelpers = 1

; CheckEventLog - Check for errors and warnings in the event log.
CheckEventLog = 1

; CheckDisk - CheckDisk can check various file and disk related things.
CheckDisk = 1

; CheckNSCP - Use this module to check the healt and status of NSClient++ it self
CheckNSCP = 1

; NRPEServer - A server that listens for incoming NRPE connection and processes incoming requests.
NRPEServer = 1

; A list of templates for wrapped scripts.
%SCRIPT% will be replaced by the actual script an %ARGS% will be replaced by any given arguments.
[/settings/external scripts/wrappings]

; POWERSHELL WRAPPING -
ps1 = cmd /c echo scripts\\%SCRIPT% %ARGS%; exit($lastexitcode) | powershell.exe -command -

; BATCH FILE WRAPPING -
bat = scripts\\%SCRIPT% %ARGS%

; VISUAL BASIC WRAPPING -
vbs = cscript.exe //T:30 //NoLogo scripts\\lib\\wrapper.vbs %SCRIPT% %ARGS%

; A list of aliases available.
An alias is an internal command that has been predefined to provide a single command without arguments. Be careful so you don't create loops (ie check_loop=check_a, check_a=check_loop)
[/settings/external scripts/alias]

; alias_volumes_loose - Alias for alias_volumes_loose. To configure this item add a section called: /settings/external scripts/alias/alias_volumes_loose
alias_volumes_loose = check_drivesize

; alias_volumes - Alias for alias_volumes. To configure this item add a section called: /settings/external scripts/alias/alias_volumes
alias_volumes = check_drivesize

; alias_sched_all - Alias for alias_sched_all. To configure this item add a section called: /settings/external scripts/alias/alias_sched_all
alias_sched_all = check_tasksched show-all "syntax=${title}: ${exit_code}" "crit=exit_code ne 0"

; alias_service - Alias for alias_service. To configure this item add a section called: /settings/external scripts/alias/alias_service
alias_service = check_service

; alias_process_stopped - Alias for alias_process_stopped. To configure this item add a section called: /settings/external scripts/alias/alias_process_stopped
alias_process_stopped = check_process "process=$ARG1$" "crit=state != 'stopped'"

; alias_process_hung - Alias for alias_process_hung. To configure this item add a section called: /settings/external scripts/alias/alias_process_hung
alias_process_hung = check_process "filter=is_hung" "crit=count>0"

; alias_process_count - Alias for alias_process_count. To configure this item add a section called: /settings/external scripts/alias/alias_process_count
alias_process_count = check_process "process=$ARG1$" "warn=count > $ARG2$" "crit=count > $ARG3$"

; alias_process - Alias for alias_process. To configure this item add a section called: /settings/external scripts/alias/alias_process
alias_process = check_process "process=$ARG1$" "crit=state != 'started'"

; alias_mem - Alias for alias_mem. To configure this item add a section called: /settings/external scripts/alias/alias_mem
alias_mem = check_memory
alias_memory_physical = check_memory "warn=used > 85%" "crit=used > 95%" type=physical "perf-config=physical(unit:G) physical %(ignored:true)"

; alias_file_size - Alias for alias_file_size. To configure this item add a section called: /settings/external scripts/alias/alias_file_size
alias_file_size = check_files "path=$ARG1$" "crit=size > $ARG2$" "top-syntax=${list}" "detail-syntax=${filename] ${size}" max-dir-depth=10

; alias_service_ex - Alias for alias_service_ex. To configure this item add a section called: /settings/external scripts/alias/alias_service_ex
alias_service_ex = check_service "exclude=Net Driver HPZ12" "exclude=Pml Driver HPZ12" "exclude=Microsoft .NET Framework NGEN v4.0.30319_X86" "exclude=Google uppfærsla Þjónusta (gupdate)" "exclude=TPM Base Services" "exclude=Microsoft .NET Framework NGEN v4.0.30319_X64" "exclude=Software Protection" "exclude=Shell Hardware Detection"

; alias_event_log - Alias for alias_event_log. To configure this item add a section called: /settings/external scripts/alias/alias_event_log
alias_event_log = check_eventlog
alias_event_log_system = CheckEventLog file=system MaxWarn=100 MaxCrit=200 "filter=generated gt -24h AND severity NOT IN ('success', 'informational','warning')" truncate=800 unique descriptions "syntax=%severity%: %source%: %message% (%count%)"
alias_event_log_application = CheckEventLog file=application MaxWarn=100 MaxCrit=200 "filter=generated gt -24h AND severity NOT IN ('success', 'informational','warning')" truncate=800 unique descriptions "syntax=%severity%: %source%: %message% (%count%)"

; alias_disk - Alias for alias_disk. To configure this item add a section called: /settings/external scripts/alias/alias_disk
alias_disk = check_drivesize
alias_disk_all = Check_DriveSize "crit=used>95%" "warn=used>90%" drive=* "perf-config=*(unit:G) used %(ignored:true)" "filter=type='fixed' AND drive NOT LIKE '\\?\\'"
alias_disk_c = Check_DriveSize "crit=used>95%" "warn=used>90%" drive=c "perf-config=*(unit:G) used %(ignored:true)"
alias_disk_d = Check_DriveSize "crit=used>95%" "warn=used>90%" drive=d "perf-config=*(unit:G) used %(ignored:true)"
alias_disk_e = Check_DriveSize "crit=used>95%" "warn=used>90%" drive=e "perf-config=*(unit:G) used %(ignored:true)"
alias_disk_f = Check_DriveSize "crit=used>95%" "warn=used>90%" drive=f "perf-config=*(unit:G) used %(ignored:true)"
alias_disk_g = Check_DriveSize "crit=used>95%" "warn=used>90%" drive=g "perf-config=*(unit:G) used %(ignored:true)"
alias_disk_h = Check_DriveSize "crit=used>95%" "warn=used>90%" drive=h "perf-config=*(unit:G) used %(ignored:true)"
alias_disk_i = Check_DriveSize "crit=used>95%" "warn=used>90%" drive=i "perf-config=*(unit:G) used %(ignored:true)"
alias_disk_j = Check_DriveSize "crit=used>95%" "warn=used>90%" drive=j "perf-config=*(unit:G) used %(ignored:true)"
alias_disk_k = Check_DriveSize "crit=used>95%" "warn=used>90%" drive=k "perf-config=*(unit:G) used %(ignored:true)"
alias_disk_l = Check_DriveSize "crit=used>95%" "warn=used>90%" drive=l "perf-config=*(unit:G) used %(ignored:true)"
alias_disk_m = Check_DriveSize "crit=used>95%" "warn=used>90%" drive=m "perf-config=*(unit:G) used %(ignored:true)"
alias_disk_n = Check_DriveSize "crit=used>95%" "warn=used>90%" drive=n "perf-config=*(unit:G) used %(ignored:true)"
alias_disk_o = Check_DriveSize "crit=used>95%" "warn=used>90%" drive=o "perf-config=*(unit:G) used %(ignored:true)"
alias_disk_p = Check_DriveSize "crit=used>95%" "warn=used>90%" drive=p "perf-config=*(unit:G) used %(ignored:true)"
alias_disk_q = Check_DriveSize "crit=used>95%" "warn=used>90%" drive=q "perf-config=*(unit:G) used %(ignored:true)"
alias_disk_r = Check_DriveSize "crit=used>95%" "warn=used>90%" drive=r "perf-config=*(unit:G) used %(ignored:true)"
alias_disk_s = Check_DriveSize "crit=used>95%" "warn=used>90%" drive=s "perf-config=*(unit:G) used %(ignored:true)"
alias_disk_t = Check_DriveSize "crit=used>95%" "warn=used>90%" drive=t "perf-config=*(unit:G) used %(ignored:true)"
alias_disk_u = Check_DriveSize "crit=used>95%" "warn=used>90%" drive=u "perf-config=*(unit:G) used %(ignored:true)"
alias_disk_v = Check_DriveSize "crit=used>95%" "warn=used>90%" drive=v "perf-config=*(unit:G) used %(ignored:true)"
alias_disk_x = Check_DriveSize "crit=used>95%" "warn=used>90%" drive=x "perf-config=*(unit:G) used %(ignored:true)"
alias_disk_z = Check_DriveSize "crit=used>95%" "warn=used>90%" drive=z "perf-config=*(unit:G) used %(ignored:true)"


; alias_os - Check OS Version
alias_os = check_os_Version

; alias_cpu_ex - Alias for alias_cpu_ex. To configure this item add a section called: /settings/external scripts/alias/alias_cpu_ex
alias_cpu_ex = check_cpu "warn=load > $ARG1$" "crit=load > $ARG2$" time=5m time=1m time=30s

; alias_file_age - Alias for alias_file_age. To configure this item add a section called: /settings/external scripts/alias/alias_file_age
alias_file_age = check_files "path=$ARG1$" "crit=written > $ARG2$" "top-syntax=${list}" "detail-syntax=${filename] ${written}" max-dir-depth=10

; alias_cpu - Alias for alias_cpu. To configure this item add a section called: /settings/external scripts/alias/alias_cpu
alias_cpu = check_cpu

; alias_up - Alias for alias_up. To configure this item add a section called: /settings/external scripts/alias/alias_up
alias_up = check_uptime

; alias_sched_task - Alias for alias_sched_task. To configure this item add a section called: /settings/external scripts/alias/alias_sched_task
alias_sched_task = check_tasksched show-all "filter=title eq '$ARG1$'" "detail-syntax=${title} (${exit_code})" "crit=exit_code ne 0"

; alias_sched_long - Alias for alias_sched_long. To configure this item add a section called: /settings/external scripts/alias/alias_sched_long
alias_sched_long = check_tasksched "filter=status = 'running'" "detail-syntax=${title} (${most_recent_run_time})" "crit=most_recent_run_time < -$ARG1$"

; alias_disk_loose - Alias for alias_disk_loose. To configure this item add a section called: /settings/external scripts/alias/alias_disk_loose
alias_disk_loose = check_drivesize

; Old commands
nt_cpuload=checkCPU warn=80 crit=90 time=5m time=1m time=30s
nt_memload=checkMem MaxWarn=90% MaxCrit=95% ShowAll=long type=physical type=virtual type=paged type=page
nt_check_disk_c=check_drivesize "crit=used>90%" "warn=used>80%" drive=c
nt_check_disk_d=check_drivesize "crit=used>90%" "warn=used>80%" drive=d
nt_check_disk_e=check_drivesize "crit=used>90%" "warn=used>80%" drive=e
nt_check_disk_f=check_drivesize "crit=used>90%" "warn=used>80%" drive=f
nt_check_disk_g=check_drivesize "crit=used>90%" "warn=used>80%" drive=g
nt_check_disk_h=check_drivesize "crit=used>90%" "warn=used>80%" drive=h
nt_check_disk_i=check_drivesize "crit=used>90%" "warn=used>80%" drive=i
nt_check_disk_j=check_drivesize "crit=used>90%" "warn=used>80%" drive=j
nt_check_disk_k=check_drivesize "crit=used>90%" "warn=used>80%" drive=k
nt_check_disk_l=check_drivesize "crit=used>90%" "warn=used>80%" drive=l
nt_check_disk_m=check_drivesize "crit=used>90%" "warn=used>80%" drive=m
nt_check_disk_n=check_drivesize "crit=used>90%" "warn=used>80%" drive=n
nt_check_disk_o=check_drivesize "crit=used>90%" "warn=used>80%" drive=o
nt_check_disk_p=check_drivesize "crit=used>90%" "warn=used>80%" drive=p
nt_check_disk_q=check_drivesize "crit=used>90%" "warn=used>80%" drive=q
nt_check_disk_r=check_drivesize "crit=used>90%" "warn=used>80%" drive=r
nt_check_disk_s=check_drivesize "crit=used>90%" "warn=used>80%" drive=s
nt_check_disk_t=check_drivesize "crit=used>90%" "warn=used>80%" drive=t
nt_check_disk_u=check_drivesize "crit=used>90%" "warn=used>80%" drive=u
nt_check_disk_v=check_drivesize "crit=used>90%" "warn=used>80%" drive=v
nt_check_disk_x=check_drivesize "crit=used>90%" "warn=used>80%" drive=x
nt_check_disk_y=check_drivesize "crit=used>90%" "warn=used>80%" drive=y
nt_check_disk_z=check_drivesize "crit=used>90%" "warn=used>80%" drive=z
nt_check_disk_w=check_drivesize "crit=used>90%" "warn=used>80%" drive=w
;nt_check_disk_l=CheckDriveSize MinWarn=10% MinCrit=5% Drive=L:\ FilterType=FIXED

[/settings/external scripts/scripts]
check_updates = cmd /c echo scripts\check_windows_updates.ps1; exit($LastExitCode) | powershell.exe -command -
check_updates_wu = cmd /c echo scripts\WU_check.ps1; exit($LastExitCode) | powershell.exe -ExecutionPolicy Bypass -command -
check_ExchangeQueue = cmd /c echo scripts\Check_ExchangeQueueHealth.ps1; exit($LastExitCode) | powershell.exe -command -
check_ex2013dag = cmd /c echo scripts\check_ex2013dag.ps1; exit($lastexitcode) | powershell.exe -noprofile -nologo -command -
check_ex2013_server_component_state = cmd /c echo scripts\check_ex2013_server_component_state.ps1; exit($lastexitcode) | powershell.exe -noprofile -nologo -command -
check_ex2013_Check_Exchange_Content_Index_State_Health = cmd /c echo scripts\Check_ExchangeContentIndexStateHealth.ps1; exit($lastexitcode) | powershell.exe -noprofile -nologo -command -
check_printqueue_2008 = cmd /c echo scripts\check_printqueue_2008.ps1; exit($LastExitCode) | powershell.exe -ExecutionPolicy Bypass -command -
check_skype_entvoice_users = cmd /c echo scripts\check_skype_count_entvoice_users.ps1; exit($LastExitCode) | powershell.exe -command -
check_skype_IM_users = cmd /c echo scripts\check_skype_count_IM_users.ps1; exit($LastExitCode) | powershell.exe -command -
check_skype_MeetingEntCal_users = cmd /c echo scripts\check_skype_count_MeetingEntCal_users.ps1; exit($LastExitCode) | powershell.exe -command -
check_skype_windows_service_state = cmd /c echo scripts\check_skype_windows_service_state.ps1; exit($LastExitCode) | powershell.exe -command -
get_disks=scripts/df.exe -b -r
get_time=scripts/date.exe +%s

; check_windows_time
check_ntp_time = cscript.exe //T:30 //NoLogo scripts\check_time.vbs 10.1.8.200 30 180

; check_dhcp_windows
check_dhcp_windows = cscript.exe //T:30 //NoLogo scripts\check_dhcp_windows.vbs

; Section for NRPE (NRPEServer.dll) (check_nrpe) protocol options.
[/settings/NRPE/server]
allow arguments = true
allow nasty characters = true
port = 5666
use ssl = true
insecure = true
extended response = true
timeout = 75
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: NSclient password

Post by rkennedy »

This is weird. Just to make sure, after editing the password in the config, did you restart the NSClient++ service on your computer? Can you post the results of running a check through the command line to help us further investigate?
Former Nagios Employee
spiderpig
Posts: 23
Joined: Thu Jun 21, 2012 7:23 pm

Re: NSclient password

Post by spiderpig »

Running pre-flight check on configuration data...

Checking services...
Checked 887 services.
Checking hosts...
Checked 184 hosts.
Checking host groups...
Checked 13 host groups.
Checking service groups...
Checked 16 service groups.
Checking contacts...
Checked 8 contacts.
Checking contact groups...
Checked 16 contact groups.
Checking service escalations...
Checked 0 service escalations.
Checking service dependencies...
Checked 0 service dependencies.
Checking host escalations...
Checked 0 host escalations.
Checking host dependencies...
Checked 0 host dependencies.
Checking commands...
Checked 177 commands.
Checking time periods...
Checked 6 time periods.
Checking for circular paths between hosts...
Checking for circular host and service dependencies...
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...

Total Warnings: 0
Total Errors: 0

Things look okay - No serious problems were detected during the pre-flight check


-----

service nagios restart
Running configuration check...done.
Stopping nagios: ..done.
Starting nagios: done.
spiderpig
Posts: 23
Joined: Thu Jun 21, 2012 7:23 pm

Re: NSclient password

Post by spiderpig »

is something else that I have to do on the server side than add the -s password in the command.cfg?

define command{
command_name check_nt
command_line $USER1$/check_nt -H $HOSTADDRESS$ -p 12489 -s PASSWORD -v $ARG1$ $ARG2$
}
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: NSclient password

Post by lmiltchev »

is something else that I have to do on the server side than add the -s password in the command.cfg?
Not really - your command looks fine.

Did you restart the NSClient++ service on your computer? The changes that you have made in the nsclient.ini won't take effect until you restart the NSClient++ service.
Be sure to check out our Knowledgebase for helpful articles and solutions!
spiderpig
Posts: 23
Joined: Thu Jun 21, 2012 7:23 pm

Re: NSclient password

Post by spiderpig »

yes, I restarted the nsclient service on the client also.
Locked