[smokeping-users] Curl probe that checks if string in page exists.

Vincent Hoffman-Kazlauskas vince at unsane.co.uk
Fri Sep 16 21:28:45 CEST 2016



On 16/09/2016 17:49, Nicola Ferrari (#554252) wrote:
> Hi everybody.
> 
> In our company we run a service provided by an external company on a
> website.
> 
> Just for testing purposes, I would like to check the status of that
> service by checking if the index page's body contains the "service
> unavailable" string (which is usually displayed when the service is down).
> 
> Using curl in shell environment, I achieve this by issuing this command:
> if  curl --silent https://www.example.com|grep -q "Service is down";
> then echo "NO"; else echo "YES"; fi
> 
> I would like to turn this into a Smokeping probe..
> I've just token a look at the docs, and found this:
> http://oss.oetiker.ch/smokeping/probe/Curl.en.html
> 
> Is this the best way to do that?
> Any suggestion/example about the probe's config?
> Shoud I use regexp?
Yes the curl probe should meet your needs.
The expect argument should be fine for what you want although I seem to
recall it may also match the headers not just the body.

The sample config I have is

*** Probes ***
+ Curl
# probe-specific variables
binary = /usr/local/bin/curl
step = 60
pings = 5
forks = 10
offset = 50%
timeout = 5
# a default for this target-specific variable
urlformat = http://%host%/

*** Targets ***

+ WEB
probe = Curl
menu = Web
title = Web (http)

++ TESTSITE
menu = Test website
title = test.site.co.uk via curl
host = test.site.net
expect = Hello world
urlformat = http://%host%/wordpress/?p=1



Hope thats useful
Vince
> 
> Thanks!
> Nick
> 
> 



More information about the smokeping-users mailing list