Files
zabbix-agent-deployment/README.md

139 lines
3.9 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Zabbix Agent Deployment
Skripte zur automatischen Installation und Aktualisierung des Zabbix Agent 2 (Version 7.4) auf Linux- und Windows-Systemen lokal oder per SSH-Remote-Deployment.
---
## Voraussetzungen
**Linux:**
- Zielhost: Debian 11/12/13 oder Ubuntu 20.04 / 22.04 / 24.04
- SSH Key-Authentifizierung eingerichtet (`~/.ssh/config`)
- Zielhost muss als `root` erreichbar sein
- `wget` auf dem Zielhost vorhanden
**Windows:**
- Windows 10/11 oder Windows Server 2016+
- PowerShell 5.1 oder neuer
- Ausführung als Administrator erforderlich
---
## Konfiguration
**Linux** in `install-zabbix-agent.sh` und `update-zabbix-agent.sh`:
```bash
ZABBIX_SERVER="zabbix.example.com" # Zeile 16
```
**Windows** in `install-update-zabbix-agent.ps1`:
```powershell
$ZabbixServer = "zabbix.example.com" # Zabbix-Server-Adresse
$ZabbixVersion = "7.4.2" # Bei neuen Releases anpassen
$ProxyList = @( # Proxy-Liste manuell pflegen
"http://proxy01.example.com:3128"
"http://proxy02.example.com:3128"
)
```
---
## Skripte
### `install-zabbix-agent.sh`
Installiert Zabbix Agent 2 auf dem lokalen System.
```bash
sudo bash install-zabbix-agent.sh <zabbix-hostname>
```
Was es tut:
- Erkennt automatisch Debian oder Ubuntu (inkl. Version)
- Richtet das Zabbix 7.4 Repository ein
- Installiert `zabbix-agent2`
- Setzt `Hostname` und `ServerActive` in der Konfiguration
- Aktiviert und startet den Dienst
---
### `deploy-zabbix-agent.sh`
Installiert Zabbix Agent 2 auf einem entfernten Host per SSH.
```bash
bash deploy-zabbix-agent.sh <ssh-config-name> <zabbix-hostname>
```
Beispiel:
```bash
bash deploy-zabbix-agent.sh webserver webserver-prod-01
```
`<ssh-config-name>` ist der Host-Eintrag aus `~/.ssh/config`. User, Port und Key werden automatisch von dort übernommen.
---
### `update-zabbix-agent.sh`
Aktualisiert einen vorhandenen Zabbix Agent 2 auf Version 7.4 auf dem lokalen System.
```bash
sudo bash update-zabbix-agent.sh
```
Was es tut:
- Prüft ob `zabbix-agent2` installiert ist
- Richtet das Zabbix 7.4 Repository ein
- Führt das Upgrade durch **bestehende Konfiguration bleibt erhalten**
- Interaktive Rückfragen von `dpkg`/`apt` werden automatisch unterdrückt
- Startet den Dienst neu
---
### `deploy-update-zabbix-agent.sh`
Aktualisiert Zabbix Agent 2 auf einem entfernten Host per SSH.
```bash
bash deploy-update-zabbix-agent.sh <ssh-config-name>
```
Beispiel:
```bash
bash deploy-update-zabbix-agent.sh webserver
```
---
### `install-update-zabbix-agent.ps1`
Installiert oder aktualisiert Zabbix Agent 2 auf Windows erkennt automatisch ob bereits eine Version vorhanden ist.
```powershell
PowerShell -ExecutionPolicy Bypass -File install-update-zabbix-agent.ps1
```
Was es tut:
- Erkennt automatisch: Neuinstallation oder Update
- Interaktive Eingabe des Zabbix-Hostnamens (Standard: Computername)
- Interaktive Proxy-Auswahl aus gepflegter Liste oder direkte Verbindung
- Lädt die MSI von `cdn.zabbix.com` herunter
- Installiert/aktualisiert still (`/qn`) ohne Benutzerinteraktion beim MSI
- Setzt `SERVER`, `SERVERACTIVE` und `HOSTNAME` direkt beim MSI-Aufruf
- Startet den Dienst automatisch
---
## Ablauf nach der Installation
Den Host im Zabbix-Frontend anlegen, falls noch nicht vorhanden:
**Configuration → Hosts → Create host**
- Host name: identisch mit dem beim Skriptaufruf angegebenen `<zabbix-hostname>`
- Interface: Agent (aktiv) keine IP-Adresse notwendig bei reinem Aktiv-Modus
- Template: z.B. `Linux by Zabbix agent active` bzw. `Windows by Zabbix agent active`
---
## Hinweise
- TrueNAS SCALE: Package-Management ist gesperrt, Agent-Installation nicht möglich. Überwachung via **SNMP** empfohlen (Services → SNMP im TrueNAS Web-Interface).
- Der SSH Post-Quantum-Hinweis (`WARNING: connection is not using a post-quantum key exchange algorithm`) ist eine reine Warnung des OpenSSH-Clients und hat keinen Einfluss auf die Funktion.