2013-07-30 13:07:13 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2014-11-04 16:44:45 +01:00
|
|
|
NC=`which nc`
|
2015-10-22 15:48:53 +02:00
|
|
|
LOCALSTATEDIR=`icinga2 variable get LocalStateDir`
|
|
|
|
LIVESTATUSSOCKET="$LOCALSTATEDIR/run/icinga2/cmd/livestatus"
|
2013-10-29 13:44:43 +01:00
|
|
|
LIVESTATUSHOST="127.0.0.1"
|
2013-07-30 13:07:13 +02:00
|
|
|
LIVESTATUSPORT="6558"
|
|
|
|
LIVESTATUSQUERIES="./queries"
|
|
|
|
|
|
|
|
LIVESTATUSTABLE=$1
|
|
|
|
|
|
|
|
if [ -n "$LIVESTATUSTABLE" ]; then
|
2013-10-29 13:44:43 +01:00
|
|
|
cat "$LIVESTATUSTABLE"
|
2014-11-04 16:44:45 +01:00
|
|
|
(cat "$LIVESTATUSTABLE"; sleep 1) | $NC -U $LIVESTATUSSOCKET
|
2013-07-30 13:07:13 +02:00
|
|
|
else
|
|
|
|
|
|
|
|
echo -e "Looking into $LIVESTATUSQUERIES\n"
|
|
|
|
for q in $(find $LIVESTATUSQUERIES -type f)
|
|
|
|
do
|
|
|
|
cat $q
|
2014-11-04 16:44:45 +01:00
|
|
|
(cat $q; sleep 1) | $NC -U $LIVESTATUSSOCKET
|
2013-07-30 13:07:13 +02:00
|
|
|
echo -e "================================\n\n"
|
|
|
|
done
|
|
|
|
fi
|