Search This Blog

Saturday, April 19, 2014

Nagios – Check Host without Ping

As my previous post about Firewall(iptables) on servers, I like to disable PING(ICMP) on my server.

But Nagios will mark them as [Down] when you using Nagios to monitor the server.

Solution:

If it is web hosting server, means HTTP is public accessible.

I do this on my Nagios 4.0.5 build:

/usr/local/nagios/etc/objects/templates.cfg

# NO PING web host
define host{
name generic-noping-webhost ; The name of this host template
notifications_enabled 1 ; Host notifications are enabled
event_handler_enabled 1 ; Host event handler is enabled
flap_detection_enabled 1 ; Flap detection is enabled
process_perf_data 1 ; Process performance data
retain_status_information 1 ; Retain status information across program restarts
retain_nonstatus_information 1 ; Retain non-status information across program restarts
check_command check_http ;
max_check_attempts 10 ; Check each server 10 times (max)
notification_interval 30 ; Resend notifications every 30 minutes
notification_period 24x7 ; Send host notifications at any time
notification_options d,u,r ; Only send notifications for specific host states
contact_groups admins ; Notifications get sent to the admins by default
register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A TEMPLATE!
}


Then in the hosts.cfg define add:
define host{
use generic-noping-webhost
host_name bpt-milliondollarserver
alias bpt-milliondollarserver
address
}


Just in case your server doesn't event have HTTP service.
Try:

check_command                   check_dummy      ;

And define check_dump in commands.cfg

check_command                   check_tcp_port_1234;

Add define check_tcp -p 80 in commands.cfg

Replace:
check_command                   check_http      ;

1 comment: