Day 67: Grafana Cloud

Day 67: Grafana Cloud

Monitoring in Grafana

Create a free account in Grafana Cloud

Enter all the information such as team URL and deployment region and click on Finish setup.

Click on the "Create Dashboard" tile

Create your own dashboard

Select "Linux"

Install Grafana Agent on the EC2 instance

Click on " Run the Grafana agent" and a window will pop up.

In this case, we select

OS: Debian — based

Architecture: Amd64

Now create an API key, copy the SSH that includes the API key

and paste it on the EC2 instance machine.

ubuntu@ip-172-31-87-34:~$ ARCH="amd64" 
GCLOUD_HOSTED_METRICS_URL="https://prometheus-prod-13-prod-us-east-0.grafana.net/api/prom/push" 
GCLOUD_HOSTED_METRICS_ID="1214366" 
GCLOUD_SCRAPE_INTERVAL="60s" 
GCLOUD_HOSTED_LOGS_URL="https://logs-prod-006.grafana.net/loki/api/v1/push" 
GCLOUD_HOSTED_LOGS_ID="706258" 
GCLOUD_RW_API_KEY="enter your API key" 
/bin/sh -c 
"$(curl -fsSL https://storage.googleapis.com/cloud-onboarding/agent/scripts/grafanacloud-install.sh)"

Once the installation is done, use the below command to check the status of Grafana

sudo systemctl status grafana-agent.service

Grafana is now up and running.

We can also test the connection on the Grafana dashboard.

Proceed to install integration.

Scroll down and enter the hostname of the Linux EC2 instance

Now enable the integration by manually adding the provided snippets to your YAML configuration file present in EC2.

Add the below snippets to the YAML file in /etc/grafana-agent.yaml

Insert the "node-exporter under "Integration".

And insert the "- job_name" under "logs.configs.scrape_configs".

Important Note
Indentation is crucial in YAML for execution

Once the YAML file is re-configured, use the below command to restart Grafana

sudo systemctl restart grafana-agent.service

Now go back to the Grafana Dashboard and test the connection.

The agent is now collecting data from EC2.
Proceed to Install the Dashboard

Click on "View Dashboard" and go to “Node Exporter / Node CPU and System", and you will get all the data on the CPU and system on Grafana.

We can also run applications like docker containers.

docker run nginx

No Go back to the Homepage Dashboard and click on “+ Connect Data”

It will list down, all the things that you can integrate with Grafana.

Select “CloudWatch”

Proceed to create a Cloudwatch data source

Enter the access Key ID, Secret Access Key and the Region. You can refer to the Blog on how to create AWS access Keys.

Save and Test

We can now create any type of alarm in CloudWatch on AWS.

You can monitor on the Grafana Dashboard.


Conclusion:

We've achieved end-to-end monitoring and visualization by installing the Grafana Agent on EC2 instance, configuring YAML files, creating a Grafana dashboard, and integrating CloudWatch. This comprehensive setup empowers you to effectively monitor and analyze your system's performance and logs.

Hope you like my post. Don't forget to like, comment, and share.