InfluxDB2 + Grafana Docker Container Installation in Ubuntu

From Thomas-Krenn-Wiki
Jump to navigation Jump to search

This article explains how to install an Influx DB and a Grafana Monitoring via Docker. This set up is suitable for the live monitoring of your IT infrastructure.

Installation of Docker

The basis for this is a Ubuntu 22.04 (LTS) with Docker. The latest instructions for the installation can always be found in the Docker-Docs. The following commands can be used for an installation of Docker under Ubuntu:

# adding Docker GPG Key 
sudo apt-get update
sudo apt-get install ca-certificates curl gnupg
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg

# adding APT Repository to the system  
echo \
  "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
  "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update

After this, Docker can be installed:

root@js-grafana-01:~# sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

The installation can be checked with the following command:

root@js-grafana-01:~# sudo docker run hello-world

Influx DB 2 container

The Docker container for the Influx DB is started with the following command. The parameters, especially username, password, first bucket name and organisation, have to be adjusted to the infrastructure.

"Attention": We have changed the port to 8006 for testing reasons. The default is 8086.

docker run -d -p 8006:8086 \
  --name influxdb2 \
  -v $PWD/data:/var/lib/influxdb2 \
  -v $PWD/config:/etc/influxdb2 \
  -e DOCKER_INFLUXDB_INIT_MODE=setup \
  -e DOCKER_INFLUXDB_INIT_USERNAME=admin \
  -e DOCKER_INFLUXDB_INIT_PASSWORD=relation \
  -e DOCKER_INFLUXDB_INIT_ORG=Thomas-Krenn.AG \
  -e DOCKER_INFLUXDB_INIT_BUCKET=proxmox-cl-bucket \
  -e DOCKER_INFLUXDB_INIT_ADMIN_TOKEN=Relation123! \
  influxdb:2.7.1

You can now call up the Influx DB at http://ip:8006 using http and log in with the access data. If you want to make subsequent modifications, you can use the Web UI create more organisations, buckets or users.

Grafana container

An installation of Grafana is required so that the data stored in the influxDB can also be visualized. The following snippet is useful for this:

root@js-grafana-01:~# docker run -d --name=grafana -p 8007:3000 grafana/grafana

Attention: We use the port 8007 for Grafana. The default is 3000. Please consider that for your environment. After this, Grafana can be called up via: http://ip:8007. The default log in is admin/admin and will be changed by you when you log in for the first time.

Conclusion

This is the initial basis for an in-time live monitoring of your IT infrastructure. The article InfluxDB2 + Grafana Konfiguration eines Metric-Servers für Proxmox VE describes how to fill the influxdb with data from your Proxmox system and visualize it in Grafana.


Author: Jonas Sterr

Jonas Sterr has been working for Thomas-Krenn for several years. Originally employed as a trainee in technical support and then in hosting (formerly Filoo), Mr. Sterr now mainly deals with the topics of storage (SDS / Huawei / Netapp), virtualization (VMware, Proxmox, HyperV) and network (switches, firewalls) in product management at Thomas-Krenn.AG in Freyung.


Translator: Alina Ranzinger

Alina has been working at Thomas-Krenn.AG since 2024. After her training as multilingual business assistant, she got her job as assistant of the Product Management and is responsible for the translation of texts and for the organisation of the department.


Related articles

Docker Installation under Ubuntu 24.04
InfluxDB2 + Grafana Configuration of a metric server for Proxmox VE
Installation of Reverse Proxy for n8n with Nginx Proxy Manager