forked from StamusNetworks/KTS5
-
Notifications
You must be signed in to change notification settings - Fork 0
/
load.sh
executable file
·57 lines (46 loc) · 1.13 KB
/
load.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
set -e
set -x
cd $(dirname $0)
function get_name()
{
basename "$1" .json | sed -e 's/ /%20/g'
}
if [ -z "$1" ]; then
ELASTICSEARCH=http://127.0.0.1:9200
else
ELASTICSEARCH=$1
fi
if [ -z "$2" ]; then
CURL=curl
else
CURL="curl --user $2"
fi
echo $CURL
DIR=dashboards
#echo "Cleaning elasticsearch's kibana data"
#$CURL -H "Content-Type: application/json" -XDELETE $ELASTICSEARCH/.kibana/ ||:
for file in $DIR/search/*.json
do
name="$(get_name "$file")"
echo "Loading search $name:"
$CURL -H "Content-Type: application/json" -XPUT "$ELASTICSEARCH/.kibana/search/$name" \
-d "@$file" || exit 1
echo
done
for file in $DIR/visualization/*.json
do
name="$(get_name "$file")"
echo "Loading visualization $name:"
$CURL -H "Content-Type: application/json" -XPUT "$ELASTICSEARCH/.kibana/visualization/$name" \
-d "@$file" || exit 1
echo
done
for file in $DIR/dashboard/*.json
do
name="$(get_name "$file")"
echo "Loading dashboard $name:"
$CURL -H "Content-Type: application/json" -XPUT "$ELASTICSEARCH/.kibana/dashboard/$name" \
-d "@$file" || exit 1
echo
done