URI: 
       [FIX] Return value of disk-used was a disk-used string instead of the variable - 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 9b5e9bd4a8ff642b8a7408fc0f3e3dec11aa613d
   DIR parent c3f594da02f5b2a394be84fc115677d22cf75fbf
  HTML Author: solene rapenne <solene@dataswamp.org>
       Date:   Mon, 10 Oct 2016 20:35:49 +0200
       
       [FIX] Return value of disk-used was a disk-used string instead of the variable
       
       Diffstat:
         M probes.lisp                         |      24 +++++++++++++++++++++++-
       
       1 file changed, 23 insertions(+), 1 deletion(-)
       ---
   DIR diff --git a/probes.lisp b/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
       @@ -76,6 +80,24 @@
               (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)))