2018-01-17 19:38:54 +00:00
|
|
|
(alert dont-use-it "REMINDER %state% %function% %params% %date% %hostname% %desc% %level% %os% %newline% _ %space% %result%")
|
2018-01-11 14:03:46 +00:00
|
|
|
(alert empty "")
|
2018-01-10 19:17:50 +00:00
|
|
|
(alert mail "")
|
2018-01-17 19:38:54 +00:00
|
|
|
(alert peroket "echo '%state% problem at %date% with %function% %params% : %result%'")
|
2018-01-10 19:17:50 +00:00
|
|
|
(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")
|
2016-10-14 12:21:24 +00:00
|
|
|
|
2016-10-07 10:25:49 +00:00
|
|
|
|
|
|
|
;; check if used percent :path partition is more than :limit
|
2018-01-11 14:03:46 +00:00
|
|
|
(=> peroket disk-usage :path "/" :limit 90)
|
|
|
|
(=> peroket disk-usage :path "/usr" :limit 85)
|
|
|
|
(=> peroket disk-usage :path "/tmp" :limit 0) ;; failure
|
2016-10-07 10:25:49 +00:00
|
|
|
|
|
|
|
;; check if :path file exists
|
2018-01-17 19:38:54 +00:00
|
|
|
(=> mail file-exists :path "/bsd.rd" :desc "OpenBSD kernel /bsd.rd")
|
2018-01-22 07:09:53 +00:00
|
|
|
(=> empty file-exists :path "/non-existant-file" :try 3) ;; failure file not found
|
2016-10-07 10:25:49 +00:00
|
|
|
|
|
|
|
;; check if :path file exists and has been updated since :limit minutes
|
2018-01-11 14:03:46 +00:00
|
|
|
(=> empty file-updated :path "/var/log/messages" :limit 400)
|
|
|
|
(=> mail file-updated :path "/bsd.rd" :limit 1 :desc "OpenBSD kernel") ;; failure
|
2019-07-11 08:06:26 +00:00
|
|
|
(=> mail file-updated :path "/tmp/reed-alert.txt" :limit 10)
|
2016-10-07 10:25:49 +00:00
|
|
|
|
|
|
|
;; check if :path pid file process is running
|
2018-01-11 14:03:46 +00:00
|
|
|
(=> mail pid-running :path "/var/run/xdm.pid" :desc "XDM pid")
|
|
|
|
(=> mail pid-running :path "/home/user/test.pid") ;; failure
|
2016-10-07 10:25:49 +00:00
|
|
|
|
|
|
|
;; check if number of processes on the system is more than :limit
|
2018-01-11 14:03:46 +00:00
|
|
|
(=> mail number-of-processes :limit 200)
|
|
|
|
(=> mail number-of-processes :limit 1) ;; failure
|
2016-10-07 10:25:49 +00:00
|
|
|
|
2017-01-26 16:38:06 +00:00
|
|
|
;; check if service is running
|
2019-01-16 14:19:30 +00:00
|
|
|
(=> mail service :name "httpd" :reminder 2) ;; reminds every 2 check when it's failing
|
2018-01-11 14:03:46 +00:00
|
|
|
(=> mail service :name "ospfd") ;; failure : not started
|
|
|
|
(=> mail service :name "unknown") ;; failure : not known
|
2017-01-26 16:38:06 +00:00
|
|
|
|
2016-10-07 10:25:49 +00:00
|
|
|
;; check if load average on (1/5/15) minutes is more than :limit
|
2018-01-11 14:03:46 +00:00
|
|
|
(=> mail load-average-1 :limit 4)
|
|
|
|
;;(=> mail load-average-5 :limit 2)
|
|
|
|
;;(=> mail load-average-15 :limit 1)
|
|
|
|
(=> mail load-average-1 :limit 0.2) ;; should trigger error
|
2016-10-07 10:25:49 +00:00
|
|
|
|
|
|
|
;; check if :host host is reachable
|
2018-01-11 14:03:46 +00:00
|
|
|
;;(=> mail ping :host "8.8.8.8" :desc "Google DNS")
|
|
|
|
;;(=> empty ping :host "127.40.30.21" :desc "Certainly not used address") ;; fail time out
|
|
|
|
(loop for host in (list "8.8.8.8" "8.8.4.4" "127.0.0.1")
|
|
|
|
do
|
|
|
|
(=> empty ping :host host))
|
2016-10-07 10:25:49 +00:00
|
|
|
|
|
|
|
;; check if :command command return 0 (success) or something else (error)
|
2018-01-11 14:03:46 +00:00
|
|
|
(=> empty command :command "echo hello") ;; success
|
|
|
|
(=> empty command :command "ls /non-existent-file") ;; fail
|
2016-10-07 10:25:49 +00:00
|
|
|
|
2016-10-14 12:21:24 +00:00
|
|
|
;; check if web page :url answer under :limit
|
2018-01-11 14:03:46 +00:00
|
|
|
(=> empty command :command "curl -m 10 http://google.fr/")
|
2016-10-14 12:21:24 +00:00
|
|
|
|
2018-10-20 18:28:20 +00:00
|
|
|
;; check if a certificate is still valid within a time range
|
|
|
|
(=> mail ssl-expiration :host "google.fr" :seconds 1296000)
|
|
|
|
(=> mail ssl-expiration :host "freenode.net" :seconds (* 7 24 60 60))
|
|
|
|
(=> mail ssl-expiration :host "freenode.net" :seconds 1296000 :port 6697)
|
|
|
|
|
2019-07-11 08:06:26 +00:00
|
|
|
;; update a file modification time
|
|
|
|
(=> mail write-to-file :path "/tmp/reed-alert.txt")
|
|
|
|
|
2018-01-22 07:09:53 +00:00
|
|
|
;; 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))))
|
|
|
|
|
2017-01-26 16:38:06 +00:00
|
|
|
;; check if the web page :url contains the text regex :pattern
|
2018-01-22 07:09:53 +00:00
|
|
|
(=> 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
|
2016-10-14 12:21:24 +00:00
|
|
|
|