Table of contents
- Setup grafana in your local environment on AWS EC2.โ๏ธ
- Install Grafana on Debian or Ubuntu
- Login to Grafana using the default ID and password, i.e., admin/admin.change the password once you login change the password.
- check if container is running as need to restart it after modifications in config file
- <mark>Here are the logs!</mark>
๐๐Hope you are now clear with the basics of grafana, like why we use, where we use, what can we do with this and so on.๐๐
Grafana is for observability.
Loki(log capturing) is a log aggregation tool.
Prometheus is a metrics monitoring tool(time series data/metrics)
Now, let's do some practical stuff.
Task:
Setup grafana in your local environment on AWS EC2.โ๏ธ
Create an EC2 instance
Install Grafana on Debian or Ubuntu
sudo apt-get install -y apt-transport-https
sudo apt-get install -y software-properties-common wget
sudo wget -q -O /usr/share/keyrings/grafana.key https://apt.grafana.com/gpg.key
Stable release
echo"deb [signed-by=/usr/share/keyrings/grafana.key] https://apt.grafana.com stable main"|sudotee-a /etc/apt/sources.list.d/grafana.list
# Update the list of available packages
sudo apt-get update
# Install the latest OSS release:
sudo apt-get install grafana
ubuntu@ip-172-31-11-45:~$ sudo systemctl start grafana-server
ubuntu@ip-172-31-11-45:~$ sudo systemctl enable grafana-server
Login to Grafana using the default ID and password, i.e., admin/admin.change the password once you login change the password.
Here is Grafana Dashboard
Grafana is an open-source solution for running data analytics with the help of metrics that give us an insight into the complex infrastructure and massive amount of data that our services deal with, with the help of customizable dashboards.
ubuntu@ip-172-31-11-45:~$ sudo apt-get install docker.io
ubuntu@ip-172-31-11-45:~$ sudo usermod -aG docker $USER
ubuntu@ip-172-31-11-45:~$ sudo reboot
Download Loki Config
wget https://raw.githubusercontent.com/grafana/loki/v2.8.0/cmd/loki/loki-local-config.yaml -O loki-config.yaml
Download Promtail Config
wget https://raw.githubusercontent.com/grafana/loki/v2.8.0/clients/cmd/promtail/promtail-docker-config.yaml -O promtail-config.yaml
Run Loki Docker container
docker run -d --name loki -v $(pwd):/mnt/config -p 3100:3100 grafana/loki:2.8.0 --config.file=/mnt/config/loki-config.yaml
Access public ip
wait for 15secs as it is getting ready
Run Promtail Docker container
docker run -d --name promtail -v $(pwd):/mnt/config -v /var/log:/var/log --link loki grafana/promtail:2.8.0 --config.file=/mnt/config/promtail-config.yaml
Add this url under loki,So that grafana will pick logs from loki
Here we can see logs for the Job varlog:
To check logs for grafana give path and jobname under promtail config file like below
check if container is running as need to restart it after modifications in config file
Here are the logs!
linkdin:https://www.linkedin.com/in/gajanan-barure-7351a4140
***Happy Learning :)***โโ
Keep learning,Keep growing๐๐
Thank you for reading!! Hope you find this helpful.
#day73#90daysofdevops#devopscommunity#