diff --git a/example.lisp b/example.lisp index 4230a34..db984aa 100644 --- a/example.lisp +++ b/example.lisp @@ -16,7 +16,7 @@ ;; check if :path file exists (=> mail file-exists :path "/bsd.rd" :desc "OpenBSD kernel /bsd.rd") -(=> empty file-exists :path "/non-existant-file" :try 1) ;; failure file not found +(=> empty file-exists :path "/non-existant-file" :try 3) ;; failure file not found ;; check if :path file exists and has been updated since :limit minutes (=> empty file-updated :path "/var/log/messages" :limit 400) @@ -55,8 +55,15 @@ ;; check if web page :url answer under :limit (=> empty command :command "curl -m 10 http://google.fr/") +;; we declare a new probe here +(create-probe + check-http-pattern + (command-return-code (format nil "curl ~a | grep -i ~a" + (getf params :url) (getf params :pattern)))) + ;; check if the web page :url contains the text regex :pattern -(=> empty command :command "curl http://google.fr/ | grep html") -(=> empty command :command "curl http://google.fr/ | grep hello") ;; error +(=> empty check-http-pattern :url "http://google.fr/" :pattern "html") +(=> empty check-http-pattern :url "http://127.0.0.1/" :pattern "HTML") +(=> empty check-http-pattern :url "http://google.fr/" :pattern "hello") ;; error (quit)