Page 2 of 2

Re: Server showing a Connection Refused

Posted: Wed Jun 03, 2015 10:59 am
by abrist
Can you post the associated service checks for these and the remote host nsclient.ini file? (in code wraps?)

Re: Server showing a Connection Refused

Posted: Fri Jun 05, 2015 2:42 am
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$
}

Re: Server showing a Connection Refused

Posted: Fri Jun 05, 2015 9:29 am
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...

Re: Server showing a Connection Refused

Posted: Fri Jun 05, 2015 10:12 am
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

Re: Server showing a Connection Refused

Posted: Fri Jun 05, 2015 10:35 am
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.