Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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

Short version: if I want to change one of the "command definitions" in the Nagios set, what is the best way to do it?

For example, I would like to add the -f (follow) flag to one of the check_http commands found in /etc/nagios-plugins/config/http.cfg. But it feels wrong to be editing those files.

Should I edit the existing commands to meet my needs? Should I add my own command to the http.cfg file to meet my needs? Is there a place where I can add my own command file?

Pointers to the docs are gladly welcomed!

share|improve this question
up vote 1 down vote accepted

Define your own command with a new name in etc/objects/commands.cfg, something like this:

define command{
        command_name    check_http
        command_line    $USER1$/check_http -I $HOSTADDRESS$ $ARG1$

define command{
        command_name    check_http_redirect
        command_line    $USER1$/check_http -I $HOSTADDRESS$ -f $ARG1$

and call it with corresponding state which you want to handle in /etc/nagios-plugins/config/http.cfg:

define service{
    use                     generic-service
    check_command           check_http_redirect!warning
    process_perf_data       0
    contact_groups          admin

An example when running from the command line:

$ check_http -H -f warning
HTTP WARNING: HTTP/1.1 301 Moved Permanently - 428 bytes in 0.003 second response time |time=0.002897s;;;0.000000 size=428B;;;0
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.