Page 1 of 1

Website URL / URL Content

Posted: Mon Jul 10, 2017 12:14 pm
by jabi27
Hi,

I have created a website monitoring and expecting some content.

The website URL:

https://ws03.bpi.stil.dk/cxf/NationaleTestService/Ping

is returning (in the browser)
"
{
"status": "op"
}
"
And I write [ "status": "op" ] in the "Content String To Expect"

It becomes

"check_xi_service_http!-s " {"status":"op"}" -f ok -I 195.231.237.228 -u '/cxf/NationaleTestService/Ping' -S -p 443"

But Nagios returns a "not found" The string is there...

HTTP CRITICAL: HTTP/1.1 200 OK - string ' {status:op}' not found on 'https://ws03.bpi.stil.dk:443/cxf/Nation ... rvice/Ping' - 301 bytes in 0.074 second response time

What am I missing?

Best regards

/Jan

Re: Website URL / URL Content

Posted: Mon Jul 10, 2017 12:26 pm
by mcapra
You may need to escape the " marks for Bash. Give this a try in the "Content String To Expect" field:

Code: Select all

\"status\":\"op\"
Double check any and all SPACES, RETURNS, and LINE-BREAKS that may or may not exist in the page's content returned. They are very relevant.

For the following page:

Code: Select all

[root@nagios libexec]# curl -XGET http://prod00:9200
{
  "status" : 200,
  "name" : "prod00",
  "cluster_name" : "prod",
  "version" : {
    "number" : "1.7.1",
    "build_hash" : "b88f43fc40b0bcd7f173a1f9ee2e97816de80b19",
    "build_timestamp" : "2015-07-29T09:54:16Z",
    "build_snapshot" : false,
    "lucene_version" : "4.10.4"
  },
  "tagline" : "You Know, for Search"
}
This seems to work fine:

Code: Select all

[root@nagios libexec]# /usr/local/nagios/libexec/check_http -H prod00 -p 9200 -s "\"status\" : 200"
HTTP OK: HTTP/1.1 200 OK - 416 bytes in 0.006 second response time |time=0.005597s;;;0.000000 size=416B;;;0

Re: Website URL / URL Content

Posted: Mon Jul 10, 2017 1:31 pm
by jabi27
Thanks :-)

The ecape did the job.

/Jan