mirror of git://bitreich.org/reed-alert
[FIX] Return value of disk-used was a disk-used string instead of the variable
This commit is contained in:
parent
c3f594da02
commit
9b5e9bd4a8
24
probes.lisp
24
probes.lisp
|
@ -1,6 +1,10 @@
|
|||
(defmacro create-probe(name &body code)
|
||||
`(progn (defun ,name(params) ,@code)))
|
||||
|
||||
(defun get-file-size(path)
|
||||
(with-open-file (stream path)
|
||||
(and stream (file-length path))))
|
||||
|
||||
(defun command-return-code(command)
|
||||
(let ((code (nth-value 2 (uiop:run-program command :ignore-error-status t))))
|
||||
(if (= 0 code)
|
||||
|
@ -44,7 +48,7 @@
|
|||
percent-character-pos))))
|
||||
(if (< used-disk (getf params :limit))
|
||||
t
|
||||
(list nil "used-disk"))))))
|
||||
(list nil used-disk))))))
|
||||
|
||||
(defun system-load(time)
|
||||
(read-from-string
|
||||
|
@ -75,6 +79,24 @@
|
|||
t
|
||||
(list nil load))))
|
||||
|
||||
(create-probe
|
||||
file-more-than
|
||||
(if (probe-file (getf params :path))
|
||||
(let ((result (get-file-size (getf params :path))))
|
||||
(if (< result (getf params :limit))
|
||||
t
|
||||
(list nil result)))
|
||||
"file not found"))
|
||||
|
||||
(create-probe
|
||||
file-less-than
|
||||
(if (probe-file (getf params :path))
|
||||
(let ((result (get-file-size (getf params :path))))
|
||||
(if (> result (getf params :limit))
|
||||
t
|
||||
(list nil result)))
|
||||
"file not found"))
|
||||
|
||||
(create-probe
|
||||
command
|
||||
(command-return-code (getf params :command)))
|
||||
|
|
Loading…
Reference in New Issue