Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
b12086a4
Commit
b12086a4
authored
Sep 25, 2015
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(systemhealth) style cleanup
parent
e17757c8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
18 deletions
+21
-18
SystemhealthController.php
...llers/OPNsense/Diagnostics/Api/SystemhealthController.php
+18
-16
SystemhealthController.php
...ntrollers/OPNsense/Diagnostics/SystemhealthController.php
+3
-2
No files found.
src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/SystemhealthController.php
View file @
b12086a4
...
@@ -32,6 +32,7 @@ namespace OPNsense\Diagnostics\Api;
...
@@ -32,6 +32,7 @@ namespace OPNsense\Diagnostics\Api;
use
\OPNsense\Base\ApiControllerBase
;
use
\OPNsense\Base\ApiControllerBase
;
use
\OPNsense\Core\Backend
;
use
\OPNsense\Core\Backend
;
/**
/**
* Class ServiceController
* Class ServiceController
* @package OPNsense\SystemHealth
* @package OPNsense\SystemHealth
...
@@ -41,8 +42,8 @@ class SystemhealthController extends ApiControllerBase
...
@@ -41,8 +42,8 @@ class SystemhealthController extends ApiControllerBase
/**
/**
* Return full archive information
* Return full archive information
* @param
array $
xml
* @param
\SimpleXMLElement $xml rrd data
xml
* @return array
* @return array
info set, metadata
*/
*/
private
function
getDataSetInfo
(
$xml
)
private
function
getDataSetInfo
(
$xml
)
{
{
...
@@ -78,10 +79,10 @@ class SystemhealthController extends ApiControllerBase
...
@@ -78,10 +79,10 @@ class SystemhealthController extends ApiControllerBase
/**
/**
* Returns row number of first row with values other than 'NaN'
* Returns row number of first row with values other than 'NaN'
* @param
array $data
* @param
\SimpleXMLElement $data rrd data xml
* @return int
* @return int
rownumber
*/
*/
private
function
findFirstValue
(
$data
=
array
()
)
private
function
findFirstValue
(
$data
)
{
{
$rowNumber
=
0
;
$rowNumber
=
0
;
...
@@ -104,10 +105,10 @@ class SystemhealthController extends ApiControllerBase
...
@@ -104,10 +105,10 @@ class SystemhealthController extends ApiControllerBase
/**
/**
* Return total number of rows in rra
* Return total number of rows in rra
* @param
array $data
* @param
\SimpleXMLElement $data rrd data xml
* @return int
* @return int
total number of rows
*/
*/
private
function
countRows
(
$data
=
array
()
)
private
function
countRows
(
$data
)
{
{
$rowCount
=
0
;
$rowCount
=
0
;
foreach
(
$data
->
database
->
row
as
$item
=>
$row
)
{
foreach
(
$data
->
database
->
row
as
$item
=>
$row
)
{
...
@@ -119,13 +120,13 @@ class SystemhealthController extends ApiControllerBase
...
@@ -119,13 +120,13 @@ class SystemhealthController extends ApiControllerBase
/**
/**
* internal: retrieve selections within range (0-0=full range) and limit number of datapoints (max_values)
* internal: retrieve selections within range (0-0=full range) and limit number of datapoints (max_values)
* @param array $rra_info
* @param array $rra_info
dataset information
* @param int $from_timestamp
* @param int $from_timestamp
from
* @param int $to_timestamp
* @param int $to_timestamp
to
* @param
$max_
values
* @param
int $max_values approx. max number of
values
* @return array
* @return array
*/
*/
private
function
getSelection
(
$rra_info
=
array
(),
$from_timestamp
=
0
,
$to_timestamp
=
0
,
$max_values
=
120
)
private
function
getSelection
(
$rra_info
,
$from_timestamp
,
$to_timestamp
,
$max_values
)
{
{
$full_range
=
false
;
$full_range
=
false
;
if
(
$from_timestamp
==
0
&&
$to_timestamp
==
0
)
{
if
(
$from_timestamp
==
0
&&
$to_timestamp
==
0
)
{
...
@@ -183,7 +184,7 @@ class SystemhealthController extends ApiControllerBase
...
@@ -183,7 +184,7 @@ class SystemhealthController extends ApiControllerBase
break
;
break
;
}
}
}
}
if
(
$overview
!=
0
)
{
if
(
$overview
!=
0
)
{
$condensed_rowCount
=
(
int
)(
$rra_info
[
$last_rra_key
][
"available_rows"
]
/
$overview
);
$condensed_rowCount
=
(
int
)(
$rra_info
[
$last_rra_key
][
"available_rows"
]
/
$overview
);
}
else
{
}
else
{
$condensed_rowCount
=
0
;
$condensed_rowCount
=
0
;
...
@@ -208,7 +209,7 @@ class SystemhealthController extends ApiControllerBase
...
@@ -208,7 +209,7 @@ class SystemhealthController extends ApiControllerBase
* @param array $rra_info
* @param array $rra_info
* @return array
* @return array
*/
*/
private
function
getMaxRange
(
$rra_info
=
array
()
)
private
function
getMaxRange
(
$rra_info
)
{
{
// count the number if rra's (sets), deduct 1 as we need the counter to start at 0
// count the number if rra's (sets), deduct 1 as we need the counter to start at 0
$last_rra_key
=
count
(
$rra_info
)
-
1
;
$last_rra_key
=
count
(
$rra_info
)
-
1
;
...
@@ -235,7 +236,8 @@ class SystemhealthController extends ApiControllerBase
...
@@ -235,7 +236,8 @@ class SystemhealthController extends ApiControllerBase
/**
/**
* translate rrd data to usable format for d3 charts
* translate rrd data to usable format for d3 charts
* @param array $data
* @param array $data
* @param boolean $applyInverse
* @param boolean $applyInverse inverse selection (multiply -1)
* @param array $field_units mapping for descriptive field names
* @return array
* @return array
*/
*/
private
function
translateD3
(
$data
,
$applyInverse
,
$field_units
)
private
function
translateD3
(
$data
,
$applyInverse
,
$field_units
)
...
...
src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/SystemhealthController.php
View file @
b12086a4
...
@@ -28,11 +28,13 @@
...
@@ -28,11 +28,13 @@
*/
*/
namespace
OPNsense\Diagnostics
;
namespace
OPNsense\Diagnostics
;
use
OPNsense\Base\IndexController
;
/**
/**
* Class IndexController
* Class IndexController
* @package OPNsense\Proxy
* @package OPNsense\Proxy
*/
*/
class
SystemhealthController
extends
\OPNsense\Base\
IndexController
class
SystemhealthController
extends
IndexController
{
{
public
function
indexAction
()
public
function
indexAction
()
{
{
...
@@ -40,4 +42,3 @@ class SystemhealthController extends \OPNsense\Base\IndexController
...
@@ -40,4 +42,3 @@ class SystemhealthController extends \OPNsense\Base\IndexController
$this
->
view
->
pick
(
'OPNsense/Diagnostics/systemhealth'
);
$this
->
view
->
pick
(
'OPNsense/Diagnostics/systemhealth'
);
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment