Skip to content
Menu
Marius Serbanica – Tech Blog
  • My Tech Blog
  • About me
  • Contact Me
  • Curriculum Vitae
  • Projects
  • Current Projects List
  • Certifications
  • Home Lab
  • Self-Hosted
  • Linux Cheat Sheet
  • Linux Commands
  • Privacy Policy
  • Site Map
Marius Serbanica – Tech Blog
January 1, 2024

The Ultimate Home Lab Monitoring Setup – Prometheus + Grafana

After avoiding and putting this off for months now, I finally decided to set this up and I must say, I was a bit silly to even fear this. The only reason I didn’t want to get into it was that I felt it was going to be tedious and hard to maintain, but to my surprise, it was extremely easy to install and set up.

I’ll start by explaining what these self-hosting services are:
First of


Prometheus!


What Is Prometheus? Prometheus is an open-source technology designed to provide monitoring and alerting functionality for cloud-native environments, including Kubernetes. It can collect and store metrics as time-series data, recording information with a timestamp.

To have Prometheus collect and scrape all the metrics, we also need to use Node-Exporter service, which is provided by the same developer.

Grafana!

Grafana is an open-source interactive data-visualization platform, developed by Grafana Labs, which allows users to see their data via charts and graphs that are unified into one dashboard (or multiple dashboards!) for easier interpretation and understanding.

I will not get into Kubernetes at this time as that needs an entire post and I’m still not too sure how that even works at this point haha!

Installation –

Now, there are several ways of going about this but I found that the best way, at least for me, was to use docker and deploy all the services in a stack, through Portainer’s UI.

Docker-Compose file for how I’ve done this –

version: '3.3'
services:
    node-exporter:
        network_mode: host
        pid: host
        volumes:
            - '/:/host:ro,rslave'
        image: 'quay.io/prometheus/node-exporter:latest'
    prometheus:
        container_name: prometheus
        ports:
            - '9090:9090' #modify to your setup needs
        volumes:
            - '/home/marius/docker/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml' #modify the path for your install location
        image: prom/prometheus
    grafana:
        container_name: grafana
        ports:
            - '3457:3457' #modify to your setup needs
        image: grafana/grafana
Dockerfile

Make sure to deploy a node-exporter on each machine that you want to be scraped by Prometheus.

Prometheus will need a yml file to know what nodes to scrape. I will provide my config as an example –

global:
  scrape_interval: 5s
  external_labels:
    monitor: 'node'
scrape_configs:
  - job_name: 'prometheus'
    static_configs:
      - targets: ['192.168.XX.XXX:9090'] ## IP Address of the localhost. Match the port to your container port
  - job_name: 'node-exporter'
    static_configs:
      - targets: ['192.168.XX.XXX:9100'] ## IP Address of the localhost
      - targets: ['192.168.XX.XXX:9100'] ## IP Address of the desired node
      - targets: ['192.168.XX.XXX:9100'] ## IP Address of the desired node
      - targets: ['192.168.XX.XXX:9100'] ## IP Address of the desired node
      - targets: ['192.168.XX.XXX:9100'] ## IP Address of the desired node
YAML

After Prometheus server is started, if everything is set correctly, you should have something like this –

In Grafana, you will need to add your preferred Dashboard and link it to your Prometheus instance.
You can find a multitude of pre-set dashboards on Grafana’s official website. Just copy/paste dashboard id’s into your Grafana setup and you should be good to go.

After Grafana is booted, you should have something like this –

I must say, this has been a godsend. I can see how all my home lab environments are doing and troubleshoot at the click of a button. We get an abundance of information from our system poured into ONE beautiful UI and this is extremely useful for admins in general.

I hope you’ll find this just as useful as I did! See ya!

Share on Social Media
x facebook linkedin

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Join my LinkedIn Network.

Recent Posts

  • Kubernetes cluster. Why and how
  • Installing GNU-World on ircu2
  • Replacing Cloudflare Tunnel with Tailscale on a VPS
  • KASM – My main workspace RBI
  • Transforming a Mini PC into a Powerful Home Network Hub / Router/ Firewall with OPNsense

Archives

  • February 2025
  • January 2025
  • October 2024
  • May 2024
  • March 2024
  • February 2024
  • January 2024
  • December 2023
  • November 2023
  • October 2023
  • September 2023
  • August 2023
  • July 2023
  • June 2023
  • May 2023
  • April 2023
  • March 2023
  • February 2023
  • January 2023

Categories

  • How-To
  • Tech Industry
  • Tech, but personal
  • Tutorials

Recent Comments

  1. IRC Lamer on Installing GNU-World on ircu2
  2. severus2231 on Transforming a Mini PC into a Powerful Home Network Hub / Router/ Firewall with OPNsense
  3. admin on Mounting a NAS (Network Attached Storage) device on Linux
  4. abL on Mounting a NAS (Network Attached Storage) device on Linux
  5. Alin R on Cleaning up your Linux OS.
Social Media
Find me on social media
Facebook Twitter Instagram LinkedIn

©2025 Marius Serbanica – Tech Blog