-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathELK.sh
More file actions
36 lines (35 loc) · 1.95 KB
/
ELK.sh
File metadata and controls
36 lines (35 loc) · 1.95 KB
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
#!/bin/bash
yum install java-1.8.0-openjdk -y
rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch
echo '[elasticsearch-7.x]' >> /etc/yum.repos.d/elasticsearch.repo
echo 'name=Elasticsearch repository for 7.x packages' >> /etc/yum.repos.d/elasticsearch.repo
echo 'baseurl=https://artifacts.elastic.co/packages/7.x/yum' >> /etc/yum.repos.d/elasticsearch.repo
echo 'gpgcheck=1' >> /etc/yum.repos.d/elasticsearch.repo
echo 'gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch' >> /etc/yum.repos.d/elasticsearch.repo
echo 'enabled=1' >> /etc/yum.repos.d/elasticsearch.repo
echo 'autorefresh=1' >> /etc/yum.repos.d/elasticsearch.repo
echo 'type=rpm-md' >> /etc/yum.repos.d/elasticsearch.repo
yum install elasticsearch -y
echo 'network.host: "127.0.0.1"' >> /etc/elasticsearch/elasticsearch.yml
systemctl start elasticsearch
systemctl status elasticsearch
systemctl enable elasticsearch
curl -X GET "localhost:9200"
yum install kibana -y
mkdir -p /var/log/kibana
touch /var/log/kibana/kibana.log
chown kibana:kibana /var/log/kibana/kibana.log
echo 'server.port: 5601' >> /etc/kibana/kibana.yml
echo 'server.host: "0.0.0.0"' >> /etc/kibana/kibana.yml
echo 'elasticsearch.hosts: "http://localhost:9200"' >> /etc/kibana/kibana.yml
echo 'logging.dest: /var/log/kibana/kibana.log' >> /etc/kibana/kibana.yml
systemctl enable kibana
systemctl start kibana
systemctl status kibana
sudo yum install metricbeat -y
sleep 60
sudo metricbeat setup --template -E 'output.elasticsearch.hosts=["localhost:9200"]'
sudo metricbeat setup -e -E output.elasticsearch.hosts=['localhost:9200'] -E setup.kibana.host=localhost:5601
systemctl enable metricbeat
systemctl restart metricbeat
systemctl status metricbeat