Run the following commands in a terminal with root access unless stated otherwise.
Metricbeat cannot be installed directly, as Elastic currently doesnt natively support ARM architectures. This means compiling Metricbeat from source, which requires Golang 1.8.
wget https://storage.googleapis.com/golang/go1.8.linux-armv6l.tar.gz
tar -C /usr/local -xzf go1.8.linux-armv6l.tar.gz
export PATH=$PATH:/usr/local/go/bin
apt install -t golang
pip install virtualenv
sudo nano /etc/dphys-swapfile
edit the following line: 'CONF_SWAPSIZE=100' to be 'CONF_SWAPSIZE=1024'
sudo dphys-swapfile setup
sudo dphys-swapfile swapon
go get github.com/elastic/beats (yes, go is a command now. golang will complain, ignore this)
cd ~/go/src/github.com/elastic/beats/metricbeat/
git checkout 6.0
GOPATH=~/go make (this will take a while)
nano ~/go/src/github.com/elastic/beats/metricbeat/metricbeat.yml
- under section 'Elasticsearch output', comment 'output.elasticsearch:' and 'hosts: ["localhost:9200"]'
- under section 'Logstash output', uncomment 'output.logstash:' and 'hosts: ["localhost:5044"]'
- under section 'Logstash output', set 'hosts:' to '[localhost:9200]'
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
sudo apt-get install apt-transport-https
echo "deb https://artifacts.elastic.co/packages/6.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-6.x.list
sudo apt-get update && sudo apt-get install logstash
touch /etc/logstash/conf.d/pipeline.conf
nano /etc/logstash/conf.d/pipeline.conf
- add the following code to the file:
input {
beats {
port => 9200
}
}
output {
elasticsearch {
hosts => "localhost:9202"
manage_template => false
index => "%{[@metadata][beat]}-%{[@metadata][version]}-%{+YYYY.MM.dd}"
}
file {
path => "/var/log/logstash/%{[@metadata][beat]}-%{[@metadata][version]}-%{+YYYY.MM.dd}"
}
}
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
sudo apt-get install apt-transport-https
echo "deb https://artifacts.elastic.co/packages/6.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-6.x.list
apt update && apt install elasticsearch
nano /etc/elasticsearch/elasticsearch.yml
- uncomment 'network.host: “<some_ip_address>”' and 'http.port:9200'
- set 'network.host:' to '0.0.0.0' and 'http.port:' to '9202'
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
echo "deb https://artifacts.elastic.co/packages/6.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-6.x.list
apt update && apt install kibana
nano /etc/kibana/kibana.yml
- uncomment 'server.port: 5601' and 'elasticsearch.url: “http://localhost:9200”'
- set 'server.port:' to '9203' and 'elasticsearch.url:' to '“http://localhost:9202”'
This only needs to be done once, regardless of the amount of nodes present in the setup
cd ~/go/src/github.com/elastic/beats/metricbeat/
./metricbeat setup -e -E output.logstash.enabled=false -E output.elasticsearch.hosts=['localhost:9999'] -E setup.dashboards.enabled:=true -E setup.dashboards.directory=/root/go/src/github.com/elastic/beats/metricbeat/module/system/_meta/kibana -E setup.kibana.host=localhost:9998
Visualizing data in Kibana can be done in a variety of different ways, but the dashboard is what allows users to create an overview of multiple data sets as a way to compare the datasets. Creating visualizations in Kibana can be as easy or advanced as the user wants.
Below is a step-by-step guide on how to recreate the relevant graphs used in the O2-Balancer experiments.
- Go to 'Visualize'
- Click the '+' button to create a new visualization
- Under 'Time Series', select 'Visual Builder'
- Go to the tab 'Data' and subtab 'Metrics'
- Select Aggregation type 'Average'
- in 'Field', search for 'system.load.1' and select it
- Select Group by 'Terms'
- Assuming the metrics concern multiple devices, in the 'By' field, select 'host.keyword'
- Select Order by 'Terms'
- Go to subtab 'Options'
- Make sure the variables correspond to the following:
- Data Formatter: Custom
- Format String: '0%'
- Chart Type: Line
- Stacked: Stacked
- Fill: 0.5
- Line Width: 1
- Point Size: 1
- Split Color Theme: Rainbow
- In the top toolbar, click 'Save' and name the visualization 'System Load'
- Go to 'Visualize'
- Search and select 'System Load'
- Go to tab 'Data' and subtab 'Metrics'
- In 'Field', search for 'system.network.in.bytes' and select it
- Set 'Group by' to 'Everything'
- Go to subtab 'Options'
- Set 'Format String' to '0.00 b'
- Set 'Template' to {{value}}/s
- In the top toolbar, click 'Save' and select 'Save as new Visualization'
- Rename to 'Total network inbound'
- Go to 'Visualize'
- Search and select 'Total network inbound'
- Go to tab 'Data' and subtab 'Metrics'
- In 'Field', search for 'system.network.out.bytes' and select it
- In the top toolbar, click 'Save' and select 'Save as new Visualization'
- Rename to 'Total network outbound'
- Go to 'Visualize'
- Search and select 'Total network inbound'
- Go to tab 'Data' and subtab 'Metrics'
- Select Group by 'Terms'
- In the 'By' field, select 'host.keyword'
- In the top toolbar, click 'Save' and select 'Save as new Visualization'
- Rename to 'Per PI network inbound'
- Go to 'Visualize'
- Search and select 'Total network outbound'
- Go to tab 'Data' and subtab 'Metrics'
- Select Group by 'Terms'
- In the 'By' field, select 'host.keyword'
- In the top toolbar, click 'Save' and select 'Save as new Visualization'
- Rename to 'Per PI network inbound'
After all required visualizations have been created, they can be added to the dashboard as follows:
- Go to the desired dashboard
- In the top toolbar, click 'Edit'
- In the top toolbar, click 'Add'
- Search for the desired visualizations and only click once to add to the dashboard
systemctl start logstash.service
service elasticsearch start
service kibana start
cd ~/go/src/github.com/elastic/beats/metricbeat/
./metricbeat -e
ps aux | grep metric
sudo renice -n 19 -p PROCESS_ID
ssh -L 9999:localhost:9203 pi@pi.dantalion.nl -p 6625
IN BROWSER: http://localhost:9999
Clear data
curl -XDELETE 'http://localhost:9202/*'
rm /var/log/logstash/metricbeat-*