WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Grafana Dashboard to monitor Host system metric and Docker container metric using Telegraf and Prometheus.

Notifications You must be signed in to change notification settings

san-gg/telegraf-prometheus-grafana

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

This repository provides a comprehensive monitoring solution for Host machines and Docker containers using Telegraf, Prometheus, and Grafana. Grafana offers intuitive dashboards to visualize system metrics collected by Prometheus and Telegraf. The setup includes pre-configured files to quickly deploy and visualize metrics for both Host systems and Docker containers. This combination of tools results in a powerful and efficient monitoring solution that provides complete visibility into your system's health.

Prerequisites

Before you begin, ensure you have the following installed:

Installation

Telegraf is used as a metrics data collector, while Prometheus collects metrics from the data collector and stores them in its database. Grafana is configured to query metrics using(PrompQL), with the results rendered on the dashboard.

To deploy monitoring containers:

echo DOCKER_GROUP_ID=$(stat -c '%g' /var/run/docker.sock) > .env
export TELEGRAF_HOST=http://telegraf:9273
envsubst < prometheus.template.yml > prometheus.yml
docker compose --profile monitor up -d

Alternatively, you can deploy the data collector (i.e., Telegraf) on the target machine that needs to be monitored, and deploy Prometheus and Grafana on a different machine for metric data storage and dashboard visualization.

  • To deploy Telegraf(on a target machine)
echo DOCKER_GROUP_ID=$(stat -c '%g' /var/run/docker.sock) > .env
docker compose --profile telegraf up -d
  • To deploy Prometheus and Grafana(on a different machine)
    Since, Telegraf is deployed to a different machine, you need to set TELEGRAF_HOST
export TELEGRAF_HOST=<ip of the target machine>:9273
envsubst < prometheus.template.yml > prometheus.yml
docker compose --profile grafana-prometheus up -d

Check if containers are running and not exited.

docker compose ps

Configuration

Grafana dashboard can be accessed by navigating to http://<IP or localhost>:3000. The default username and password are admin.

Installing dashboard: -

  • Navigate to connection > Data Sources from the panel.
  • Add Prometheus as a data source.
  • Specify http://prometheus:9090 in the URL.
  • Test the connection.
  • Navigate to the Dashboard from the panel.
  • Click on 'Create New Dashboard' and then 'Import Dashboard'.
  • Visit grafana.com Dashboard.
  • Click on the Copy ID to Clipboard button.
  • Navigate to the Import page in Grafana and paste the ID into the Grafana.com dashboard URL or ID field.
  • Select Datasource as prometheus
  • Click on the Load button, then Import button.

Here is a screenshot of the dashboard:

overall_usage

system_usage

docker_usage_1

docker_usage_2

About

Grafana Dashboard to monitor Host system metric and Docker container metric using Telegraf and Prometheus.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published