šŸš€ Setting Up Prometheus and Grafana Easily

Linn Latt OoLinn Latt Oo
2 min read

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.

Prerequisites

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.

Step 1: Initial Setup on All Instances

SSH into each EC2 instance and run the following:

sudo su
apt 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.

Step 2: Configure instance-01 (Main Monitoring Server)

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

Step 3: Configure instance-02 and instance-03 (Node Exporters)

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.

Step 4: Connect All Targets in 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.

Step 5: Set Up Grafana Dashboard

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!

0
Subscribe to my newsletter

Read articles from Linn Latt Oo directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Linn Latt Oo
Linn Latt Oo