Page 6 of 9
Re: Sporadic 'Connection refused' errors in 4.2.4
Posted: Mon Jan 30, 2017 11:32 am
by tgriep
Redacted.
The error in the messages file didn't have any details on what caused it and at the same time that notification went out.
It could be a configuration error in nagios or an email server error, etc... There is not enough information to debug this.
Also, check the maillog file to see if there are any errors at that time as well.
Re: Sporadic 'Connection refused' errors in 4.2.4
Posted: Mon Jan 30, 2017 11:35 am
by kernow5000
Are you suggesting the problem is in the notifications because they work perfectly, it's just the information in the notifications I'm worried about.
Re: Sporadic 'Connection refused' errors in 4.2.4
Posted: Mon Jan 30, 2017 12:05 pm
by rkennedy
tgriep wrote:The only thing I saw in the nagios.log file at the same time the error was in the messages log is the following.
Code: Select all
SERVICE NOTIFICATION: external;www.xxx.xxx;HTTPS check;CRITICAL;notify-service-by-email;connect to address www.xxx.xxx and port 443: Connection refused
Take a look at the notification settings and verify that they are correct.
Please show us the service definition for the above one in question, as it's most likely a setting at this layer that'll need to be changed.
Re: Sporadic 'Connection refused' errors in 4.2.4
Posted: Mon Jan 30, 2017 12:12 pm
by kernow5000
To be honest, I've disabled it. But I'll dig out the host and service definition for it tomorrow
Cheers.
Re: Sporadic 'Connection refused' errors in 4.2.4
Posted: Mon Jan 30, 2017 12:18 pm
by kernow5000
Code: Select all
webserver-template:
define host{
name webserver-template
notifications_enabled 1
event_handler_enabled 1
flap_detection_enabled 0
process_perf_data 1
retain_status_information 1
retain_nonstatus_information 1
check_period 24x7
check_interval 5
retry_interval 0
max_check_attempts 1
check_command check_http
notification_period 24x7
notification_interval 0
contact_groups emailonly
active_checks_enabled 1
passive_checks_enabled 0
register 0
Code: Select all
Host which uses that template (was SMS but now email only):
define host{
use webserver-template
host_name REDACTED
alias REDACTED
hostgroups REDACTED
contact_groups emailonly
}
Code: Select all
Related service check:
#define service{
# use service-template
# name REDACTED
# host_name REDACTED
# service_description HTTPS check
# check_command check_https_text!/nagios!OK!60
# contact_groups emailonly
#}
Odd how this works perfectly 99% of the time and then goes completely nuts sometimes with .... well, the whole discussion in this thread.
Oh, also the check_https_text command outline is as follows
Code: Select all
# check for text in https url
define command{
command_name check_https_text
command_line $USER1$/check_http -H $HOSTADDRESS$ -4 -S -u $ARG1$ -s $ARG2$ -t $ARG3$
}
Re: Sporadic 'Connection refused' errors in 4.2.4
Posted: Mon Jan 30, 2017 4:38 pm
by tgriep
I am thinking it could be the notification command. Can you post this command and also the contact entry?
It could be a bug that should of been fixed. Take a look at this.
https://github.com/NagiosEnterprises/na ... issues/172
You can enabling debugging by editing the nagios.cfg file and change the following option to the example below
This will log everything to this file on your server
Code: Select all
/usr/local/nagios/var/nagios.debug
It will grow very large so don't leave it running too long.
Re: Sporadic 'Connection refused' errors in 4.2.4
Posted: Tue Jan 31, 2017 4:09 am
by kernow5000
Yeah, I've had debug mode on before.
As for that command:
oh, it's the default 'notify-host-by-email' command that comes with commands.cfg in the default NagiOS configs.
Code: Select all
# 'notify-host-by-email' command definition
define command{
command_name notify-host-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
}
Also, it happens on SMS (with custom PHP via SMS API), and email, so I doubt it's the notification commands as these 99.9% work perfectly.
Re: Sporadic 'Connection refused' errors in 4.2.4
Posted: Tue Jan 31, 2017 6:01 am
by kernow5000
And yeah, I've seen that github issue as I've been investigating this before this thread.
As you said, it should be fixed.
Re: Sporadic 'Connection refused' errors in 4.2.4
Posted: Tue Jan 31, 2017 11:43 am
by rkennedy
Can you post a big of the nagios debug log for us to review?
Re: Sporadic 'Connection refused' errors in 4.2.4
Posted: Tue Jan 31, 2017 11:53 am
by kernow5000
I can, however it's a lot of information to mask.
Also, I would have to enable debugging from now on, as I disabled it again - not to mention the fact I've disabled most of the problematic checks.
Haven't had a peep out of it hardly via email or sms (mainly as I downgraded everything to email instead of SMS because it was getting increasingly annoying and wasting money).
So basically, currently it's useless I guess