La configuración gira en torno a tres conceptos que debes dominar:
Items (Métricas a recolectar):
Define QUÉ dato recolectar y CON QUÉ FRECUENCIA. Ejemplos: system.cpu.util cada 30s, vm.memory.size[available] cada 60s, net.if.in[eth0] cada 60s.
Triggers (Condiciones de alerta):
Define CUÁNDO generar una alerta basándose en valores de items:
• avg(system.cpu.util,5m) > 90: CPU promedio > 90% en 5 minutos
• last(vm.memory.size[pavailable]) < 10: menos del 10% RAM libre
Templates (Plantillas reutilizables):
Agrupan items, triggers y gráficas para un tipo de dispositivo. Al aplicar "Linux by Zabbix agent" a un host, automáticamente monitoreas CPU, RAM, disco, red, procesos, y más de 50 métricas.
Zabbix incluye 400+ templates oficiales para:
Apache, Nginx, MySQL, PostgreSQL, Docker, Kubernetes, AWS, Azure, VMware, Cisco, Juniper, F5, y más.
Tip de configuración: Usa el "Expression builder" en la UI para construir expresiones de triggers sin errores de sintaxis.
# ── INSTALAR AGENTE EN HOST REMOTO (Ubuntu 22.04) ─────
wget https://repo.zabbix.com/zabbix/6.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_6.4-1+ubuntu22.04_all.deb
sudo dpkg -i zabbix-release_6.4-1+ubuntu22.04_all.deb
sudo apt update && sudo apt install -y zabbix-agent2
sudo nano /etc/zabbix/zabbix_agent2.conf
# Cambiar:
# Server=192.168.1.10 ← IP de tu Zabbix Server
# ServerActive=192.168.1.10 ← Para modo activo
# Hostname=mi-servidor-web ← Debe coincidir en Zabbix UI
sudo systemctl enable --now zabbix-agent2
# ── AÑADIR HOST EN WEB UI ──────────────────────────────
# Configuration → Hosts → Create host
# Host name: mi-servidor-web
# Groups: Linux servers
# Interface → Type: Agent | IP: 192.168.1.100 | Port: 10050
# Templates → Add: "Linux by Zabbix agent"
# → Update
# ── CREAR TRIGGERS PERSONALIZADOS ─────────────────────
# Configuration → Hosts → [host] → Triggers → Create trigger
# Trigger 1: CPU alta sostenida
# Expression: avg(/mi-servidor/system.cpu.util,10m)>85
# Recovery: avg(/mi-servidor/system.cpu.util,5m)<70
# Severity: High
# Trigger 2: Disco crítico
# Expression: last(/mi-servidor/vfs.fs.size[/,pfree])<5
# Severity: Disaster
# Trigger 3: Apache caído
# Expression: last(/mi-servidor/net.tcp.service[http,,80])=0
# Severity: High
# ── API REST ZABBIX ────────────────────────────────────
# Obtener token de autenticación:
curl -s -X POST http://localhost:8080/api_jsonrpc.php \
-H "Content-Type: application/json-rpc" \
-d '{"jsonrpc":"2.0","method":"user.login",
"params":{"username":"Admin","password":"zabbix"},"id":1}'