-
Notifications
You must be signed in to change notification settings - Fork 31
/
install.sh
executable file
·111 lines (92 loc) · 2.44 KB
/
install.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#!/bin/bash
INSTALL_DIR=$HOME/elk
LOGSTASH_PATH=logstash-1.4.2
LOGSTASH_BINARY=$LOGSTASH_PATH.tar.gz
ES_PATH=elasticsearch-1.4.4
ES_BINARY=$ES_PATH.tar.gz
NFL_DATA_FILE_NAME=2012_nfl_pbp_data.csv
NFL_DATA_BINARY=2012_nfl_pbp_data.csv.gz
KIBANA_VERSION=kibana-4.0.1
KIBANA_OS=darwin-x64
KIBANA_BINARY=$KIBANA_VERSION-$KIBANA_OS
echo Installing ELK stack into $INSTALL_DIR
mkdir -p $INSTALL_DIR
cp twitter.conf $INSTALL_DIR
cp nfl.conf $INSTALL_DIR
cp week-by-week.json $INSTALL_DIR
cp $NFL_DATA_BINARY $INSTALL_DIR
cp populate_kibana.sh $INSTALL_DIR
cd $INSTALL_DIR
if test -s $LOGSTASH_BINARY
then
echo Logstash already Downloaded
else
echo Downloading logstash 1.4.2
curl -O https://download.elasticsearch.org/logstash/logstash/$LOGSTASH_BINARY
fi
if test -s $ES_BINARY
then
echo Elasticsearch already Downloaded
else
echo Downloading $ES_PATH
curl -O https://download.elasticsearch.org/elasticsearch/elasticsearch/$ES_BINARY
fi
echo Downloaded... Now installing
echo Unpacking logstash
tar zxf $LOGSTASH_BINARY
echo Unpacking Elasticsearch
tar zxf $ES_BINARY
pwd
echo Unpacking nfl dataset
gunzip -f $NFL_DATA_BINARY
cd $ES_PATH
if [ -d "plugins/marvel" ];
then
echo Marvel already installed
else
echo Installing Marvel latest
bin/plugin -i elasticsearch/marvel/latest
fi
if [ -d "plugins/kopf" ];
then
echo kopf already installed
else
echo Installing kopf latest
bin/plugin -i lmenezes/elasticsearch-kopf
fi
echo Starting Elasticsearch to run in the background.
bin/elasticsearch -d --cluster.name=es_demo --number_of_shards=1 --number_of_replicas=0 --network.host=localhost
cd ..
pwd
if test -s $KIBANA_BINARY
then
echo Kibana already Downloaded
else
echo Downloading Kibana Latest
curl -O https://download.elasticsearch.org/kibana/kibana/$KIBANA_BINARY.tar.gz
fi
if [ -d $KIBANA_BINARY ];
then
echo Kibana already installed
else
echo Installing Kibana latest
tar zxvf $KIBANA_BINARY.tar.gz
fi
./$KIBANA_BINARY/bin/kibana &
#cp ../week-by-week.json plugins/kibana/_site/app/dashboards/
pwd
./populate_kibana.sh
pwd
cd $LOGSTASH_PATH
echo loading nfl data using logstash
pwd
bin/logstash -f ../nfl.conf < ../$NFL_DATA_FILE_NAME
echo Now browse to:
echo http://localhost:9200/_plugin/marvel
echo or
echo http://localhost:9200/_plugin/kopf
echo or
echo http://localhost:5601
echo or
echo http://localhost:5601/#/dashboard/NFL-2012?_g=%28time:%28from:%272012-08-31T18:35:39.050Z%27,mode:absolute,to:%272013-02-03T19:50:39.050Z%27%29%29
exit