docker-compose-files/packetbeat_ek/kibana/beats-dashboards-1.0.1/load.sh

57 lines
1.1 KiB
Bash
Raw Normal View History

#!/bin/bash
if [ -z "$1" ]; then
ELASTICSEARCH=http://localhost:9200
else
ELASTICSEARCH=$1
fi
if [ -z "$2" ]; then
CURL=curl
else
CURL="curl --user $2"
fi
echo $CURL
DIR=dashboards
for file in $DIR/search/*.json
do
name=`basename $file .json`
echo "Loading search $name:"
$CURL -XPUT $ELASTICSEARCH/.kibana/search/$name \
-d @$file || exit 1
echo
done
for file in $DIR/visualization/*.json
do
name=`basename $file .json`
echo "Loading visualization $name:"
$CURL -XPUT $ELASTICSEARCH/.kibana/visualization/$name \
-d @$file || exit 1
echo
done
for file in $DIR/dashboard/*.json
do
name=`basename $file .json`
echo "Loading dashboard $name:"
$CURL -XPUT $ELASTICSEARCH/.kibana/dashboard/$name \
-d @$file || exit 1
echo
done
for file in $DIR/index-pattern/*.json
do
name=`basename $file .json`
printf -v escape "%q" $name
echo "Loading index pattern $escape:"
$CURL -XPUT $ELASTICSEARCH/.kibana/index-pattern/$escape \
-d @$file || exit 1
echo
done