đ Setting Up Prometheus and Grafana Easily

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 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.



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>:9090Grafana:
http://<instance-01-ip>:3000
đ Default Grafana credentials:
Username:
adminPassword:
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>:9090Save 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!





