diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 11:32:39 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 11:32:39 +0000 |
commit | 56ae875861ab260b80a030f50c4aff9f9dc8fff0 (patch) | |
tree | 531412110fc901a5918c7f7442202804a83cada9 /test/livestatus/run_queries | |
parent | Initial commit. (diff) | |
download | icinga2-upstream.tar.xz icinga2-upstream.zip |
Adding upstream version 2.14.2.upstream/2.14.2upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/livestatus/run_queries')
-rwxr-xr-x | test/livestatus/run_queries | 26 |
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 |