mirror of
https://github.com/linuxserver/Heimdall-Apps.git
synced 2026-02-04 19:06:22 +08:00
* feat: enhance scrutiny foundation app * chore: update scrutiny to use spaces rather than tabsuse spaces rather than tabs
64 lines
1.3 KiB
PHP
64 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\SupportedApps\Scrutiny;
|
|
|
|
class Scrutiny extends \App\SupportedApps implements \App\EnhancedApps
|
|
{
|
|
public $config;
|
|
|
|
public function __construct()
|
|
{
|
|
}
|
|
|
|
public function test()
|
|
{
|
|
$attrs = [
|
|
"headers" => ["Accept" => "application/json"],
|
|
];
|
|
$test = parent::appTest($this->url("health"), $attrs);
|
|
echo $test->status;
|
|
}
|
|
|
|
public function livestats()
|
|
{
|
|
$status = "inactive";
|
|
$data = [
|
|
"passed" => 0,
|
|
"failed" => 0,
|
|
];
|
|
|
|
$attrs = [
|
|
"headers" => ["Accept" => "application/json"],
|
|
];
|
|
|
|
$response = json_decode(
|
|
parent::execute($this->url("summary"), $attrs)->getBody()
|
|
);
|
|
|
|
$summary = $response->data->summary;
|
|
|
|
foreach ($summary as $entry) {
|
|
$device_status = $entry->device->device_status;
|
|
|
|
if ($device_status == 0) {
|
|
$data["passed"]++;
|
|
} else {
|
|
$status = "active";
|
|
$data["failed"]++;
|
|
}
|
|
}
|
|
|
|
return parent::getLiveStats($status, $data);
|
|
}
|
|
|
|
public function url($endpoint)
|
|
{
|
|
$api_url =
|
|
parent::normaliseurl($this->config->url) .
|
|
"api/" .
|
|
$endpoint;
|
|
|
|
return $api_url;
|
|
}
|
|
}
|