icinga2/test/livestatus/run_queries

25 lines
574 B
Plaintext
Raw Normal View History

#!/bin/bash
NC=`which nc`
LOCALSTATEDIR=`icinga2 variable get LocalStateDir`
LIVESTATUSSOCKET="$LOCALSTATEDIR/run/icinga2/cmd/livestatus"
2013-10-29 13:44:43 +01:00
LIVESTATUSHOST="127.0.0.1"
LIVESTATUSPORT="6558"
LIVESTATUSQUERIES="./queries"
LIVESTATUSTABLE=$1
if [ -n "$LIVESTATUSTABLE" ]; then
2013-10-29 13:44:43 +01:00
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