Correct to follow the new alert declaration - reed-alert - Lightweight agentless alerting system for server
HTML git clone git://bitreich.org/reed-alert/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/reed-alert/
DIR Log
DIR Files
DIR Refs
DIR Tags
DIR README
DIR LICENSE
---
DIR commit 01a3f1cc34988cd7ad739d41186c4362ede1fdf8
DIR parent 439acf53f4c8be2665c3459055a57b3d03656fd8
HTML Author: Solene Rapenne <solene@perso.pw>
Date: Wed, 10 Jan 2018 20:17:50 +0100
Correct to follow the new alert declaration
Diffstat:
M config.lisp.sample | 15 +++++++--------
M example.lisp | 27 ++++++++++-----------------
2 files changed, 17 insertions(+), 25 deletions(-)
---
DIR diff --git a/config.lisp.sample b/config.lisp.sample
@@ -1,15 +1,14 @@
-(defvar *alerts*
- (list
- '(mail ("echo -n '" + "Problem with " function _ date _ params"' | mail -s alarm mail@isp.net"))
- '(sms ("/home/user/sms.sh '" date _ function _ params _ hostname "'"))
- '(available ("REMINDER" function params date hostname desc level os newline _ space result))
- '(void nil)))
-
(load "functions.lisp")
+(alert mail "echo -n 'Problem with %function% %date% %params%' | mail -s alarm mail@isp.net")
+(alert sms "/home/user/sms.sh '%date% %function% %params% %hostname%")
+(alert available-variables "REMINDER : %function% %params% %date% %hostname% %desc% %level% %os% %newline% %result%")
+(alert void "")
+
+
;; this is a comment
; this is also a comment
-(=> mail disk-usage (:path "/" :limit 90))
+(=> mail disk-usage (:path "/" :limit 90))
(=> mail service (:name "dovecot"))
(=> mail service (:name "httpd"))
DIR diff --git a/example.lisp b/example.lisp
@@ -1,16 +1,12 @@
-(defvar *alerts*
- (list
- '(dont-use-it ("REMINDER" function params date hostname desc level os newline _ space result))
- '(void nil)
- '(mail nil)
- '(sms ("echo -n '" date _ function " CRITICAL " hostname "' | curl http://somewebservice"))
- '(mail ("echo -n '" date _ hostname " had problem on " function newline params _ " values " result newline
- desc "' | mail -s '[Error] " function " - " hostname "' foo@bar.com"))
- '(with-plus ("echo -n '" + date + _ + hostname + " had problem on " + function + newline + params + newline
- + desc + "' | mail -s '[Error] " + function + " - " + hostname + "' foo@bar.com"))))
+(load "functions.lisp")
+(alert dont-use-it "REMINDER %function% %params% %date% %hostname% %desc% %level% %os% %newline% _ %space% %result%")
+(alert void "")
+(alert mail "")
+(alert sms "echo -n '%date% %function% CRITICAL on %hostname%' | curl http://somewebservice")
+;(alert mail "echo -n '%date% %hostname% had problem on %function% %newline% %params% values %result% %newline%
+; %desc%' | mail -s '[Error] %function% - %hostname%' foo@bar.com")
-(load "functions.lisp")
;; check if used percent :path partition is more than :limit
(=> mail disk-usage (:path "/" :limit 90))
@@ -52,14 +48,11 @@
(=> void command (:command "echo hello")) ;; success
(=> void command (:command "ls /non-existent-file")) ;; fail
-(load "probes-extended.lisp")
-
;; check if web page :url answer under :limit
-(=> void http-response-time (:url "http://google.fr/" :limit 10))
+(=> void command (:command "curl -m 10 http://google.fr/"))
;; check if the web page :url contains the text regex :pattern
-(=> void http-text-present (:url "http://google.fr/" :pattern "html"))
-(=> void http-text-present (:url "http://google.fr/" :pattern "hello")) ;; error
-
+(=> void command (:command "curl http://google.fr/ | grep html"))
+(=> void command (:command "curl http://google.fr/ | grep hello")) ;; error
(quit)