---
title: "Zabbix — Supervision IT Infrastructure"
domain: monitoring
subdomain: zabbix
type: snippet
tags: [zabbix, monitoring, snmp, noc, alerting, infra, supervision]
difficulty: intermediate
status: stable
updated: "Fri Jun 19 2026 00:00:00 GMT+0000 (Coordinated Universal Time)"
---
## Présentation

Zabbix est une plateforme de supervision IT open source qui monitore :
- **Serveurs** : CPU, RAM, disque, processus (agent Zabbix)
- **Réseau** : interfaces, bande passante, disponibilité (SNMP, ICMP)
- **Services** : HTTP, SSH, bases de données, ports
- **Applications** : métriques custom via trapper ou API

---

## Déploiement Docker

```yaml
# docker-compose.yml
version: '3'
services:
  zabbix-server:
    image: zabbix/zabbix-server-pgsql:ubuntu-6.4-latest
    ports:
      - "10051:10051"
    environment:
      - DB_SERVER_HOST=postgres
      - POSTGRES_USER=zabbix
      - POSTGRES_PASSWORD=zabbix_pass
      - POSTGRES_DB=zabbixdb
    depends_on:
      - postgres

  zabbix-web:
    image: zabbix/zabbix-web-nginx-pgsql:ubuntu-6.4-latest
    ports:
      - "8080:8080"
    environment:
      - DB_SERVER_HOST=postgres
      - POSTGRES_USER=zabbix
      - POSTGRES_PASSWORD=zabbix_pass
      - POSTGRES_DB=zabbixdb
      - ZBX_SERVER_HOST=zabbix-server
      - PHP_TZ=Europe/Paris
    depends_on:
      - zabbix-server

  postgres:
    image: postgres:15
    environment:
      - POSTGRES_USER=zabbix
      - POSTGRES_PASSWORD=zabbix_pass
      - POSTGRES_DB=zabbixdb
    volumes:
      - pgdata:/var/lib/postgresql/data

  # Agent sur le serveur Zabbix lui-même
  zabbix-agent:
    image: zabbix/zabbix-agent2:ubuntu-6.4-latest
    environment:
      - ZBX_HOSTNAME=zabbix-server
      - ZBX_SERVER_HOST=zabbix-server

volumes:
  pgdata:
```

```
# Accès : http://localhost:8080
# Login : Admin / zabbix (changer immédiatement)
```

---

## Agent Zabbix — Installation

```bash
# Ubuntu/Debian — Agent 2 (recommandé)
wget https://repo.zabbix.com/zabbix/6.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_6.4-1+ubuntu22.04_all.deb
dpkg -i zabbix-release_6.4-1+ubuntu22.04_all.deb
apt update && apt install -y zabbix-agent2

# Configuration /etc/zabbix/zabbix_agent2.conf
Server=192.168.1.100          # IP serveur Zabbix
ServerActive=192.168.1.100
Hostname=mon-serveur           # Nom de l'hôte (doit correspondre dans Zabbix)
LogFile=/var/log/zabbix/zabbix_agent2.log

systemctl enable --now zabbix-agent2

# Windows — PowerShell
# Télécharger zabbix_agent2 MSI depuis zabbix.com
msiexec /i zabbix_agent2.msi /l*v install.log `
  LISTENPORT=10050 SERVER=192.168.1.100 HOSTNAME=pc-windows

# Vérification connectivité depuis le serveur
zabbix_get -s 192.168.1.50 -p 10050 -k system.uptime
```

---

## Templates — Configuration rapide

```
# Templates officiels à utiliser (Configuration > Hosts > Templates)
Linux by Zabbix agent      → CPU, RAM, disque, réseau, processus
Windows by Zabbix agent    → WMI, services, event log
Network devices by SNMP    → Switches, routeurs
Apache by Zabbix agent     → Métriques Apache
Nginx by Zabbix agent      → Connexions, requêtes/s
PostgreSQL by Zabbix agent → Sessions, locks, replication
Docker by Zabbix agent     → Conteneurs, CPU/RAM
```

---

## Ajouter un hôte

```
Configuration > Hosts > Create host
  Host name : mon-serveur
  Groups : Linux servers
  Interfaces : Agent → IP 192.168.1.50 / Port 10050
  Templates : Linux by Zabbix agent

Monitoring > Hosts > Vérifier "ZBX" vert = agent OK
```

---

## Triggers — Alertes

### Triggers clés à configurer

```
# CPU élevé
{mon-serveur:system.cpu.util[,idle].avg(5m)} < 20

# RAM faible
{mon-serveur:vm.memory.size[pavailable].last()} < 10

# Disque plein
{mon-serveur:vfs.fs.size[/,pfree].last()} < 10

# Host inaccessible
{mon-serveur:agent.ping.nodata(3m)} = 1

# Processus arrêté
{mon-serveur:proc.num[nginx].last()} = 0

# Port fermé
{mon-serveur:net.tcp.port[,443].last()} = 0
```

### Sévérités

| Niveau | Couleur | Usage |
|--------|---------|-------|
| Disaster | Rouge foncé | Service critique DOWN |
| High | Rouge | Impact service important |
| Average | Orange | Anomalie significative |
| Warning | Jaune | Seuil approché |
| Information | Bleu | Info non critique |
| Not classified | Gris | À catégoriser |

---

## Alertes — Notifications

```bash
# Configuration Media Types
Administration > Media types > Email

# SMTP
SMTP server : smtp.gmail.com
SMTP port : 587
SMTP helo : gmail.com
From : zabbix@company.com
Security : STARTTLS
Username / Password : credentials

# Webhook Slack
Administration > Media types > Slack
  WEBHOOK_URL : https://hooks.slack.com/services/XXX
  Message template :
    "🔴 {TRIGGER.SEVERITY} — {HOST.NAME}\n{TRIGGER.NAME}\n{ITEM.VALUE}"

# Configuration User media
Administration > Users > Admin > Media
  Type : Email ou Slack
  Send to : email ou channel
  Severity : cocher les niveaux à notifier
```

---

## Supervision réseau (SNMP)

```bash
# Activer SNMP sur switch/routeur
# Cisco IOS
snmp-server community public RO
snmp-server community private RW

# Zabbix — Ajouter hôte SNMP
Configuration > Hosts > Create host
  Interface : SNMP → IP switch / Port 161
  Templates : Network Generic Device by SNMP

# Test SNMP depuis Zabbix
snmpwalk -v2c -c public 192.168.1.1 1.3.6.1.2.1.1.1.0
# Doit retourner la description du device
```

---

## Dashboards NOC

```
# Dashboard recommandé pour NOC
Monitoring > Dashboard > Create

Widgets :
  - Map (topologie réseau avec statuts)
  - Problems (liste des problèmes actifs)
  - Graph (CPU/RAM des serveurs critiques)
  - Clock (horloge)
  - Host availability (hôtes UP/DOWN)
  - Top 10 hosts (plus chargés)

# Vue plein écran (mode NOC)
Monitoring > Dashboard → Kiosk mode (icône plein écran)
```

---

## Intégration Grafana

```yaml
# Plugin Zabbix dans Grafana
Administration > Plugins > Zabbix

# Datasource
Configuration > Data Sources > Add > Zabbix
  URL : http://zabbix-web:8080/api_jsonrpc.php
  Username : Admin
  Password : zabbix
  Trends : enabled (pour données historiques > 1h)

# Dashboard populaire
# Grafana.com → Dashboard ID 13571 (Zabbix Server Health)
# Dashboard ID 9338  (Zabbix — Linux Overview)
```

---

## API Zabbix

```python
import requests

url = "http://localhost:8080/api_jsonrpc.php"

def zabbix_call(method, params, auth=None):
    payload = {
        "jsonrpc": "2.0",
        "method": method,
        "params": params,
        "id": 1,
    }
    if auth:
        payload["auth"] = auth
    r = requests.post(url, json=payload)
    return r.json()["result"]

# Login
token = zabbix_call("user.login", {"username": "Admin", "password": "zabbix"})

# Lister hôtes avec problèmes
hosts = zabbix_call("host.get", {
    "output": ["hostid", "host", "status"],
    "filter": {"status": 0}
}, auth=token)

# Lister les triggers actifs
problems = zabbix_call("problem.get", {
    "output": "extend",
    "selectHosts": ["host"],
    "recent": True,
    "severities": [3, 4, 5]  # Average, High, Disaster
}, auth=token)
```
