Sporadic 'Connection refused' errors in 4.2.4

An open discussion forum for obtaining help with Nagios Core. Nagios Core users of all experience levels are welcome here. Subforum have been created for the discussion of Nagios Core and Nagios Plugin development.

NOTE: The SourceForge.net mailing lists have been deprecated in favor of this forum in order to expedite support and provide additional features not available on the old mailing list.

Re: Sporadic 'Connection refused' errors in 4.2.4

Postby tgriep » Mon Jan 30, 2017 11:32 am

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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
tgriep
Madmin
 
Posts: 8432
Joined: Thu Oct 30, 2014 9:02 am

Re: Sporadic 'Connection refused' errors in 4.2.4

Postby kernow5000 » Mon Jan 30, 2017 11:35 am

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.
kernow5000
 
Posts: 58
Joined: Mon Jan 09, 2017 9:06 am

Re: Sporadic 'Connection refused' errors in 4.2.4

Postby rkennedy » Mon Jan 30, 2017 12:05 pm

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.
Former Nagios Employee
rkennedy
 
Posts: 6581
Joined: Mon Oct 05, 2015 11:45 am

Re: Sporadic 'Connection refused' errors in 4.2.4

Postby kernow5000 » Mon Jan 30, 2017 12:12 pm

To be honest, I've disabled it. But I'll dig out the host and service definition for it tomorrow :)

Cheers.
kernow5000
 
Posts: 58
Joined: Mon Jan 09, 2017 9:06 am

Re: Sporadic 'Connection refused' errors in 4.2.4

Postby kernow5000 » Mon Jan 30, 2017 12:18 pm

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$
}

kernow5000
 
Posts: 58
Joined: Mon Jan 09, 2017 9:06 am

Re: Sporadic 'Connection refused' errors in 4.2.4

Postby tgriep » Mon Jan 30, 2017 4:38 pm

I am thinking it could be the notification command. Can you post this command and also the contact entry?
Code: Select all
notify-service-by-email

It could be a bug that should of been fixed. Take a look at this.
https://github.com/NagiosEnterprises/nagioscore/issues/172

You can enabling debugging by editing the nagios.cfg file and change the following option to the example below
Code: Select all
debug_level=-1


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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
tgriep
Madmin
 
Posts: 8432
Joined: Thu Oct 30, 2014 9:02 am

Re: Sporadic 'Connection refused' errors in 4.2.4

Postby kernow5000 » Tue Jan 31, 2017 4:09 am

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.
kernow5000
 
Posts: 58
Joined: Mon Jan 09, 2017 9:06 am

Re: Sporadic 'Connection refused' errors in 4.2.4

Postby kernow5000 » Tue Jan 31, 2017 6:01 am

And yeah, I've seen that github issue as I've been investigating this before this thread.

As you said, it should be fixed.
kernow5000
 
Posts: 58
Joined: Mon Jan 09, 2017 9:06 am

Re: Sporadic 'Connection refused' errors in 4.2.4

Postby rkennedy » Tue Jan 31, 2017 11:43 am

Can you post a big of the nagios debug log for us to review?
Former Nagios Employee
rkennedy
 
Posts: 6581
Joined: Mon Oct 05, 2015 11:45 am

Re: Sporadic 'Connection refused' errors in 4.2.4

Postby kernow5000 » Tue Jan 31, 2017 11:53 am

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 :D
kernow5000
 
Posts: 58
Joined: Mon Jan 09, 2017 9:06 am

PreviousNext

Return to Nagios Core

Who is online

Users browsing this forum: Google [Bot] and 31 guests