Change how Nagios determines if server is offline?

I'm new to nagios and my server is on a network which does not allow the server to be pinged. Is it possible for me to check if the server is up another way? e.g via SSH or HTTP? How would I do this so on my nagios report it doesn't show the server as offline when it is online?


Solution 1:

On your host definition you can specify what command you want to use.

define host{
        use                                     generic-host
        host_name                               SVR_1
        alias                                   SVR_1
        address                                 10.0.0.6
        check_command                   check-host-alive
        max_check_attempts              2
        notification_interval   120
        notification_period             24x7
        notification_options    d,u,r
        }

so, typically in checkcommands.cfg you would make a new command with what you wanted, or you could just use check_http.

define command{
        command_name    check-host-alive
        command_line    $USER1$/check_ping -H $HOSTADDRESS$ -w 3000.0,80% -c 5000.0,100% -p 1
        }

Solution 2:

You probably configured your server as a host in hosts.cfg with a line that looks like

check_command           check-host-alive

check-host-alive is defined in commands.cfg to use check_ping.

I would suggest you to change the check_command to something like my-check-host-alive and to define my-check-host-alive in commands.cfg to use something like check_tcp.

Start check_tcp with -h to see the help for it.