Page 1 of 1

http check html display

Posted: Fri Mar 06, 2020 10:44 am
by nickanderson1982
How would I check a url and the html displayed?

I need to check the following:
https://prod.xxxxx.com/rest/v1.0/CreditCard/Status
https://prod1.yyyyy.com/rest/v1.0/CreditCard/Status

For a successful attempt the html displayed would be:
{"Result":{"ResultCode":0,"ResultDetail":"Up"}}

How would I write this into a .cfg?

Re: http check html display

Posted: Fri Mar 06, 2020 12:17 pm
by jdunitz
The "check_http_content" plugin should do what you want:
https://exchange.nagios.org/directory/P ... nt/details

Code: Select all

define command {
    command_name    CheckHTTPContent
    command_line    $USER1$/check_http_content -U $ARG1$ -m $ARG2$ -t 10
}


define host {
    host_name        localhost
    use              linux-server
    alias            localhost
    address          127.0.0.1
    check_command    CheckHTTPContent!http://localhost/sdf.html!{"Result":{"ResultCode":0,"ResultDetail":"Up"}}!!!!!!
    register         1
}
Hope that helps!

--Jeffrey