http check html display

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
nickanderson1982
Posts: 72
Joined: Wed Feb 06, 2019 3:22 pm

http check html display

Post 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?
User avatar
jdunitz
Posts: 235
Joined: Wed Feb 05, 2020 2:50 pm

Re: http check html display

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked