Webhook-Events & Health-Endpoint

- Notifier: controllerUnreachable, loginNewIp, updateAvailable
- Login von neuer IP -> Webhook (Abgleich gegen audit_log)
- cron_sync meldet nicht erreichbare Controller; cron_cleanup prüft täglich
  optional auf Updates und meldet Verfügbarkeit
- health.php: Status-Endpoint (DB; optional Controller per ?deep=1&token=)
This commit is contained in:
Claude 2026-06-05 20:49:06 +00:00
parent c7f9b7d39c
commit 0b1d4ec3b8
No known key found for this signature in database
5 changed files with 116 additions and 0 deletions

View file

@ -41,6 +41,24 @@ class Notifier {
curl_close($ch);
}
/** Controller nicht erreichbar (z.B. beim Sync). */
public static function controllerUnreachable($siteName, $detail = '') {
self::send("⚠️ UniFi-Controller für \"{$siteName}\" nicht erreichbar." . ($detail ? " ({$detail})" : ''),
['type' => 'controller_unreachable', 'site' => $siteName, 'detail' => $detail]);
}
/** Anmeldung von einer bisher unbekannten IP. */
public static function loginNewIp($email, $ip) {
self::send("🔐 Neue Anmeldung für {$email} von IP {$ip}.",
['type' => 'login_new_ip', 'email' => $email, 'ip' => $ip]);
}
/** Update verfügbar. */
public static function updateAvailable($sha) {
self::send("⬆️ Update verfügbar (" . substr((string)$sha, 0, 7) . "). Siehe Administration → System-Update.",
['type' => 'update_available', 'sha' => $sha]);
}
/** Bequemer Helfer für erstellte Voucher. */
public static function voucherCreated($count, $siteName, $byUser = null) {
$who = $byUser ? " von {$byUser}" : '';