Server showing a Connection Refused

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.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Server showing a Connection Refused

Post by abrist »

Can you post the associated service checks for these and the remote host nsclient.ini file? (in code wraps?)
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
nathanplatt
Posts: 267
Joined: Thu May 07, 2015 4:59 am

Re: Server showing a Connection Refused

Post by nathanplatt »

Sorry it took a while, i've been out of the office. I've attached the segments of the code in question. See if you can find what i've missed?

Code: Select all

Windows.cfg

define host{
        use             generic-host    ;
        host_name       TS10            ;
        alias           TS10            ;
        address         192.168.87.80,192.168.87.81     ;
        parents         Datacentre Gateway      ;
        vrml_image      rack-server.gif ;
        statusmap_image rack-server.gd2 ;
        }

#TS10 Monitoring Section

define service{
        use                     generic-service
        host_name               TS10
        service_description     Check Uptime
        check_command           check_nt!N0rth3dgE!UPTIME
}

define service{
        use                     generic-service
        host_name               TS10
        service_description     Check C Drive
        check_command           check_ntdsk!USEDDISKSPACE!C
}
define service{
        use                     generic-service
        host_name               TS10
        service_description     CPU Load
        check_command           check_nt_cpu_avg!
}

Commands.cfg
		
# Checks Avaliable HD Space
        define command{
                command_name check_ntdsk
                command_line    /usr/lib/nagios/plugins/check_nt -H '$HOSTADDRE$
        }

#CPU Load over 10 Min, 60 Min, 24 hrs

        define command{
                command_name check_nt_cpu_avg
                command_line $USER1$/check_nt -H $HOSTADDRESS$ -s N0rth3dgE -p $
        }


# 'check_nt' command definition
define command{
        command_name    check_nt
        command_line    $USER1$/check_nt -H $HOSTADDRESS$ -p 12489 -s $ARG1$ -v$
}
Attachments
nagios information.txt
(1.58 KiB) Downloaded 201 times
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: Server showing a Connection Refused

Post by jdalrymple »

nathanplatt wrote: # Checks Avaliable HD Space
define command{
command_name check_ntdsk
command_line /usr/lib/nagios/plugins/check_nt -H '$HOSTADDRE$
}

#CPU Load over 10 Min, 60 Min, 24 hrs

define command{
command_name check_nt_cpu_avg
command_line $USER1$/check_nt -H $HOSTADDRESS$ -s N0rth3dgE -p $
}


# 'check_nt' command definition
define command{
command_name check_nt
command_line $USER1$/check_nt -H $HOSTADDRESS$ -p 12489 -s $ARG1$ -v$
}
[/code]
I don't see how any of these commands could work on any other hosts either. I suggest something like this:


commands.cfg:

Code: Select all

define command{
      command_name check_nt
      command_line    $USER1$/check_nt -H $HOSTADDRESS$ -p 12489 -s MYSECRET -v $ARG1$
}
services.cfg:

Code: Select all

define service{
        use                     generic-service
        host_name               TS10
        service_description     Check C Drive
        check_command           check_nt!USEDDISKSPACE -l C
}

define service{
        use                     generic-service
        host_name               TS10
        service_description     CPU Load
        check_command           check_nt!CPULOAD -l 5,80,90
}


define service{
        use                     generic-service
        host_name               TS10
        service_description     Check Uptime
        check_command           check_nt!UPTIME
}
Also note, there is no fundamental reason you couldn't do this:

Code: Select all

define service{
        use                     generic-service
        host_name               TS1,TS2,TS3,TS4,TS5,TS6,TS7,TS8,TS9,TS10
        service_description     CPU Load
        check_command           check_nt!CPULOAD -l 5,80,90
}
Although you certainly may have your own logistical reasons...
nathanplatt
Posts: 267
Joined: Thu May 07, 2015 4:59 am

Re: Server showing a Connection Refused

Post by nathanplatt »

Right its funny about your last post, i had just read about the multiple hosts on 1 line and was doing that. Here's the new code and results;

Code: Select all

#Monitoring Section#

define service{
        use                     generic-service
        host_name               DR1,DR2,DR3,DR Mail,SQL_DR,AD1,AD3,AD4,TS1,TS1-V,TS2,TS2-V,TS3-V,TS4,TS4-V,TS5,TS6,TS7,TS8,TS8-V,TS9,TS9-V,TS10,TS10-V,APP1,Kratos 3,Kr$
        service_description     Check Uptime
        check_command           check_nt!UPTIME
}

define service{
        use                     generic-service
        host_name               DR1,DR2,DR3,DR Mail,SQL_DR,AD1,AD3,AD4,TS1,TS1-V,TS2,TS2-V,TS3-V,TS4,TS4-V,TS5,TS6,TS7,TS8,TS8-V,TS9,TS9-V,TS10,TS10-V,APP1,Kratos 3,Kr$
        service_description     Check C Drive
        check_command           check_nt!USEDDISKSPACE -l C
}

define service{
        use                     generic-service
        host_name               DR1,DR2,DR3,DR Mail,SQL_DR,AD1,AD3,AD4,TS1,TS1-V,TS2,TS2-V,TS3-V,TS4,TS4-V,TS5,TS6,TS7,TS8,TS8-V,TS9,TS9-V,TS10,TS10-V,APP1,Kratos 3,Kr$
        service_description     CPU Load
        check_command           check_nt!CPULOAD -l 5,80,90
}
I've adjusted the commands.cfg as follows;

Code: Select all

# 'check_nt' command definition
define command{
        command_name    check_nt
        command_line    $USER1$/check_nt -H $HOSTADDRESS$ -p 12489 -s N0rth3dgE -v $ARG1$ $ARG2$ $ARG3$
}
What i'm getting now on the CPU Load is : check_nt: Could not parse arguments

And some of my servers are still showing;

TS10


CPU Load

CRITICAL 2015-06-05 16:09:07 1d 23h 15m 59s 4/4 Name or service not known

Check C Drive

CRITICAL 2015-06-05 16:08:45 2d 1h 36m 21s 4/4 Name or service not known

Check Uptime

CRITICAL 2015-06-05 16:09:10 0d 0h 2m 56s 4/4 Name or service not known
nathanplatt
Posts: 267
Joined: Thu May 07, 2015 4:59 am

Re: Server showing a Connection Refused

Post by nathanplatt »

Just discovered the wonderful mistake of incorrect routing tables and : where it should have been ;. Thanks for all the help, can someone close this please.
Locked