From 0915b3ef56dfac3113cce55a59a5765dc94976be Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 28 Apr 2024 14:34:54 +0200 Subject: Adding upstream version 2.13.6. Signed-off-by: Daniel Baumann --- test/livestatus/run_queries | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100755 test/livestatus/run_queries (limited to 'test/livestatus/run_queries') 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 -- cgit v1.2.3