Correct to follow the new alert declaration

This commit is contained in:
Solene Rapenne 2018-01-10 20:17:50 +01:00
parent 439acf53f4
commit 01a3f1cc34
2 changed files with 18 additions and 26 deletions

View File

@ -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"))

View File

@ -1,17 +1,13 @@
(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")
;; check if used percent :path partition is more than :limit
(=> mail disk-usage (:path "/" :limit 90))
(=> mail disk-usage (:path "/usr" :limit 85))
@ -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)