0

I have a Shinken setup which tests 2 domains that are behind an HTTP authentication. To do so, I use the following custom macro:

define command {
    command_name new_check_http
    command_line /opt/shinken/libexec/check_http $ARG1$ --warning $ARG2$ --critical $ARG3$
}

The command is called like this

check_command new_check_http!-I my_host -H my_website -p 80 -a "http_user:http_password"!10!30

When I try /opt/shinken/libexec/check_http -I my_host -H my_website -p 80 -a "http_user:http_password --warning 10 --critical 30, I get a 302, like I should. However, Shinken keeps reporting 401 every hour. What could be the problem? How can I see what is actually being done?

mzhaase
  • 3,778
  • 2
  • 19
  • 32
greg0ire
  • 316
  • 1
  • 6
  • 26

1 Answers1

1

I think this might be an issue with spaces and the quotes. Try to separate it with more variables, for example:

define command {
    command_name new_check_http
    command_line /opt/shinken/libexec/check_http -I $ARG1$ -H $ARG2$ -p $ARG3$ -a $ARG4$ --warning $ARG5$ --critical $ARG6$
}

check_command new_check_http!my_host!my_website!80!http_user:http_password!10!30

Or even better, use custom variables:

define command {
    command_name new_check_http
    command_line /opt/shinken/libexec/check_http -I $_IP$ -H $_HOSTNAME$ -p $_PORT$ -a $_AUTH$ --warning $ARG1$ --critical $ARG2$
}

Then, in your host definition:

define host{
  host_name test
  address   127.0.0.1
  _IP       127.0.0.1
  _HOSTNAME test
  _PORT     80
  _AUTH     http_user:http_password
}
mzhaase
  • 3,778
  • 2
  • 19
  • 32
  • I feel very dumb… the problem actually was there were one check directly on the front, with authentication, and one throught the proxy, which was missing authentication. Let's award the bounty anyway I guess… – greg0ire Apr 07 '17 at 09:24