support services running check - 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 40f1c64c97fbe921f2c45392b3280ab12b4b77c9
DIR parent 71df6de766a87c6455bf293247d4dac72ff556e4
HTML Author: solene rapenne <solene@dataswamp.org>
Date: Thu, 26 Jan 2017 17:38:06 +0100
support services running check
Diffstat:
M example.lisp | 7 ++++++-
M probes.lisp | 8 ++++++++
2 files changed, 14 insertions(+), 1 deletion(-)
---
DIR diff --git a/example.lisp b/example.lisp
@@ -33,6 +33,11 @@
(=> mail number-of-processes (:limit 200))
(=> mail number-of-processes (:limit 1)) ;; failure
+;; check if service is running
+(=> mail service (:name "httpd"))
+(=> mail service (:name "ospfd")) ;; failure : not started
+(=> mail service (:name "unknown")) ;; failure : not known
+
;; check if load average on (1/5/15) minutes is more than :limit
(=> mail load-average-1 (:limit 4))
;;(=> mail load-average-5 (:limit 2))
@@ -52,7 +57,7 @@
;; check if web page :url answer under :limit
(=> void http-response-time (:url "http://google.fr/" :limit 10))
-;; check if the web page :url contains the text :pattern
+;; 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
DIR diff --git a/probes.lisp b/probes.lisp
@@ -18,6 +18,14 @@
(list nil "file not found")))
(create-probe
+ service
+ (command-return-code
+ #+openbsd
+ (list "rcctl" "check" (getf params :name))
+ #+(or freebsd linux)
+ (list "service" (getf params :name) "status")))
+
+(create-probe
pid-running
(if (probe-file (getf params :path))
(let ((pid-number (with-open-file (stream (getf params :path)) (read-line stream))))