Separate desc from params in the output - 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 5d2fda3df3c639f75191ede0f4180f7992f90c79
DIR parent fd80ed68f6fbb92860af43c7bb0542c5e90022fe
HTML Author: Solene Rapenne <solene@perso.pw>
Date: Thu, 11 Jul 2019 09:24:28 +0200
Separate desc from params in the output
Diffstat:
M extras/output2html.sh | 14 ++++++++++----
M functions.lisp | 16 ++++++++++++++--
2 files changed, 24 insertions(+), 6 deletions(-)
---
DIR diff --git a/extras/output2html.sh b/extras/output2html.sh
@@ -4,9 +4,11 @@ awk -F'\t' \
-v alert=1 \
-v check=1 \
-v params=1 \
+ -v desc=1 \
-v previousstate=1 \
-v currentstate=1 \
- -v triggerstate=1 '
+ -v triggerstate=1 \
+ -v count=1 '
BEGIN {
print "<html>"
@@ -16,9 +18,11 @@ BEGIN {
if(alert) { print "<th>Alert</th>" }
if(check) { print "<th>check</th>" }
if(params) { print "<th>params</th>" }
+ if(desc) { print "<th>description</th>" }
if(previousstate) { print "<th>previous-state</th>" }
if(currentstate) { print "<th>current-state</th>" }
if(triggerstate) { print "<th>trigger-state</th>" }
+ if(count) { print "<th>count</th>" }
print "</tr></thead><tbody>"
}
@@ -27,9 +31,11 @@ BEGIN {
if(alert) { print "<td>"$1"</td>" }
if(check) { print "<td>"$2"</td>" }
if(params) { print "<td>"$3"</td>" }
- if(previousstate) { print "<td>"$4"</td>" }
- if(currentstate) { print "<td>"$5"</td>" }
- if(triggerstate) { print "<td>"$6"</td>" }
+ if(desc) { print "<td>"$4"</td>" }
+ if(previousstate) { print "<td>"$5"</td>" }
+ if(currentstate) { print "<td>"$6"</td>" }
+ if(triggerstate) { print "<td>"$7"</td>" }
+ if(count) { print "<td>"$8"</td>" }
print "</tr>"
}
DIR diff --git a/functions.lisp b/functions.lisp
@@ -148,8 +148,20 @@
(format stream-out "~a~%~a~%" (+ 1 tries) params))
nil))
- (format t "~a ~A ~A ~A ~A ~A ~A~%"
- level fonction (format nil "~{~A ~}" params)
+ (format t "~a ~A ~A ~A ~A ~A ~A ~A~%"
+ level fonction
+ (let ((desc-pos (position :desc params)))
+ (if desc-pos
+ (remove nil
+ (loop for i in params
+ counting t into j
+ collect
+ (when (not (or
+ (= j (+ 1 desc-pos))
+ (= j (+ 2 desc-pos))))
+ i)))
+ params))
+ (getf params :desc "")
(if previous-state "SUCCESS" "ERROR")
(if current-state "SUCCESS" "ERROR")
trigger-state