Archive

Articles taggués ‘supervision’

Grafana : visualisez et supervisez vos données, installation pas à pas avec Docker

08/11/2026 Comments off
Logo de Grafana
Le logo de Grafana (© Grafana Labs)

Vous avez des serveurs, une box domotique, un NAS ou quelques conteneurs Docker, et vous voulez voir d’un coup d’œil ce qui s’y passe : charge CPU, mémoire, températures, consommation électrique, logs ? Grafana est l’outil de référence pour ça. Dans cet article, je vous explique à quoi il sert, pourquoi il vaut le coup, et comment l’installer en quelques minutes avec Docker.

Qu’est-ce que Grafana ?

Grafana est une application web libre (open source) de visualisation de données et de supervision. Elle ne stocke pas vraiment vos données : elle se branche sur des sources de données (Prometheus, InfluxDB, Loki, MySQL/MariaDB, PostgreSQL, Elasticsearch, etc.) et vous permet de construire des tableaux de bord composés de graphiques, jauges, tableaux, cartes ou indicateurs.

Exemple de tableau de bord Grafana avec plusieurs graphiques
Un tableau de bord Grafana (image : Grafana Labs)

Pourquoi utiliser Grafana ?

  • Un seul outil pour plusieurs sources : vous pouvez afficher sur la même page des métriques Prometheus, des données d’une base SQL et des logs Loki.
  • Des tableaux de bord prêts à l’emploi : la communauté en partage des milliers sur grafana.com. Un import par identifiant et vous obtenez un tableau de bord complet.
  • Des alertes : Grafana peut vous prévenir (e-mail, Telegram, webhook, etc.) quand un disque est plein ou qu’un service ne répond plus.
  • Gratuit et auto-hébergeable : l’édition open source suffit amplement pour un usage personnel, un homelab ou une petite structure.
  • Extensible : de nombreux plugins ajoutent des types de graphiques et des sources de données.
  • Léger à déployer avec Docker : une image officielle, un volume pour les données, et c’est parti.

Quelques exemples d’usage

  • Surveiller la santé d’un serveur ou d’un NAS (CPU, RAM, disques, réseau).
  • Suivre des conteneurs Docker (avec cAdvisor).
  • Visualiser une consommation électrique ou des températures issues de la domotique.
  • Analyser des logs applicatifs ou de pare-feu.
Graphique de séries temporelles dans Grafana
Visualisation de séries temporelles (image : Grafana Labs)

Installer Grafana avec Docker

Prérequis

  • Un serveur ou une machine Linux (un mini-PC, un Raspberry Pi 4/5, une VM…).
  • Docker Engine et le plugin Docker Compose installés. Vérifiez avec :
docker --version
docker compose version

Méthode 1 : un essai rapide en une commande

Pour tester Grafana sans rien configurer :

docker run -d -p 3000:3000 --name=grafana grafana/grafana

Le conteneur démarre en arrière-plan (-d) et publie le port 3000 (-p 3000:3000). Attention : sans volume, vos tableaux de bord sont perdus si vous supprimez le conteneur. Pour un vrai usage, passez à la méthode 2.

Méthode 2 : Docker Compose (recommandée)

Étape 1 – Créer le dossier du projet

mkdir -p ~/grafana && cd ~/grafana

Étape 2 – Créer le fichier .env (il contient le mot de passe administrateur, à ne pas partager) :

GRAFANA_ADMIN_PASSWORD=ChoisissezUnMotDePasseSolide

Étape 3 – Créer le fichier docker-compose.yaml

services:
  grafana:
    image: grafana/grafana:latest
    container_name: grafana
    restart: unless-stopped
    ports:
      - "3000:3000"
    environment:
      - GF_SECURITY_ADMIN_USER=admin
      - GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_ADMIN_PASSWORD}
      - GF_USERS_ALLOW_SIGN_UP=false
      - GF_PLUGINS_PREINSTALL=grafana-clock-panel
      - TZ=Europe/Paris
    volumes:
      - grafana-storage:/var/lib/grafana

volumes:
  grafana-storage:

Ce que fait ce fichier :

  • image : l’image officielle de Grafana (édition open source) ;
  • restart: unless-stopped : Grafana redémarre tout seul après un reboot du serveur ;
  • GF_SECURITY_ADMIN_PASSWORD : définit le mot de passe du compte admin au premier démarrage ;
  • GF_PLUGINS_PREINSTALL : installe automatiquement un plugin (ici le panneau horloge, à titre d’exemple ; plusieurs plugins se séparent par des virgules) ;
  • grafana-storage : un volume Docker nommé qui conserve vos tableaux de bord et réglages, même si vous recréez le conteneur.

Étape 4 – Démarrer Grafana

docker compose up -d

Vérifiez que le conteneur tourne, et consultez les logs si besoin :

docker compose ps
docker compose logs -f grafana

Étape 5 – Se connecter

Ouvrez votre navigateur sur http://ADRESSE_IP_DU_SERVEUR:3000 (ou http://localhost:3000 en local) et connectez-vous avec l’utilisateur admin et le mot de passe défini dans le fichier .env.

Note : si vous utilisez un dossier local (« bind mount ») plutôt qu’un volume nommé, le conteneur tourne avec l’utilisateur 472 : le dossier doit lui appartenir (sudo chown -R 472:472 ./data), sinon Grafana ne pourra pas écrire ses données.

Aller plus loin : ajouter Prometheus pour superviser votre serveur

Grafana seul est une coquille vide : il lui faut des données. Le duo classique est Prometheus (qui collecte les métriques) et node_exporter (qui expose celles de la machine). Remplacez votre docker-compose.yaml par ceci :

services:
  grafana:
    image: grafana/grafana:latest
    container_name: grafana
    restart: unless-stopped
    ports:
      - "3000:3000"
    environment:
      - GF_SECURITY_ADMIN_USER=admin
      - GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_ADMIN_PASSWORD}
      - GF_USERS_ALLOW_SIGN_UP=false
      - TZ=Europe/Paris
    volumes:
      - grafana-storage:/var/lib/grafana
    depends_on:
      - prometheus

  prometheus:
    image: prom/prometheus:latest
    container_name: prometheus
    restart: unless-stopped
    volumes:
      - ./prometheus.yml:/etc/prometheus/prometheus.yml:ro
      - prometheus-data:/prometheus
    extra_hosts:
      - "host.docker.internal:host-gateway"

  node-exporter:
    image: prom/node-exporter:latest
    container_name: node-exporter
    restart: unless-stopped
    pid: host
    network_mode: host
    volumes:
      - /:/host:ro,rslave
    command:
      - "--path.rootfs=/host"

volumes:
  grafana-storage:
  prometheus-data:

Puis créez le fichier prometheus.yml à côté. Comme node_exporter tourne sur le réseau de l’hôte, Prometheus l’atteint via host.docker.internal (déclaré par extra_hosts dans le compose ci-dessus) :

global:
  scrape_interval: 15s

scrape_configs:
  - job_name: prometheus
    static_configs:
      - targets: ["localhost:9090"]

  - job_name: node
    static_configs:
      - targets: ["host.docker.internal:9100"]

Appliquez la configuration :

docker compose up -d

Connecter Prometheus à Grafana

  1. Dans Grafana, ouvrez Connections → Data sources → Add data source.
  2. Choisissez Prometheus.
  3. Dans Prometheus server URL, saisissez http://prometheus:9090 (les conteneurs d’un même compose se joignent par leur nom).
  4. Cliquez sur Save & test : un message vert confirme la connexion.

Importer un tableau de bord tout fait

Allez dans Dashboards → New → Import, saisissez l’identifiant 1860 (« Node Exporter Full », un classique de la communauté), choisissez votre source Prometheus et validez. Vous obtenez immédiatement un tableau de bord complet de votre machine.

Alertes dans Grafana
Les alertes permettent d’être prévenu en cas de problème (image : Grafana Labs)

Maintenance : mise à jour et sauvegarde

Mettre à jour Grafana :

cd ~/grafana
docker compose pull
docker compose up -d
docker image prune -f

Sauvegarder le volume de données (archive dans le dossier courant) :

docker run --rm -v grafana_grafana-storage:/data -v "$PWD":/backup alpine \
  tar czf /backup/grafana-backup-$(date +%F).tar.gz -C /data .

Le nom du volume est préfixé par celui du dossier du projet (ici grafana_grafana-storage). Vérifiez-le avec docker volume ls.

Quelques conseils de sécurité

  • Ne laissez jamais le mot de passe par défaut admin/admin.
  • N’exposez pas directement le port 3000 sur Internet : placez Grafana derrière un reverse proxy en HTTPS (Nginx, Apache, Traefik, Caddy…) ou derrière un VPN.
  • Pour n’autoriser que l’accès local (par exemple derrière un reverse proxy sur la même machine), remplacez "3000:3000" par "127.0.0.1:3000:3000".
  • Mettez à jour régulièrement l’image.

Conclusion

En quelques minutes, Docker vous permet d’avoir un Grafana fonctionnel, persistant et facile à mettre à jour. Reliez-le à Prometheus, InfluxDB ou à votre base de données, importez quelques tableaux de bord de la communauté, et vous disposez d’un véritable centre de supervision pour votre infrastructure personnelle ou professionnelle.

Sources

Grafana et le logo Grafana sont des marques de Grafana Labs. Les captures d’écran proviennent du site grafana.com.

How to monitor OpenFlow messages with packet sniffer

03/11/2026 Comments off

As a key enabler for software-defined networking (SDN), OpenFlow was initially introduced in the academia as a way to enable innovation on production networks which had traditionally been built with closed and proprietary networking hardware. OpenFlow offloads the high-level routing/forwarding decisions (control plane) from networking devices such as switches, and moves the control plane on to a separate controller. The networking devices then simply forward traffic, as programmed by the external OpenFlow controller. It is the OpenFlow protocol that is used by the OpenFlow controller to program the networking devices.

Suppose you have an OpenFlow testbed running, which consists of an OpenFlow controller and a set of OpenFlow-capable switches. For troubleshooting purposes, you want to capture and examine OpenFlow messages exchanged between the controller and the switches. For this you could monitor exchanged OpenFlow messages either at the controller or the switch side, but what if it is not convenient to do so? Another way is to « sniff » network packets on the OpenFlow control channel and interpret the packets.

In this tutorial, I am going to show how to sniff live OpenFlow control packets and decode OpenFlow messages contained in the packets.

Note that for such packet sniffing to work, SSL must be disabled in any existing OpenFlow control channels between the controller and switches. Let’s assume we are not talking about any production environment here, so the SSL is off for now.

Method One: Sniff OpenFlow Messages via Wireshark GUI

If you want to monitor OpenFlow messages using packet sniffing, the most user-friendly way is via Wireshark, a GUI-based packet sniffer. A nice thing about Wireshark is its extensive list of built-in and custom dissectors. Each dissector decodes some part of packet data based on a specific network protocol. For pretty much any existing network protocol, there is a corresponding Wireshark dissector (either built-in or contributed by a third-party). The OpenFlow protocol is not an exception.

While there is an official OpenFlow dissector, I am going to use a third-party OpenFlow dissector developed by Big Switch Networks, since the former seems to have patchy/incomplete support for different OpenFlow versions.

Here is how to install the OpenFlow dissector for Wireshark.

$ mkdir -p ~/.wireshark/plugins
$ cd ~/.wireshark/plugins
$ wget http://www.projectfloodlight.org/openflow.lua

Now go ahead and start Wireshark.

To verify that the OpenFlow dissector is successfully installed, go to « Help » -> »About Wireshark ».

Lire la suite…

Categories: Réseau Tags: ,

How to set up web-based network traffic monitoring system on Linux

23/10/2026 Comments off

When you are tasked with monitoring network traffic on the local network, you can consider many different options to do it, depending on the scale/traffic of the local network, monitoring platforms/interface, types of backend database, etc.

ntopng is an open-source (GPLv3) network traffic analyzer which provides a web interface for real-time network traffic monitoring. It runs on multiple platforms including Linux and MacOS X. ntopng comes with a simple RMON-like agent with built-in web server capability, and uses Redis-backed key-value server to store time series statistics. You can install ntopng network traffic analyzer on any designated monitoring server connected to your network, and use a web browser to access real-time traffic reports available on the server.

In this tutorial, I will describe how to set up a web-based network traffic monitoring system on Linux by using ntopng.

Features of ntopng

  • Flow-level, protocol-level real-time analysis of local network traffic.
  • Domain, AS (Autonomous System), VLAN level statistics.
  • Geolocation of IP addresses.
  • Deep packet inspection (DPI) based service discovery (e.g., Google, Facebook).
  • Historical traffic analysis (e.g., hourly, daily, weekly, monthly, yearly).
  • Support for sFlow, NetFlow (v5/v9) and IPFIX through nProbe.
  • Network traffic matrix (who’s talking to who?).
  • IPv6 support.

Install ntopng on Linux

The official website offers binary packages for Ubuntu and CentOS. So if you use either platform, you can install these packages.

If you want to build the latest ntopng from its source, follow the instructions below. (Update: these instructions are valid for ntopng 1.0. For ntopng 1.1 and higher, see the updated instructions).

To build ntopng on Debian, Ubuntu or Linux Mint:

$ sudo apt-get install libpcap-dev libglib2.0-dev libgeoip-dev redis-server wget libxml2-dev
$ tar xzf ntopng-1.0.tar.gz -C ~
$ cd ~/ntopng-1.0/
$ ./configure
$ make geoip
$ make

In the above steps, « make geoip » will automatically download a free version of GeoIP databases with wget from maxmind.com. So make sure that your system is connected to the network.

To build ntopng on Fedora:

$ sudo yum install libpcap-devel glib2-devel GeoIP-devel libxml2-devel libxml2-devel redis wget
$ tar xzf ntopng-1.0.tar.gz -C ~
$ cd ~/ntopng-1.0/
$ ./configure
$ make geoip
$ make

To install ntopng on CentOS or RHEL, first set up EPEL repository, and then follow the same instructions as in Fedora above.

Configure ntopng on Linux

After building ntopng, create a configuration directory for ntopng, and prepare default configuration files as follows. I assume that « 192.168.1.0/24 » is the CIDR address prefix of your local network.

$ sudo mkir /etc/ntopng -p
$ sudo -e /etc/ntopng/ntopng.start
--local-networks "192.168.1.0/24"
--interface 1
$ sudo -e /etc/ntopng/ntopng.conf
-G=/var/run/ntopng.pid

Lire la suite…

How do I change, sort, add, remove graphs with Munin?

17/05/2024 Comments off

Graphs on Munin

Enable and disable plugins on each node

graphs muninGraphs are added and removed via symlinks in the /etc/munin/plugins/ directory of the node.

To remove a graph you must remove the symlink and restart the node:

rm /etc/munin/plugins/diskstats
service munin-node restart

To add a graph you must add a symlink in the plugins directory to an executable. eg:

ln -s /usr/share/munin/plugins/diskstats /etc/munin/plugins/diskstats
service munin-node restart

When you restart munin-node it runs immediately and any issues with the plugins appears in /var/log/munin/munin-node.log. If all is going well you’ll see a CONNECT logged every cycle; this records the fact that the master connected to collect the latest data.

Process Backgrounded
2014/03/10-15:59:47 Munin::Node::Server (type Net::Server::Fork) starting! pid(32231)
Resolved [*]:4949 to [::]:4949, IPv6
Not including resolved host [0.0.0.0] IPv4 because it will be handled by [::] IPv6
Binding to TCP port 4949 on host :: with IPv6
2014/03/10-16:00:04 CONNECT TCP Peer: "[::ffff:203.28.51.227]:45965" Local: "[::ffff:50.23.111.122]:4949"
2014/03/10-16:05:04 CONNECT TCP Peer: "[::ffff:203.28.51.227]:46109" Local: "[::ffff:50.23.111.122]:4949"
2014/03/10-16:10:04 CONNECT TCP Peer: "[::ffff:203.28.51.227]:46109" Local: "[::ffff:50.23.111.122]:4949"

Lire la suite…

Aide-mémoire administrateur Linux

24/02/2024 Comments off

administrateur linuxCe document rappelle les commandes et les options les plus utilisées par l’administrateur d’un système Linux. Il s’agit surtout de commandes assez générales, dont tout administrateur aura besoin un jour ou l’autre. Les commandes pour l’utilisateur courant se trouvent dans un autre aide-mémoire. Pour plus d’informations, on consultera les pages de manuel ou les publications du Linux Documentation Project

Une version prête à l’impression recto-verso est disponible pour conserver cet aide-mémoire dans un format facile à ranger dans un tiroir ou sous un clavier.

Informations système

uname – Identification du système.

  • -a : toutes les informations.

dmesg – Messages du noyau (et ceux du boot).

uptime – Durée et charge du système.

free – Occupation de la mémoire.

vmstat – Détails sur l’utilisation de la mémoire.

ipcs – Utilisation des ressources IPC System V.

ipcrm – Suppression de ressources IPC System V.

ldconfig – Valider les bibliothèques dynamiques.

init – Changement de niveau de fonctionnement :

  • 0 : arrêt.
  • 1 : mono-utilisateur,
  • 3 : multi-utilisateurs mode texte,
  • 5 : multi-utilisateurs mode graphique,
  • 6 : redémarrer.

Utilisateurs

useradd – Ajout d’un utilisateur :

useradd -m -p "" linus

crée un compte linus, avec répertoire personnel et mot de passe vide.

Lire la suite…