Sporadic 'Connection refused' errors in 4.2.4

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: Sporadic 'Connection refused' errors in 4.2.4

Post 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
kernow5000
Posts: 58
Joined: Mon Jan 09, 2017 9:06 am

Re: Sporadic 'Connection refused' errors in 4.2.4

Post 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.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Sporadic 'Connection refused' errors in 4.2.4

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

Re: Sporadic 'Connection refused' errors in 4.2.4

Post by kernow5000 »

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

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

User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: Sporadic 'Connection refused' errors in 4.2.4

Post by tgriep »

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/na ... 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
kernow5000
Posts: 58
Joined: Mon Jan 09, 2017 9:06 am

Re: Sporadic 'Connection refused' errors in 4.2.4

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

Re: Sporadic 'Connection refused' errors in 4.2.4

Post 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.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Sporadic 'Connection refused' errors in 4.2.4

Post by rkennedy »

Can you post a big of the nagios debug log for us to review?
Former Nagios Employee
kernow5000
Posts: 58
Joined: Mon Jan 09, 2017 9:06 am

Re: Sporadic 'Connection refused' errors in 4.2.4

Post 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 :D
Locked