Page 1 of 1

Socket Timeout after 10s

Posted: Mon Jun 18, 2018 8:45 am
by luxaivo
Hello,

I try to monitor an Exchange Windows 2012 Server.
But I constantly get a socket timeout after 10s.

I've followed this support page: https://support.nagios.com/kb/article/n ... s-617.html

The nagios XI server is 192.168.0.187 & the Exchange server to monitor is 192.168.0.40
Check_nrpe_command.JPG
Here is my nrpe.conf

Code: Select all

log_facility=daemon
debug=0
pid_file=/usr/local/nagios/var/nrpe.pid
server_port=5666
#server_address=127.0.0.1
#listen_queue_size=5
nrpe_user=nagios
nrpe_group=nagios
allowed_hosts=127.0.0.1,::1,192.168.0.187
dont_blame_nrpe=1
command_timeout=300
connection_timeout=300
#allow_weak_random_seed=1
#allow_weak_random_seed=1
#ssl_version=SSLv2+
#ssl_use_adh=1
#ssl_cipher_list=ALL:!MD5:@STRENGTH
#ssl_cipher_list=ALL:!MD5:@STRENGTH:@SECLEVEL=0
#ssl_cipher_list=ALL:!aNULL:!eNULL:!SSLv2:!LOW:!EXP:!RC4:!MD5:@STRENGTH
#ssl_cacert_file=/etc/ssl/servercerts/ca-cert.pem
#ssl_cert_file=/etc/ssl/servercerts/nagios-cert.pem
#ssl_privatekey_file=/etc/ssl/servercerts/nagios-key.pem
#ssl_client_certs=0
Here's my nagios.cfg:

Code: Select all

# MODIFIED
admin_email=root@localhost
admin_pager=root@localhost
translate_passive_host_checks=1
log_event_handlers=0
use_large_installation_tweaks=1
enable_environment_macros=0


# NDOUtils module
broker_module=/usr/local/nagios/bin/ndomod.o config_file=/usr/local/nagios/etc/ndomod.cfg


# PNP settings - bulk mode with NCPD
process_performance_data=1
# service performance data
service_perfdata_file=/usr/local/nagios/var/service-perfdata
service_perfdata_file_template=DATATYPE::SERVICEPERFDATA\tTIMET::$TIMET$\tHOSTNAME::$HOSTNAME$\tSERVICEDESC::$SERVICEDESC$\tSERVICEPERFDATA::$SERVICEPERFDATA$\tSERVICECHECKCOMMAND::$SERVICECHECKCOMMAND$\tHOSTSTATE::$HOSTSTATE$\tHOSTSTATETYPE::$HOSTSTATETYPE$\tSERVICESTATE::$SERVICESTATE$\tSERVICESTATETYPE::$SERVICESTATETYPE$\tSERVICEOUTPUT::$SERVICEOUTPUT$\tLONGSERVICEOUTPUT::$LONGSERVICEOUTPUT$
service_perfdata_file_mode=a
service_perfdata_file_processing_interval=15
service_perfdata_file_processing_command=process-service-perfdata-file-bulk
# host performance data
host_perfdata_file=/usr/local/nagios/var/host-perfdata
host_perfdata_file_template=DATATYPE::HOSTPERFDATA\tTIMET::$TIMET$\tHOSTNAME::$HOSTNAME$\tHOSTPERFDATA::$HOSTPERFDATA$\tHOSTCHECKCOMMAND::$HOSTCHECKCOMMAND$\tHOSTSTATE::$HOSTSTATE$\tHOSTSTATETYPE::$HOSTSTATETYPE$\tHOSTOUTPUT::$HOSTOUTPUT$\tLONGHOSTOUTPUT::$LONGHOSTOUTPUT$
host_perfdata_file_mode=a
host_perfdata_file_processing_interval=15
host_perfdata_file_processing_command=process-host-perfdata-file-bulk


# OBJECTS - UNMODIFIED
#cfg_file=/usr/local/nagios/etc/objects/commands.cfg
#cfg_file=/usr/local/nagios/etc/objects/contacts.cfg
#cfg_file=/usr/local/nagios/etc/objects/localhost.cfg
#cfg_file=/usr/local/nagios/etc/objects/templates.cfg
#cfg_file=/usr/local/nagios/etc/objects/timeperiods.cfg


# STATIC OBJECT DEFINITIONS (THESE DON'T GET EXPORTED/IMPORTED BY NAGIOSQL)
cfg_dir=/usr/local/nagios/etc/static

# OBJECTS EXPORTED FROM NAGIOSQL
cfg_file=/usr/local/nagios/etc/contacttemplates.cfg
cfg_file=/usr/local/nagios/etc/contactgroups.cfg
cfg_file=/usr/local/nagios/etc/contacts.cfg
cfg_file=/usr/local/nagios/etc/timeperiods.cfg
cfg_file=/usr/local/nagios/etc/commands.cfg
cfg_file=/usr/local/nagios/etc/hostgroups.cfg
cfg_file=/usr/local/nagios/etc/servicegroups.cfg
cfg_file=/usr/local/nagios/etc/hosttemplates.cfg
cfg_file=/usr/local/nagios/etc/servicetemplates.cfg
cfg_file=/usr/local/nagios/etc/servicedependencies.cfg
cfg_file=/usr/local/nagios/etc/serviceescalations.cfg
cfg_file=/usr/local/nagios/etc/hostdependencies.cfg
cfg_file=/usr/local/nagios/etc/hostescalations.cfg
cfg_file=/usr/local/nagios/etc/hostextinfo.cfg
cfg_file=/usr/local/nagios/etc/serviceextinfo.cfg
cfg_dir=/usr/local/nagios/etc/hosts
cfg_dir=/usr/local/nagios/etc/services

# GLOBAL EVENT HANDLERS
global_host_event_handler=xi_host_event_handler
global_service_event_handler=xi_service_event_handler



# UNMODIFIED
accept_passive_host_checks=1
accept_passive_service_checks=1
additional_freshness_latency=15
auto_reschedule_checks=1
auto_rescheduling_interval=30
auto_rescheduling_window=45
bare_update_check=0
cached_host_check_horizon=15
cached_service_check_horizon=15
check_external_commands=1
check_for_orphaned_hosts=1
check_for_orphaned_services=1
check_for_updates=1
check_host_freshness=0
check_result_path=/usr/local/nagios/var/spool/checkresults
check_result_reaper_frequency=10
check_service_freshness=1
command_file=/usr/local/nagios/var/rw/nagios.cmd
daemon_dumps_core=0
date_format=us
debug_file=/usr/local/nagios/var/nagios.debug
debug_level=0
debug_verbosity=1
enable_event_handlers=1
enable_flap_detection=1
enable_notifications=1
enable_predictive_host_dependency_checks=1
enable_predictive_service_dependency_checks=1
event_broker_options=-1
event_handler_timeout=300
execute_host_checks=1
execute_service_checks=1
high_host_flap_threshold=20.0
high_service_flap_threshold=20.0
host_check_timeout=300
host_freshness_check_interval=60
host_inter_check_delay_method=s
illegal_macro_output_chars=`~$&|'"<>
illegal_object_name_chars=`~!$%^&*|'"<>?,()=
interval_length=60
lock_file=/usr/local/nagios/var/nagios.lock
log_archive_path=/usr/local/nagios/var/archives
log_external_commands=0
log_file=/usr/local/nagios/var/nagios.log
log_host_retries=1
log_initial_states=0
log_notifications=1
log_passive_checks=0
log_rotation_method=d
log_service_retries=1
low_host_flap_threshold=5.0
low_service_flap_threshold=5.0
max_check_result_file_age=3600
max_check_result_reaper_time=30
max_concurrent_checks=0
max_debug_file_size=1000000
max_host_check_spread=30
max_service_check_spread=30
nagios_group=nagios
nagios_user=nagios
notification_timeout=30
object_cache_file=/usr/local/nagios/var/objects.cache
obsess_over_hosts=0
obsess_over_services=0
ocsp_timeout=5
passive_host_checks_are_soft=0
perfdata_timeout=5
precached_object_file=/usr/local/nagios/var/objects.precache
resource_file=/usr/local/nagios/etc/resource.cfg
retained_contact_host_attribute_mask=0
retained_contact_service_attribute_mask=0
retained_host_attribute_mask=0
retained_process_host_attribute_mask=0
retained_process_service_attribute_mask=0
retained_service_attribute_mask=0
retain_state_information=1
retention_update_interval=60
service_check_timeout=60
service_freshness_check_interval=60
service_inter_check_delay_method=s
service_interleave_factor=s
soft_state_dependencies=0
state_retention_file=/usr/local/nagios/var/retention.dat
status_file=/usr/local/nagios/var/status.dat
status_update_interval=10
temp_file=/usr/local/nagios/var/nagios.tmp
temp_path=/tmp
use_aggressive_host_checking=0
use_regexp_matching=0
use_retained_program_state=1
use_retained_scheduling_info=1
use_syslog=1
use_true_regexp_matching=0
The output of different commands:
NRPE.JPG
Windows server:
WFW.JPG
Here's the error log file:

Code: Select all

2018-06-18 10:38:02: error:c:\source\nscp\modules\NRPEServer\NRPEServer.cpp:132: Certificate not found: C:\Program Files\NSClient++/security/certificate.pem (generating a default certificate)
2018-06-18 10:38:02: error:c:\source\nscp\modules\NRPEServer\NRPEServer.cpp:132: CA not found: C:\Program Files\NSClient++/security/ca.pem (generating a default CA)
2018-06-18 10:39:54: error:c:\source\nscp\include\nrpe/server/protocol.hpp:80: Rejected connection from: 192.168.0.40
2018-06-18 10:40:42: error:c:\source\nscp\include\nrpe/server/protocol.hpp:80: Rejected connection from: 192.168.0.40
2018-06-18 10:40:42: error:c:\source\nscp\include\nrpe/server/protocol.hpp:80: Rejected connection from: 192.168.0.40
2018-06-18 10:40:43: error:c:\source\nscp\include\nrpe/server/protocol.hpp:80: Rejected connection from: 192.168.0.40
2018-06-18 10:43:37: error:c:\source\nscp\include\socket/connection.hpp:243: Failed to establish secure connection: no certificate returned: 178
2018-06-18 10:43:48: error:c:\source\nscp\include\socket/connection.hpp:240: Seems we cant agree on SSL: no shared cipher
2018-06-18 10:43:48: error:c:\source\nscp\include\socket/connection.hpp:241: PLease review the legacy as well as ssl options in settings.
2018-06-18 10:45:27: error:c:\source\nscp\include\socket/connection.hpp:240: Seems we cant agree on SSL: no shared cipher
2018-06-18 10:45:27: error:c:\source\nscp\include\socket/connection.hpp:241: PLease review the legacy as well as ssl options in settings.
2018-06-18 10:47:43: error:c:\source\nscp\include\socket/connection.hpp:243: Failed to establish secure connection: short read: 219
2018-06-18 10:47:52: error:c:\source\nscp\include\socket/connection.hpp:240: Seems we cant agree on SSL: no shared cipher
2018-06-18 10:47:52: error:c:\source\nscp\include\socket/connection.hpp:241: PLease review the legacy as well as ssl options in settings.
2018-06-18 10:48:10: error:c:\source\nscp\include\socket/connection.hpp:243: Failed to establish secure connection: sslv3 alert unexpected message: 1010
2018-06-18 10:48:26: error:c:\source\nscp\include\socket/connection.hpp:243: Failed to establish secure connection: unknown protocol: 252
2018-06-18 10:52:23: error:c:\source\nscp\include\socket/connection.hpp:243: Failed to establish secure connection: sslv3 alert unexpected message: 1010
2018-06-18 11:02:46: error:c:\source\nscp\include\socket/connection.hpp:243: Failed to establish secure connection: sslv3 alert unexpected message: 1010
2018-06-18 11:03:04: error:c:\source\nscp\include\socket/connection.hpp:243: Failed to establish secure connection: unknown protocol: 252
2018-06-18 11:11:50: error:c:\source\nscp\include\socket/connection.hpp:243: Failed to establish secure connection: sslv3 alert unexpected message: 1010
2018-06-18 11:12:03: error:c:\source\nscp\include\socket/connection.hpp:243: Failed to establish secure connection: unknown protocol: 252
2018-06-18 11:12:03: error:c:\source\nscp\include\socket/connection.hpp:243: Failed to establish secure connection: unknown protocol: 252
2018-06-18 11:12:32: error:c:\source\nscp\include\socket/connection.hpp:240: Seems we cant agree on SSL: no shared cipher
2018-06-18 11:12:32: error:c:\source\nscp\include\socket/connection.hpp:241: PLease review the legacy as well as ssl options in settings.
2018-06-18 11:12:40: error:c:\source\nscp\include\socket/connection.hpp:243: Failed to establish secure connection: unknown protocol: 252
2018-06-18 11:12:41: error:c:\source\nscp\include\socket/connection.hpp:243: Failed to establish secure connection: unknown protocol: 252
2018-06-18 11:12:41: error:c:\source\nscp\include\socket/connection.hpp:243: Failed to establish secure connection: unknown protocol: 252
2018-06-18 11:33:08: error:c:\source\nscp\include\socket/connection.hpp:243: Failed to establish secure connection: sslv3 alert unexpected message: 1010
2018-06-18 11:37:57: error:c:\source\nscp\include\socket/connection.hpp:243: Failed to establish secure connection: sslv3 alert handshake failure: 1040
2018-06-18 11:40:50: error:c:\source\nscp\include\socket/connection.hpp:243: Failed to establish secure connection: unknown protocol: 252
2018-06-18 11:40:50: error:c:\source\nscp\include\socket/connection.hpp:243: Failed to establish secure connection: unknown protocol: 252
2018-06-18 11:55:51: error:c:\source\nscp\include\socket/connection.hpp:243: Failed to establish secure connection: unknown protocol: 252
2018-06-18 11:55:51: error:c:\source\nscp\include\socket/connection.hpp:243: Failed to establish secure connection: unknown protocol: 252
2018-06-18 12:05:28: error:c:\source\nscp\include\socket/connection.hpp:243: Failed to establish secure connection: unknown protocol: 252
2018-06-18 12:05:28: error:c:\source\nscp\include\socket/connection.hpp:243: Failed to establish secure connection: unknown protocol: 252
2018-06-18 12:05:57: error:c:\source\nscp\include\socket/connection.hpp:243: Failed to establish secure connection: sslv3 alert unexpected message: 1010
2018-06-18 12:06:36: error:c:\source\nscp\include\socket/connection.hpp:243: Failed to establish secure connection: unknown protocol: 252
2018-06-18 12:11:27: error:c:\source\nscp\include\socket/connection.hpp:243: Failed to establish secure connection: unknown protocol: 252
2018-06-18 15:09:08: error:c:\source\nscp\include\socket/connection.hpp:243: Failed to establish secure connection: unknown protocol: 252
And here's my nsclient.ini file:

Code: Select all

# If you want to fill this file with all avalible options run the following 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]

; Undocumented key
password = exchmonitor

; Undocumented key
allowed hosts = 127.0.0.1,::1,192.168.0.187,192.168.0.40


; Undocumented section
[/settings/NRPE/server]

; Undocumented key
ssl options = no-sslv2,no-sslv3

; Undocumented key
verify mode = peer-cert

; Undocumented key
insecure = true


; Undocumented section
[/modules]

; Undocumented key
CheckExternalScripts = 1

; Undocumented key
CheckHelpers = 1

; Undocumented key
CheckEventLog = 1

; Undocumented key
CheckNSCP = 1

; Undocumented key
CheckDisk = 1

; Undocumented key
CheckSystem = 1

; Undocumented key
NRPEServer = 1

Thank you for your help.

Re: Socket Timeout after 10s

Posted: Mon Jun 18, 2018 3:20 pm
by npolovenko
Hello, @luxaivo. Please save a copy of the existing nsclient.ini file somewhere on your server, and then replace it with the attached nsclient.ini file. After that, you need to restart the nsclient service from the windows services menu.
When done, please rerun the check_nrpe command one more time:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H 192.168.0.187

Re: Socket Timeout after 10s

Posted: Tue Jun 19, 2018 2:10 am
by luxaivo
Hello,

Thank you for your help !

Woah it works like a charm ! :D

Another question, does it works if I apply it on another server, just replace the password and IP's on allowed host ?

Re: Socket Timeout after 10s

Posted: Tue Jun 19, 2018 8:21 am
by scottwilkerson
luxaivo wrote:Another question, does it works if I apply it on another server, just replace the password and IP's on allowed host ?
Yes, you can copy this config to another server, and once you have the correct allowed IP of your nagios server that wouldn't change, and it is not required to have different nsclient passwords

Re: Socket Timeout after 10s

Posted: Tue Jun 19, 2018 9:31 am
by luxaivo
Thank you !

When I monitor the Queue, I get NSClient - ERROR: Invalid return from command: check_pdh.

But when I run this command i can get zero
pdh.JPG

Re: Socket Timeout after 10s

Posted: Tue Jun 19, 2018 9:58 am
by scottwilkerson
Can you show how the one not working is configured in Nagios XI, (e.g. show the service config in the CCM)?

Re: Socket Timeout after 10s

Posted: Wed Jun 20, 2018 3:27 am
by luxaivo
Sorry, I think it's not this one i'm talking about, it's these one:
pending.JPG
Pending 2.JPG
I would like to know how many emails are waiting in the queue in/out.

Re: Socket Timeout after 10s

Posted: Wed Jun 20, 2018 8:28 am
by scottwilkerson
Can you run that from the command line and get a response on the command line?

Are you sure these server have those performance counters? Can you find them with the perfmon application on the server?