I've fixed many issues on servers which indicated errors on Nagios but for some reason the alert is still up even though the problem has been fixed. So i was wondering, is there a way to force check all hosts?

4 Answers 4


The easiest way by far is to simply restart Nagios. Upon a restart it will begin a new checking cycle.

  • for some reason it doesn't, i used service nagios reload/restart and the servers which indicated a problem and have been fixed still appear on the Nagios and still indicating on a problem.
    – Itai Ganot
    Oct 10, 2012 at 10:59
  • Then I think you may have another problem altogether. e.g. The checks on the monitored servers may not be functioning correctly or just not returning the correct data. Oct 10, 2012 at 11:02
  • The alert it indicated about was correct, when i logged into the problematic server i saw the problem exacly how it was indicated on Nagios but after fixing it, the alert doesn't disappear.
    – Itai Ganot
    Oct 10, 2012 at 11:11
  • 1
    Try executing the check manually from the nagios server.
    – user130370
    Oct 10, 2012 at 11:23

So i was wondering, is there a way to force check all hosts?

SCHEDULE_FORCED_HOST_SVC_CHECKS external command is what you're looking for.

To get all of your hosts, take a look at the MK Livestatus:

# echo -e 'GET hosts\nColumns: host_name' | unixcat /usr/local/nagios/var/rw/live

then pipe to the SCHEDULE_FORCED_HOST_SVC_CHECKS command:

echo -e 'GET hosts\nColumns: host_name' | unixcat /usr/local/nagios/var/rw/live | while read host; do echo "[$(date +%s)] SCHEDULE_FORCED_HOST_SVC_CHECKS;$host;$(date +%s)\n" $(date +%s) >> /usr/local/nagios/var/rw/nagios.cmd; done

  • great, does thich check all the services on each host as well? or just host connectivity?
    – user230910
    Mar 21, 2017 at 8:43

Here's a bash script based on Nagios' sample script and the external command "SCHEDULE_FORCED_HOST_SVC_CHECKS":

# This is a sample shell script showing how you can submit the SCHEDULE_HOST_SVC_CHECKS command
# to Nagios. Adjust variables to fit your environment as necessary.

now=`date +%s` commandfile='/usr/local/nagios/var/rw/nagios.cmd'

for i in hosts/*.cfg
                SITE=$(grep host_name $i | head -1 | sed 's/host_name//' | tr -d '[:blank:]')
                /usr/bin/printf "[%lu] SCHEDULE_HOST_SVC_CHECKS;${SITE};1110741500\n" $now > $commandfile


Here is a Nagios XI component to force an immediate check on multiple hosts/services.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .