🚀 Setting Up Prometheus and Grafana Easily

Search for a command to run...

No comments yet. Be the first to comment.
When storing sensitive data in Amazon S3, it's critical to make sure it's protected. AWS provides multiple encryption options, and one of the most secure and flexible methods is server-side encryption with AWS Key Management Service (SSE-KMS) using a...

Hi!👋 I'm excited to share how I set up OpenStack using DevStack on local machine. If you’re just getting started with OpenStack, this guide might help you spin up your own testing environment. ⚠️ Disclaimer: This is a minimal, all-in-one installati...

Whether you're a student, developer, or DevOps engineer preparing for a demo, this guide walks you through setting up AKS for demo purposes quickly and efficiently. Let’s get started! Prerequisites An Azure Account: Sign up here Azure CLI: Install ...

If you're running a website or app, securing it with HTTPS is a must. Not only does HTTPS protect your users’ data with encryption, but it also improves trust and even your site's SEO ranking. Let’s Encrypt? Let’s Encrypt is a free and trusted Certif...

Monitoring your infrastructure doesn’t have to be complicated. In this guide, I’ll show you how to set up Prometheus and Grafana in the easy way. Whether you're a beginner or just looking for a quick demo environment, this setup will get you up and running with real-time metrics, dashboards, and multi-instance monitoring in under 15 minutes.
Before we begin, I’ve already launched three EC2 instances (Ubuntu 22.04) for this demo:
instance-01 (Main Prometheus + Grafana Server)
instance-02 (Node Exporter)
instance-03 (Node Exporter)
All instances follow the same initial setup.

SSH into each EC2 instance and run the following:
sudo suapt update -y
git clone https://github.com/linnlattoo-cloud/prometheus_grafana.git
cd prometheus_grafana
chmod +x *.sh
This prepares the environment by cloning the necessary scripts and ensuring all .sh files are executable.



On instance-01, execute the installation scripts in order:
./01…
./02…
./03…
./04…



Once done, you can now access the dashboards:
Prometheus: http://<instance-01-ip>:9090
Grafana: http://<instance-01-ip>:3000
🔐 Default Grafana credentials:
Username: admin
Password: admin



For the other two instances, just set up Node Exporter by running 03…sh file:
./03…
This installs Node Exporter so they can be monitored by Prometheus.

Back in instance-01, open the Prometheus configuration file:
sudo vi /etc/prometheus/prometheus.yml
Under the scrape_configs section, add all three instances like this:
- job_name: 'remote_collector'
scrape_interval: 10s
static_configs:
- targets: ['instance-01-ip:9100', 'instance-02-ip:9100', 'instance-03-ip:9100']

Then, restart Prometheus to apply changes and Navigate to http://<instance-01-ip>:9090/targets to verify all your targets are listed and UP.


Head over to your Grafana dashboard:
Click Connections > Add new connection
Choose Prometheus and set the URL to http://<instance-01-ip>:9090
Save and test the connection



Now for the fun part—dashboards!
Go to Dashboards > Import
Upload the JSON file provided in the GitHub repo
Click Load
Select the Prometheus data source and click Import




Boom! Your monitoring dashboard is live.


That’s it! In just a few simple steps, you’ve got a monitoring setup with Prometheus and Grafana across multiple instances. This stack is powerful for monitoring or demo purposes.
Feel free to fork the GitHub repo and customize your dashboard or explore alerting features next!