I am trying to add a check on a web page to ensure it is up and running.
I tried with the HTTP plugin with the HTTP-Response-Time service template. By default it will fail only if the web server is not responding but it will be OK even with a 404 error for exemple. So I guess I have to use the option --critical-status to check that return code is 200. This gave me the following command
that returns : CRITICAL: 500 Internal Server Error | 'time'=0.692s;;;0; 'size'=25B;;;0;
so i’m not really sure what is going on with your check, try with --debug to see what the curl command is generating and what you ca see in the inner http response.
also, use --help and you can see for example :
Thank you for your quick reply and your recommendations. I was able to find the root issue.
Problem lies in my use of the option:
--http-peer-addr='my_web_page_url'
As I have a host serving different web URLs I though I could use http-peer-addr option to point to the URLs I wanted to test. But it turns out that I misunderstood the option the debug flag shows that only --hostname option is used to defined the tested URL.
To clarify, lets say I have a web site at myjob1.com and another web site myjob2.com both hosted on the same IP. In centreon I created a host myjob1.com with 2 checks one for myjob1.com and the other for myjob2.com using the -http-peer-addr option when I thought I was testing myjob2.com I was in fact testing myjob1.com.
I guess I will have to define a separated host to test myjob2.com or define a check command using a different variable than hostname for the URL.
Anyhow thanks to @christophe.niel-ACT for improving my knowledge of centreon.