📥 API herunterladen ⚙️ Verwaltung

📡 Proxmox Networking Monitor API (PHP Wrapper)

Diese API-Wrapper-Klasse ProxmoxMonitorAPI ermöglicht die einfache Nutzung des Networking Monitoringsystems per PHP. Die Klasse kommuniziert mit dem Server unter https://monitor.trynxt.com/monitor und erfordert keine direkte Datenbankverbindung.

🔧 Initialisierung

$api = new ProxmoxMonitorAPI();

1. 🔐 createAuthentication

Beschreibung: Legt einen Zugang für den Monitor an. Nur einmal pro Server nötig.

Parameter:

Beispiel
$api->createAuthentication("https://1.2.3.4:8006", "root@pam!token=xyz", "pve01", "trafficmonitorauthkey");
{
  "status": "auth_created",
  "uuid": "abc-123-xyz",
  "auth_key": "trafficmonitorauthkey",
  "auth_token": "geheimerZugriffstoken"
}

2. 🔓 deleteAuthentication

Beschreibung: Entfernt eine Authentifizierung samt aller zugehörigen Monitore.

Parameter:

Beispiel
$api->deleteAuthentication("abc-123", "geheimerZugriffstoken", "trafficmonitorauthkey");
{
  "status": "authentication_deleted",
  "uuid": "abc-123"
}

3. 📈 createMonitor

Beschreibung: Erstellt ein neues Monitoring für eine VM.

Parameter:

Beispiel
$api->createMonitor("abc-123", "auth_token", 100, 30);
{
  "status": "monitor_created"
}

4. 🔍 getMonitor

Beschreibung: Gibt aktuelle Traffic- und Zeitinformationen zurück.

Beispiel
$api->getMonitor("abc-123", "auth_token");
{
  "uuid": "abc-123",
  "vmid": 100",
  "total_netin_bytes": 23421421,
  "total_netout_bytes": 10921903,
  "create_date": "2025-04-10 22:00:00",
  "expire_at": "2025-05-10 22:00:00"
}

5. 🔁 updateMonitor

Beschreibung: Verlängert die Laufzeit eines Monitors.

Beispiel
$api->updateMonitor("abc-123", "auth_token", 60);
{
  "status": "updated",
  "new_days": 60
}

6. ❌ deleteMonitor

Beschreibung: Entfernt einen Monitor vollständig.

Beispiel
$api->deleteMonitor("abc-123", "auth_token", 100);
{
  "status": "monitor_deleted",
  "uuid": "abc-123",
  "vmid": 100
}

7. 🔄 resetVM

Beschreibung: Setzt den Traffic einer bestimmten VM zurück (NetIn & NetOut = 0) und aktualisiert das Start- und Ablaufdatum neu.

Parameter:

Beispiel
$api->resetVM("abc-123", "auth_token", 100);
{
  "status": "vm_reset",
  "uuid": "abc-123",
  "vmid": 100
}

8. 📋 getAllMonitors

Beschreibung: Gibt eine Liste aller Monitore zurück, die zu einer bestimmten Authentifizierung gehören.

Parameter:

Beispiel
$api->getAllMonitors("abc-123", "auth_token");
{
  "monitors": [
    {
      "uuid": "abc-123",
      "vmid": 100,
      "total_netin_bytes": 23421421,
      "total_netout_bytes": 10921903,
      "create_date": "2025-04-10 22:00:00",
      "expire_at": "2025-05-10 22:00:00",
      "days": 30
    },
    {
      "uuid": "abc-123",
      "vmid": 101,
      "total_netin_bytes": 842134,
      "total_netout_bytes": 294822,
      "create_date": "2025-04-15 11:00:00",
      "expire_at": "2025-05-15 11:00:00",
      "days": 30
    }
  ]
}

9. 🧾 getAllAuthentications

Beschreibung: Gibt alle authentifizierten Proxmox-Nodes (Zugänge) zurück, die einem bestimmten Benutzer gehören.

Parameter:

Beispiel
$api->getAllAuthentications("deine_email", "dein_passwort", "testkey");
{
  "authentications": [
    {
      "uuid": "e5b9137d-3dbe-476f-b15a-28a835f1541a",
      "auth_key": "testkey",
      "auth_token": "a1b2c3d4",
      "host": "https://1.2.3.4:8006",
      "token": "root@pam!token=xyz",
      "node": "pve01"
    },
    {
      "uuid": "9f223a14-2c8b-410d-8db0-93d8b2a9b1f4",
      "auth_key": "testkey",
      "auth_token": "e4r5t6y7",
      "host": "https://1.2.3.5:8006",
      "token": "root@pam!token=abc",
      "node": "pve02"
    }
  ]
}

Hinweis: Alle Funktionen benötigen gültige Zugangsdaten (uuid + auth_token), um Missbrauch zu verhindern.