i[DEV] Add extended probes - reed-alert - Lightweight agentless alerting system for server Err bitreich.org 70
hgit clone git://bitreich.org/reed-alert/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/reed-alert/ URL:git://bitreich.org/reed-alert/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/reed-alert/ bitreich.org 70
1Log /scm/reed-alert/log.gph bitreich.org 70
1Files /scm/reed-alert/files.gph bitreich.org 70
1Refs /scm/reed-alert/refs.gph bitreich.org 70
1Tags /scm/reed-alert/tag bitreich.org 70
1README /scm/reed-alert/file/README.gph bitreich.org 70
1LICENSE /scm/reed-alert/file/LICENSE.gph bitreich.org 70
i--- Err bitreich.org 70
1commit 6e496d0ce582d7db769a93aa5f582321dc089894 /scm/reed-alert/commit/6e496d0ce582d7db769a93aa5f582321dc089894.gph bitreich.org 70
1parent 84cc333bfe3d62aff0d2ff899f58b034ac2ca542 /scm/reed-alert/commit/84cc333bfe3d62aff0d2ff899f58b034ac2ca542.gph bitreich.org 70
hAuthor: solene rapenne <solene@dataswamp.org> URL:mailto:solene@dataswamp.org bitreich.org 70
iDate: Fri, 14 Oct 2016 14:21:24 +0200 Err bitreich.org 70
i Err bitreich.org 70
i[DEV] Add extended probes Err bitreich.org 70
i Err bitreich.org 70
iDiffstat: Err bitreich.org 70
i M example.lisp | 11 +++++++++++ Err bitreich.org 70
i A probes-extended.lisp | 23 +++++++++++++++++++++++ Err bitreich.org 70
i Err bitreich.org 70
i2 files changed, 34 insertions(+), 0 deletions(-) Err bitreich.org 70
i--- Err bitreich.org 70
1diff --git a/example.lisp b/example.lisp /scm/reed-alert/file/example.lisp.gph bitreich.org 70
i@@ -9,6 +9,7 @@ Err bitreich.org 70
i '(with-plus ("echo -n '" + date + _ + hostname + " had problem on " + function + newline + params + newline Err bitreich.org 70
i + desc + "' | mail -s '[Error] " + function + " - " + hostname + "' foo@bar.com")))) Err bitreich.org 70
i Err bitreich.org 70
i+ Err bitreich.org 70
i (load "functions.lisp") Err bitreich.org 70
i Err bitreich.org 70
i ;; check if used percent :path partition is more than :limit Err bitreich.org 70
i@@ -47,4 +48,14 @@ Err bitreich.org 70
i (=> void command (:command "echo hello")) ;; success Err bitreich.org 70
i (=> void command (:command "ls /non-existent-file")) ;; fail Err bitreich.org 70
i Err bitreich.org 70
i+(load "probes-extended.lisp") Err bitreich.org 70
i+ Err bitreich.org 70
i+;; check if web page :url answer under :limit Err bitreich.org 70
i+(=> void http-response-time (:url "http://google.fr/"; :limit 10)) Err bitreich.org 70
i+ Err bitreich.org 70
i+;; check if the web page :url contains the text :pattern Err bitreich.org 70
i+(=> void http-text-present (:url "http://google.fr/"; :pattern "html")) Err bitreich.org 70
i+(=> void http-text-present (:url "http://google.fr/"; :pattern "hello")) ;; error Err bitreich.org 70
i+ Err bitreich.org 70
i+ Err bitreich.org 70
i (quit) Err bitreich.org 70
1diff --git a/probes-extended.lisp b/probes-extended.lisp /scm/reed-alert/file/probes-extended.lisp.gph bitreich.org 70
i@@ -0,0 +1,23 @@ Err bitreich.org 70
i+(ql:quickload :drakma) Err bitreich.org 70
i+(ql:quickload :cl-ppcre) Err bitreich.org 70
i+ Err bitreich.org 70
i+(create-probe Err bitreich.org 70
i+ http-response-time Err bitreich.org 70
i+ (let ((begin (get-universal-time))) Err bitreich.org 70
i+ (let ((result (ignore-errors Err bitreich.org 70
i+ (drakma:http-request (getf params :url) :connection-timeout (getf params :timeout 3))))) Err bitreich.org 70
i+ (if result Err bitreich.org 70
i+ (let ((elapsed-time (- (get-universal-time) begin))) Err bitreich.org 70
i+ (if (< elapsed-time (getf params :limit)) Err bitreich.org 70
i+ t Err bitreich.org 70
i+ (list nil elapsed-time))) Err bitreich.org 70
i+ (list nil "http connection failure"))))) Err bitreich.org 70
i+ Err bitreich.org 70
i+(create-probe Err bitreich.org 70
i+ http-text-present Err bitreich.org 70
i+ (ignore-errors Err bitreich.org 70
i+ (let ((result (drakma:http-request (getf params :url) :connection-timeout (getf params :timeout 3)))) Err bitreich.org 70
i+ (if (cl-ppcre:scan (getf params :pattern) result) Err bitreich.org 70
i+ t Err bitreich.org 70
i+ (list nil "pattern not found"))))) Err bitreich.org 70
i+ Err bitreich.org 70
.
Response:
text/plain