New script converting tab separated output to html - 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 5bd1f20ca169f2b2b2ee51b4167e1007a782f7e3
DIR parent e6d5e1bcf78191f5c5e8810564033eab29f7f686
HTML Author: Solene Rapenne <solene@perso.pw>
Date: Tue, 9 Jul 2019 09:06:19 +0200
New script converting tab separated output to html
Diffstat:
A extras/output2html.sh | 40 +++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+), 0 deletions(-)
---
DIR diff --git a/extras/output2html.sh b/extras/output2html.sh
@@ -0,0 +1,40 @@
+#!/bin/sh
+
+awk -F'\t' \
+ -v alert=1 \
+ -v check=1 \
+ -v params=1 \
+ -v previousstate=1 \
+ -v currentstate=1 \
+ -v triggerstate=1 '
+
+BEGIN {
+ print "<html>"
+
+ print "<body>"
+ print "<table><thead><tr>"
+ if(alert) { print "<th>Alert</th>" }
+ if(check) { print "<th>check</th>" }
+ if(params) { print "<th>params</th>" }
+ if(previousstate) { print "<th>previous-state</th>" }
+ if(currentstate) { print "<th>current-state</th>" }
+ if(triggerstate) { print "<th>trigger-state</th>" }
+ print "</tr></thead><tbody>"
+}
+
+{
+ print "<tr>"
+ 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>" }
+ print "</tr>"
+
+}
+
+END {
+ print "</tbody></table>"
+ print "</body></html>"
+}'