diff --git a/install.sh b/install.sh index 676a836..55c2e28 100755 --- a/install.sh +++ b/install.sh @@ -14,9 +14,12 @@ # curl -fsSL https://gitea.m-m.bio/mm/netbird-telegraf-installer/raw/branch/main/install.sh | sh -s -- --name # Optionen: # --name Node-Name (Default: hostname -s) -# --collector Collector-IP im NetBird (Default: 100.83.134.46) +# --token Bearer-Token des Reverse-Proxys (Pflicht) +# --collector Direktweg im NetBird statt Reverse Proxy # --role Zusatz-Profil: proxmox | apache | docker | none (Default: auto) # --pve-token Proxmox API-Token 'user@pve!name=secret' (nur --role proxmox) +# --pve-node Name des PVE-Knotens im PVE-Baum (Default: per pvesh erkannt) +# --pve-url PVE-API-URL (Default: https://127.0.0.1:8006/api2/json) # --apache-log

Apache-Access-Log (Default: /var/log/apache2/access.log) # --uninstall Telegraf + Konfiguration entfernen # ============================================================================ @@ -31,6 +34,8 @@ TELEGRAF_TOKEN="${TELEGRAF_TOKEN:-}" NODE_NAME="${NODE_NAME:-$(hostname -s 2>/dev/null || hostname)}" ROLE="auto" PVE_TOKEN="${PVE_TOKEN:-}" +PVE_NODE="${PVE_NODE:-}" +PVE_URL="${PVE_URL:-}" APACHE_LOG="/var/log/apache2/access.log" TELEGRAF_VERSION="${TELEGRAF_VERSION:-1.40.0}" REPO_RAW="https://gitea.m-m.bio/mm/netbird-telegraf-installer/raw/branch/main" @@ -43,6 +48,8 @@ while [ $# -gt 0 ]; do --token) TELEGRAF_TOKEN="$2"; shift 2 ;; --role) ROLE="$2"; shift 2 ;; --pve-token) PVE_TOKEN="$2"; shift 2 ;; + --pve-node) PVE_NODE="$2"; shift 2 ;; + --pve-url) PVE_URL="$2"; shift 2 ;; --apache-log) APACHE_LOG="$2"; shift 2 ;; --uninstall) UNINSTALL=1; shift ;; -h|--help) sed -n '2,24p' "$0"; exit 0 ;; @@ -212,6 +219,8 @@ PROM_URL=$PROM_URL LOKI_URL=$LOKI_URL TELEGRAF_TOKEN=$TELEGRAF_TOKEN PVE_TOKEN=$PVE_TOKEN +PVE_NODE=$PVE_NODE +PVE_URL=$PVE_URL APACHE_LOG=$APACHE_LOG EOF umask 022 diff --git a/telegraf/proxmox.conf b/telegraf/proxmox.conf index c28a50d..7983d16 100644 --- a/telegraf/proxmox.conf +++ b/telegraf/proxmox.conf @@ -1,12 +1,19 @@ -# Proxmox VE: VM/CT-Metriken über die PVE-API (Token mit PVEAuditor-Rolle) +# Proxmox VE: Node-, VM- und Container-Metriken über die PVE-API. # Token anlegen (auf dem PVE-Host): # pveum user add telegraf@pve # pveum user token add telegraf@pve monitoring -privsep 1 # pveum acl modify / -token 'telegraf@pve!monitoring' -role PVEAuditor -# Ergebnis "telegraf@pve!monitoring=xxxxxxxx-…" als --pve-token übergeben. +# Ergebnis "telegraf@pve!monitoring=" als --pve-token übergeben. +# +# WICHTIG: node_name ist der Name des PVE-KNOTENS (steht links im PVE-Baum, +# z. B. "pve" oder "node1"), NICHT der Hostname der überwachten Maschine. +# Läuft Telegraf nicht auf dem PVE-Host selbst, braucht es --pve-url mit der +# Adresse eines erreichbaren PVE-Knotens (https://pve1:8006/api2/json). [[inputs.proxmox]] - base_url = "https://127.0.0.1:8006/api2/json" + base_url = "${PVE_URL}" api_token = "${PVE_TOKEN}" - node_name = "${NODE_NAME}" + node_name = "${PVE_NODE}" insecure_skip_verify = true - response_timeout = "10s" + response_timeout = "20s" + # vmid und status als Tags: sonst sind VM-Metriken nicht pro Gast zuordenbar + additional_vmstats_tags = ["vmid", "status"]