Commit 783a9010 authored by Ad Schellevis's avatar Ad Schellevis

(SystemHealth) work in progress

parent ecf9eb5f
......@@ -36,7 +36,7 @@ use \OPNsense\Core\Backend;
* Class ServiceController
* @package OPNsense\SystemHealth
*/
class SystemHealthController extends ApiControllerBase
class SystemhealthController extends ApiControllerBase
{
/**
......@@ -242,18 +242,7 @@ class SystemHealthController extends ApiControllerBase
$timestamp = $rowValues['timestamp'] * 1000; // javascript works with milliseconds
foreach ($data['columns'] as $key => $value) {
$name = $value['name'];
if ($value['type'] == "GAUGE") {
// return values as float
$value = $rowValues['condensed_values'][$key];
} else {
// return values as int
if ((string)$rowValues['condensed_values'][$key] != "NaN") {
$value = (int)$rowValues['condensed_values'][$key];
} else {
$value = $rowValues['condensed_values'][$key];
}
}
$value = $rowValues['condensed_values'][$key];
if (!isset($d3_data[$key])) {
$d3_data[$key] = [];
$d3_data[$key]["area"] = true;
......@@ -263,7 +252,6 @@ class SystemHealthController extends ApiControllerBase
$d3_data[$key]["key"] = $name;
}
$d3_data[$key]["values"] = [];
}
if ($value == "NaN") {
......@@ -311,7 +299,7 @@ class SystemHealthController extends ApiControllerBase
"stepSize" => $data['condensed_step'],
"from_timestamp" => $from_timestamp,
"to_timestamp" => $to_timestamp,
"count" => count($d3_data[0]['values']),
"count" => isset($d3_data[0]) ? count($d3_data[0]['values']) : 0,
"data" => $d3_data
];
}
......@@ -555,7 +543,7 @@ class SystemHealthController extends ApiControllerBase
if ($xml !== false) {
// we only use the average databases in any RRD, remove the rest to avoid strange behaviour.
for ($count = count($xml->rra) -1; $count >= 0; $count--) {
if ((string)$xml->rra[$count]->cf != "AVERAGE") {
if (trim((string)$xml->rra[$count]->cf) != "AVERAGE") {
unset($xml->rra[$count]);
}
......
......@@ -32,7 +32,7 @@ namespace OPNsense\Diagnostics;
* Class IndexController
* @package OPNsense\Proxy
*/
class SystemHealthController extends \OPNsense\Base\IndexController
class SystemhealthController extends \OPNsense\Base\IndexController
{
public function indexAction()
{
......
[query.details]
command:/Users/josschellevis/Development/opnsense/scripts/systemhealth/queryDetails.py
[list]
command:/usr/local/opnsense/scripts/systemhealth/listReports.py
parameters:
type:script_output
message:request rrd graph details
message:list systemhealth items
[fetch]
command:/usr/local/opnsense/scripts/systemhealth/fetchData.py
parameters: %s
type:script_output
message:fetch systemhealth report data
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment