Ping: host or service check?


Hi all

on my nagios configuration i put every check as a service definition,
including PING check.

I realize that, if a specific host goes down, PING service is
obviously CRITICAL, but host is reported as UP in host section and in
the status map.

Which is the correct layout to configure nagios check?

should I configure PING as an host check and others check as services?
If I configure PING as host check, can I make a dependecy between
host_ping and the others services?

really thank you for your help!



It is ok to have a service with the check_ping also. Maybe there is a difference between check retries of the check-host -alive command and the check-ping command, so the check_ping gets to Critical before check-host-alive have done all the retries.

Check-host-alive is a check command for a host that isn’t executed on a regular basis, just when there is a need (for example if all services on that host get critical or unknown state) or when nagios is restarted.

I don’t think you can make service dependent only on the host.


really thanks albin.

But I don’t understand at all.
Maybe you said that i have to configure 2 check ping:

  • one on the host definition
    define host{
    host_name my_host
    check_command check-host-alive

  • one as a service
    define service{
    use my_template
    host_name my_host
    check_command check_ping

should I duplicate the check?


Well, if the ping results are not really important for you, then you can have only one check_ping as check-host-alive under host definition. I’ve said not important, because, check-host-alive is not executed on a regular basis, as mentioned in previous post. It is done only when Nagios thinks it is necessary to check the host.
Although check-host-alive can be any of the check-plugins you want, but as default it is done by check-ping.

With both, the check-host-alive as a host check, and a check_ping service, you get ping check results on a regular basis, as defined in check_interval variable in service definition.

Check’s won’t be duplicated, because Nagios won’t execute check-host-alive until services associated with the host start to get Critical or Unknown.

So it is really up to you, if you want check_ping on a regular basis or not.


now it’s clear.
I needi both check on service and host.

Thank you Albin, your help resulted precious for me!



NP :wink: