Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way to initiate a check of all services in a service group from either the Nagios web GUI or via the command line?

For example, I have a service group with a check that runs on 30 machines. I'd like to initiate a command that would force the check on all of those 30 machines. I know you can do it via the GUI on a single machine, but it would be great if it could be done against an entire service group.

share|improve this question

I am not aware of any way through the standard GUI to accomplish this.

But one thing you can do is install the livestatus module. This module makes Nagios listen on a socket, and you can run queries against it, and retrieve information. With this API enabled you should then be able write a script that gets information about the servicegroup, and then runs a series of commands.

Your system must also have External Commands enabled. Livestatus is how you get information out. External commands is how you send in your requests for an action to be performed.

This example script might be able to get you started. This script sends a query to live status to find all hosts with a non OK state. It then forces an immediate re-check for each host host found in this state.


export IFS=';'
echo "GET hosts
Columns: state host_name
Filter: state != 0
  | (

  while read -a LINE ; do
     /usr/bin/printf "[%lu] SCHEDULE_HOST_CHECK;%s;%s\n" \
                      $(date +%s) \
                      "${LINE[1]}" \
                      $(date +%s) | tee -a $NAGIOS_CMD_SOCKET
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.