{"id":30212049,"url":"https://github.com/justynlarry/grafana-laptop","last_synced_at":"2026-04-13T06:34:41.526Z","repository":{"id":304846300,"uuid":"1020168241","full_name":"justynlarry/grafana-laptop","owner":"justynlarry","description":"Prometheus tracker with Grafana Dashboard to track Laptop Metrics","archived":false,"fork":false,"pushed_at":"2025-07-17T15:17:35.000Z","size":78,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-13T21:39:05.952Z","etag":null,"topics":["docker-compose","fedora","grafana","prometheus","prometheus-exporter","prometheus-metrics"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/justynlarry.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-15T12:51:43.000Z","updated_at":"2025-07-24T13:29:50.000Z","dependencies_parsed_at":"2025-07-16T18:53:56.254Z","dependency_job_id":"80aa3174-6e29-4ba4-a280-337f84a000c2","html_url":"https://github.com/justynlarry/grafana-laptop","commit_stats":null,"previous_names":["jlarry77/grafana-laptop","justynlarry/grafana-laptop"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/justynlarry/grafana-laptop","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justynlarry%2Fgrafana-laptop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justynlarry%2Fgrafana-laptop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justynlarry%2Fgrafana-laptop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justynlarry%2Fgrafana-laptop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/justynlarry","download_url":"https://codeload.github.com/justynlarry/grafana-laptop/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justynlarry%2Fgrafana-laptop/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270323580,"owners_count":24564684,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-13T02:00:09.904Z","response_time":66,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker-compose","fedora","grafana","prometheus","prometheus-exporter","prometheus-metrics"],"created_at":"2025-08-13T22:00:42.460Z","updated_at":"2026-04-13T06:34:41.495Z","avatar_url":"https://github.com/justynlarry.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Monitoring Stack with Prometheus, Grafana, and Tailscale\n![Prometheus](https://img.shields.io/badge/Monitoring-Prometheus-orange?logo=prometheus)\n![Grafana](https://img.shields.io/badge/Dashboard-Grafana-F46800?logo=grafana\u0026logoColor=white)\n![Docker](https://img.shields.io/badge/Containerized-Docker-2496ED?logo=docker\u0026logoColor=white)\n![Tailscale](https://img.shields.io/badge/Networking-Tailscale-007ACC?logo=tailscale)\n![Fedora](https://img.shields.io/badge/OS-Fedora-294172?logo=fedora\u0026logoColor=white)\n\nThis project outlines the setup of a robust monitoring solution using Prometheus and Grafana, deployed via Docker Compose on a Fedora Server VM, to collect metrics from various devices (laptops) connected via Tailscale VPN.\n\n🌟 Features\nCentralized Monitoring: Collects system metrics from multiple machines in one place.\n\nVisualization: Uses Grafana to create interactive dashboards for metric visualization.\n\nSecure Connectivity: Leverages Tailscale VPN for secure and easy network access between the monitoring server and target devices.\n\nContainerized Deployment: Prometheus and Grafana run in Docker containers for easy management and portability.\n\nNode Exporter: Utilizes Node Exporter on Linux machines to expose system-level metrics.\n\n🏛️ Architecture Overview\nThe setup consists of:\n\nMonitoring Server (Fedora VM): Hosts the Prometheus and Grafana Docker containers.\n\nPrometheus: Scrapes metrics from configured targets and stores them.\n\nGrafana: Queries Prometheus for data and displays it on customizable dashboards.\n\nTailscale: A peer-to-peer VPN that creates a secure network between all devices, allowing Prometheus to reach exporters on remote machines.\n\nNode Exporter: Runs on target Linux laptops, exposing system metrics (CPU, memory, disk, network, etc.) on a specific port.\n```\n\n+-------------------+      Tailscale VPN      +-------------------+\n|  Fedora Server VM |\u003c-----------------------\u003e|  Target Laptop 1  |\n|                   |                         | (Node Exporter)   |\n| +-----------+     |                         +-------------------+\n| |  Docker   |     |                                 ^\n| |           |     |                                 |\n| | +-------+ |     |                                 |\n| | |Prometh| |     |                                 |\n| | |eus    | |     |                                 |\n| | +-------+ |     |                                 |\n| |     ^     |     |                                 |\n| |     |     |     |                                 |\n| | +-------+ |     |                                 |\n| | |Grafana| |     |                                 |\n| | +-------+ |     |                                 |\n| +-----------+     |                         +-------------------+\n|                   |                         |  Target Laptop 2  |\n+-------------------+                         | (Node Exporter)   |\n                                              +-------------------+\n\n```\n\n\n📋 Prerequisites\nBefore you begin, ensure you have the following:\n\nA virtual machine (VM) running Fedora Server (or RHEL/CentOS).\n\nAt least one target Linux laptop (e.g., Ubuntu, Kali) to monitor.\n\nBasic command-line familiarity with Linux.\n\nInternet connectivity on all machines for software installation.\n\n🚀 Setup Instructions\nFollow these steps to set up your monitoring stack.\n\nSTAGE 1: Set up the Monitoring Server (Fedora Server VM)\n1. Install Fedora Server (or RHEL):\n  Choose either Fedora Server (latest features) or RHEL Developer Edition (stable, free for personal use).\n\n2. Update \u0026 Install Essentials:\n```\nbash\nsudo dnf update -y\nsudo dnf install -y git curl wget vim podman docker docker-compose\n```\n3. Enable Docker:\n```\nbash\nsudo systemctl enable --now docker\nsudo usermod -aG docker $USER\nnewgrp docker # You might need to log out and back in for group changes to apply\n```\nSTAGE 2: Set Up Prometheus + Grafana Stack with Docker\n1. Create Project Directory:\n```\nbash\nmkdir ~/grafana-laptop \u0026\u0026 cd ~/grafana-laptop\n```\n2. File Structure:\nCreate the following directory and file structure:\n\n```\ngrafana-laptop/\n├── docker-compose.yml\n├── prometheus/\n│   └── prometheus.yml\n└── grafana/\n    └── (optional provisioning config)\n```\n3. prometheus.yml Example:\nCreate ```~/grafana-laptop/prometheus/prometheus.yml ```with the following content.\n\nImportant: Replace TAILSCALE-IP-LAPTOP with the actual Tailscale IP of your target laptop (you'll get this in Stage 3).\n\nImportant: Node Exporter's default port is ```9100```. Ensure this matches the port in your targets.\n```\nbash\nglobal:\n  scrape_interval: 10s\n\nscrape_configs:\n  - job_name: 'prometheus'\n    static_configs:\n      - targets: ['localhost:9090'] # Prometheus scraping itself (internal to Docker network)\n\n  - job_name: 'laptops'\n    static_configs:\n      - targets:\n          - 'TAILSCALE-IP-GHOST:9100' # Example: Replace with actual Tailscale IP and correct port\n        labels:\n          instance: 'Ghost'\n       Add more laptops here as needed, e.g.:\n       - targets:\n           - 'TAILSCALE-IP-EMPIRE:9100'\n         labels:\n           instance: 'Empire'\n```\ndocker-compose.yml:\nCreate ~/grafana-laptop/docker-compose.yml with the following content.\n\nNote the Prometheus port 9091 on the host to avoid conflict with Fedora's Cockpit.\n\nThe :z flag is crucial for SELinux on Fedora.\n\n```\nbash\nservices:\n  prometheus:\n    image: prom/prometheus\n    volumes:\n      - ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:z # Added :z for SELinux\n    ports:\n      - \"9091:9090\" # Host port 9091, container port 9090\n\n  grafana:\n    image: grafana/grafana\n    ports:\n      - \"3000:3000\"\n    volumes:\n      - grafana-storage:/var/lib/grafana\n    environment:\n      - GF_SECURITY_ADMIN_PASSWORD=admin # Change this to a stronger password in production!\n\nvolumes:\n  grafana-storage:\n```\n5. Launch the Stack:\nFrom the ~/grafana-laptop directory:\n```\nbash\ndocker compose up -d\n```\nVerify both containers are running:\n```\nbash\ndocker ps\n```\nYou should see grafana-laptop-prometheus-1 and grafana-laptop-grafana-1 both Up.\n\nSTAGE 3: Set Up VPN with Tailscale\n\n1.  **Install Tailscale on all devices** (Fedora VM and target laptops):\n    * Follow the official instructions: [https://tailscale.com/download](https://tailscale.com/download)\n    * **Alternatively, for Fedora Versions 41+**, you can use the automated installation script available in this repository: [`tailscale-fedora-install.sh`](./tailscale-fedora-install.sh).\n        (This script is also available in my [automation-scripts repository](https://github.com/jlarry77/automation_scripts/tree/main/tailscale-fedora-install/) for broader use.)\n\n2.  **Authenticate each machine** to your Tailscale network:\n    If you haven't authenticated yet, run the following command on each device and follow the URL provided to log in:\n\n    ```bash\n    sudo tailscale up\n    ```\n\n3.  **Get the Tailscale IPs** of all devices (run this on each machine):\n    ```bash\n    tailscale ip -4\n    ```\nUse these IPs to update your prometheus.yml file on the Fedora VM.\n\nSTAGE 4: Install Node Exporters (on Target Laptops)\nThis stage is performed on each Linux laptop you want to monitor.\n\n1. On Ubuntu \u0026 Kali Laptops:\n```\nbash\nsudo apt update\nsudo apt install -y prometheus-node-exporter\nsudo systemctl enable --now prometheus-node-exporter\n```\nConfirm it runs on port :9100. You can check by opening a browser on the laptop itself and navigating to http://localhost:9100/metrics.\nIf you have a firewall (like ufw), ensure port 9100/tcp is allowed:\n```\nbash\nsudo ufw allow 9100/tcp\nsudo ufw reload\n```\nSTAGE 5: Validate and Visualize in Grafana\nAccess Grafana:\nOpen a web browser on a machine connected to your Tailscale network and go to:\nhttp://TAILSCALE-IP-FEDORA-VM:3000\nLogin with: admin / admin (change this password immediately after logging in).\n\nAdd Prometheus Data Source:\n\nNavigate to Connections (or Configuration) \u003e Data Sources \u003e Add data source.\n\nChoose Prometheus.\n\nFor the URL, enter: http://prometheus:9090 (This works because Prometheus and Grafana are in the same Docker Compose network).\n\nClick \"Save \u0026 Test\". It should show \"Data source is working\".\n\nImport Dashboards:\n\nGo to Dashboards \u003e Import.\n\nYou can import pre-built dashboards from Grafana Labs. For Node Exporter, search for \"Node Exporter Full\" (ID: 1860).\n\nEnter the ID, click \"Load\", select your Prometheus data source, and click \"Import\".\n\n🛠️ Troubleshooting Tips\n- Error response from daemon: failed to set up container networking... address already in use (Port 9090):\n  - Solution: Fedora Server's Cockpit often uses port 9090. Change the host-side port mapping for Prometheus in docker-compose.yml to 9091:9090. (e.g., - \"9091:9090\").\n\n- Error loading config ... permission denied (Prometheus container exits):\n  - Cause: SELinux preventing Docker from accessing the mounted prometheus.yml file.\n  - Solution: In docker-compose.yml, add :z to the volume mount for prometheus.yml. Example: - ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:z.\n\n- Error scraping target: ... connect: connection refused:\n  - Cause 1: Exporter not running or on wrong port: The Node Exporter (or Windows Exporter) on the target laptop is either not running, or it's listening on a different port than configured in prometheus.yml.\n    - Verify: On the target laptop, check sudo systemctl status prometheus-node-exporter. Look for the \"Listening on\" address. Node Exporter's default port is 9100.\n    - Fix: Update the targets in prometheus.yml on your Fedora VM to use the correct port (e.g., 9100) for that laptop.\n\n  - Cause 2: Firewall on target laptop: The target laptop's firewall is blocking incoming connections on the exporter's port.\n    - Verify: On Linux, sudo ufw status and check rules. On Windows, check Windows Defender Firewall inbound rules.\n    - Fix: Allow the necessary port (e.g., 9100/tcp) through the firewall.\n\n- ping prometheus from Grafana container fails:\n  - Cause: Prometheus container is not running or not healthy.\n  - Fix: Use docker ps -a to check the status of the Prometheus container. If it's exited, check docker logs grafana-laptop-prometheus-1 for the reason it failed to start. Then run docker compose down \u0026\u0026 docker compose up -d after fixing any issues.\n\n🧠 Bonus Tips \u0026 Future Enhancements\n- Prometheus Alerting: Configure Prometheus alert rules and set up Alertmanager for notifications (email, Slack, etc.) when metrics cross thresholds.\n\n- Dynamic IP Discovery: Explore scripting Tailscale IP discovery (tailscale status --json) to automatically update prometheus.yml if your Tailscale IPs change frequently.\n\n- More Exporters: Integrate other Prometheus exporters (e.g., cadvisor for Docker container metrics, blackbox_exporter for endpoint probing).\n\n- Grafana Provisioning: Automate Grafana dashboard and data source setup using provisioning files in the grafana/ directory.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjustynlarry%2Fgrafana-laptop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjustynlarry%2Fgrafana-laptop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjustynlarry%2Fgrafana-laptop/lists"}