summaryrefslogtreecommitdiffstats
path: root/lib/remote/report.sh
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2019-09-04 22:06:01 +0200
committerSuren A. Chilingaryan <csa@suren.me>2019-09-04 22:06:01 +0200
commit6db35a5230578e296d9f493b28e6330e22569c8f (patch)
tree86ccb8725d2ae1a779459e2d8c01087c07a37e58 /lib/remote/report.sh
parent78f3f37d3d8b213887fa6d47e32c5f9f05c0e299 (diff)
downloadconky-6db35a5230578e296d9f493b28e6330e22569c8f.tar.gz
conky-6db35a5230578e296d9f493b28e6330e22569c8f.tar.bz2
conky-6db35a5230578e296d9f493b28e6330e22569c8f.tar.xz
conky-6db35a5230578e296d9f493b28e6330e22569c8f.zip
Integrate also nagios-based monitoring here
Diffstat (limited to 'lib/remote/report.sh')
-rw-r--r--lib/remote/report.sh51
1 files changed, 51 insertions, 0 deletions
diff --git a/lib/remote/report.sh b/lib/remote/report.sh
new file mode 100644
index 0000000..e6766a4
--- /dev/null
+++ b/lib/remote/report.sh
@@ -0,0 +1,51 @@
+function simple_report {
+ local generator="$1"
+ local filter="${2:-cat}"
+ {
+ eval "$generator 12>/dev/fd/12 | $filter"
+ report=$(cat<&12)
+ } 12<<EOF
+EOF
+ wait
+}
+
+
+function short_report {
+ local generator="$1"
+ local filter="${2:-print_table | decorate_table}"
+
+ configure_palete "$palete"
+ simple_report "$generator" "$filter"
+ finish
+}
+
+
+function standart_report {
+ local generator="$1"
+ local filter="${2:-print_table | decorate_table}"
+
+ configure_palete "$palete"
+ simple_report "$generator" "$filter"
+
+ print "$report"
+ echo
+ finish
+}
+
+
+function report {
+ # Eval breaks output for some reason
+ case $report in
+ simple_report)
+ simple_report "$@"
+ ;;
+ short_report)
+ short_report "$@"
+ ;;
+ standart_report)
+ standart_report "$@"
+ ;;
+ default)
+ echo "Report is not implemented"
+ esac
+}