2016-10-07 10:25:49 +00:00
|
|
|
(defvar *alerts*
|
|
|
|
(list
|
2016-10-10 18:35:24 +00:00
|
|
|
'(dont-use-it ("REMINDER" function params date hostname desc level os newline _ space result))
|
2016-10-07 10:25:49 +00:00
|
|
|
'(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
|
2016-10-10 18:35:24 +00:00
|
|
|
desc "' | mail -s '[Error] " function " - " hostname "' foo@bar.com"))
|
2016-10-07 10:25:49 +00:00
|
|
|
'(with-plus ("echo -n '" + date + _ + hostname + " had problem on " + function + newline + params + newline
|
2016-10-10 18:35:24 +00:00
|
|
|
+ desc + "' | mail -s '[Error] " + function + " - " + hostname + "' foo@bar.com"))))
|
2016-10-07 10:25:49 +00:00
|
|
|
|
2016-10-14 12:21:24 +00:00
|
|
|
|
2016-10-07 10:25:49 +00:00
|
|
|
(load "functions.lisp")
|
|
|
|
|
|
|
|
;; check if used percent :path partition is more than :limit
|
|
|
|
(=> mail disk-usage (:path "/" :limit 90))
|
|
|
|
(=> mail disk-usage (:path "/usr" :limit 85))
|
|
|
|
(=> mail disk-usage (:path "/tmp" :limit 1)) ;; failure
|
|
|
|
|
|
|
|
;; check if :path file exists
|
|
|
|
(=> mail file-exists (:path "/bsd.rd" :desc "OpenBSD kernel /bsd.rd"))
|
|
|
|
(=> void file-exists (:path "/non-existant-file")) ;; failure file not found
|
|
|
|
|
|
|
|
;; check if :path file exists and has been updated since :limit minutes
|
|
|
|
(=> void file-updated (:path "/var/log/messages" :limit 400))
|
|
|
|
(=> mail file-updated (:path "/bsd.rd" :limit 1 :desc "OpenBSD kernel")) ;; failure
|
|
|
|
|
|
|
|
;; check if :path pid file process is running
|
|
|
|
(=> mail pid-running (:path "/var/run/xdm.pid" :desc "XDM pid"))
|
|
|
|
(=> mail pid-running (:path "/home/user/test.pid")) ;; failure
|
|
|
|
|
|
|
|
;; check if number of processes on the system is more than :limit
|
|
|
|
(=> mail number-of-processes (:limit 200))
|
|
|
|
(=> mail number-of-processes (:limit 1)) ;; failure
|
|
|
|
|
2017-01-26 16:38:06 +00:00
|
|
|
;; check if service is running
|
|
|
|
(=> mail service (:name "httpd"))
|
|
|
|
(=> mail service (:name "ospfd")) ;; failure : not started
|
|
|
|
(=> mail service (:name "unknown")) ;; failure : not known
|
|
|
|
|
2016-10-07 10:25:49 +00:00
|
|
|
;; check if load average on (1/5/15) minutes is more than :limit
|
|
|
|
(=> mail load-average-1 (:limit 4))
|
2017-01-26 13:56:04 +00:00
|
|
|
;;(=> mail load-average-5 (:limit 2))
|
|
|
|
;;(=> mail load-average-15 (:limit 1))
|
2016-10-07 10:25:49 +00:00
|
|
|
(=> mail load-average-1 (:limit 0.2)) ;; should trigger error
|
|
|
|
|
|
|
|
;; check if :host host is reachable
|
2017-01-26 13:56:04 +00:00
|
|
|
;;(=> mail ping (:host "8.8.8.8" :desc "Google DNS"))
|
|
|
|
;;(=> void ping (:host "127.40.30.21" :desc "Certainly not used address")) ;; fail time out
|
2016-10-07 10:25:49 +00:00
|
|
|
|
|
|
|
;; check if :command command return 0 (success) or something else (error)
|
|
|
|
(=> void command (:command "echo hello")) ;; success
|
|
|
|
(=> void command (:command "ls /non-existent-file")) ;; fail
|
|
|
|
|
2016-10-14 12:21:24 +00:00
|
|
|
(load "probes-extended.lisp")
|
|
|
|
|
|
|
|
;; check if web page :url answer under :limit
|
|
|
|
(=> void http-response-time (:url "http://google.fr/" :limit 10))
|
|
|
|
|
2017-01-26 16:38:06 +00:00
|
|
|
;; check if the web page :url contains the text regex :pattern
|
2016-10-14 12:21:24 +00:00
|
|
|
(=> void http-text-present (:url "http://google.fr/" :pattern "html"))
|
|
|
|
(=> void http-text-present (:url "http://google.fr/" :pattern "hello")) ;; error
|
|
|
|
|
|
|
|
|
2016-10-07 10:25:49 +00:00
|
|
|
(quit)
|