Zwei Leuchttürme

Summarized Status of Uptime-Kuma

Uptime Kuma is a lightweight self hosted monitoring system for IT infrastructure (ping, Webpages, Cronjobs, etc). For my Homeassistant Dashboard I needed a short traffic light as "All ok" or "Something went wrong". 

I did it with a short Webpage that is included via an iFrame.

You need a custom statuspage from Uptime Kuma with all relevant sensors included. This statuspage provides a JSON array with the current statuses of all sensors automaticly. I fetch this JSON array with a small PHP Skript and iterate through it, to check if any sensor is NOTOK.

Code example:

<meta http-equiv="refresh" content="30">
<?php
$errorcounter=0;
$string = file_get_contents("https://<your-uptimekuma-url>/api/status-page/heartbeat/<your-statuspage-slug>");
$data=json_decode($string,true);
foreach ($data['heartbeatList'] as $deviceId => $entries) {
    $lastEntry = end($entries);
    if($lastEntry['status']!=1) {$errorcounter++;};
}
if ($errorcounter == 0) 
        {echo "OK";}
    else 
        {echo "Not OK";};
?>