summaryrefslogtreecommitdiffstats
path: root/test/livestatus/run_queries
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 12:34:54 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 12:34:54 +0000
commit0915b3ef56dfac3113cce55a59a5765dc94976be (patch)
treea8fea11d50b4f083e1bf0f90025ece7f0824784a /test/livestatus/run_queries
parentInitial commit. (diff)
downloadicinga2-upstream.tar.xz
icinga2-upstream.zip
Adding upstream version 2.13.6.upstream/2.13.6upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-xtest/livestatus/run_queries26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/livestatus/run_queries b/test/livestatus/run_queries
new file mode 100755
index 0000000..c80aa59
--- /dev/null
+++ b/test/livestatus/run_queries
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+NC=`which nc`
+LOCALSTATEDIR=`icinga2 variable get LocalStateDir`
+LIVESTATUSSOCKET="$LOCALSTATEDIR/run/icinga2/cmd/livestatus"
+LIVESTATUSHOST="127.0.0.1"
+LIVESTATUSPORT="6558"
+LIVESTATUSQUERIES="./queries"
+
+LIVESTATUSTABLE=$1
+
+echo -e "Querying Livestatus socket: $LIVESTATUSSOCKET"
+
+if [ -n "$LIVESTATUSTABLE" ]; then
+ cat "$LIVESTATUSTABLE"
+ (cat "$LIVESTATUSTABLE"; sleep 1) | $NC -U $LIVESTATUSSOCKET
+else
+
+ echo -e "Looking into $LIVESTATUSQUERIES\n"
+ for q in $(find $LIVESTATUSQUERIES -type f)
+ do
+ cat $q
+ (cat $q; sleep 1) | $NC -U $LIVESTATUSSOCKET
+ echo -e "================================\n\n"
+ done
+fi