O'Reilly logo

CFEngine 3 Beginner's Guide by Rajneesh

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action - monitoring a web server

  1. The promise file given next may be used to monitor a web server; you may save the following code snippet in the file webmonitor.cf:
    body common control { bundlesequence => { "web_monitor" }; inputs => { "cfengine_stdlib.cf" }; } bundle agent web_monitor { vars: comment => "This is used to store the response of the HTTP request in a variable", "mywebserver" string => readtcp("myweb3.system.com","80","GET /index.txt HTTP/1.1"); classes: comment => "compare the response of the HTTP request to a successful response", "webserver_ok" expression => regcmp("test successful","$(mywebserver)"); reports: webserver_ok:: comment => "Action if the above comparison returns TRUE", "Web server myweb3.system.com is working"; ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required