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
c4beabc6
Commit
c4beabc6
authored
Dec 15, 2015
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(diagnostics) add system activity
parent
6ea14da0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
236 additions
and
0 deletions
+236
-0
ActivityController.php
...p/controllers/OPNsense/Diagnostics/ActivityController.php
+44
-0
ActivityController.php
...ntrollers/OPNsense/Diagnostics/Api/ActivityController.php
+54
-0
systemactivity.volt
...se/mvc/app/views/OPNsense/Diagnostics/systemactivity.volt
+138
-0
No files found.
src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/ActivityController.php
0 → 100644
View file @
c4beabc6
<?php
/**
* Copyright (C) 2015 Deciso B.V.
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
namespace
OPNsense\Diagnostics
;
use
OPNsense\Base\IndexController
;
/**
* Class IndexController
* @package OPNsense\Proxy
*/
class
ActivityController
extends
IndexController
{
public
function
indexAction
()
{
$this
->
view
->
title
=
"System Activity"
;
$this
->
view
->
pick
(
'OPNsense/Diagnostics/systemactivity'
);
}
}
src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/ActivityController.php
0 → 100644
View file @
c4beabc6
<?php
/**
* Copyright (C) 2015 Deciso B.V.
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
namespace
OPNsense\Diagnostics\Api
;
use
\OPNsense\Base\ApiControllerBase
;
use
\OPNsense\Core\Backend
;
/**
* Class ActivityController
* @package OPNsense\SystemHealth
*/
class
ActivityController
extends
ApiControllerBase
{
/**
* retrieve system activity (top)
* @return array
*/
public
function
getActivityAction
()
{
$backend
=
new
Backend
();
$response
=
$backend
->
configdpRun
(
"system diag activity json"
);
$activity
=
json_decode
(
$response
,
true
);
return
$activity
;
}
}
src/opnsense/mvc/app/views/OPNsense/Diagnostics/systemactivity.volt
0 → 100644
View file @
c4beabc6
{#
OPNsense® is Copyright © 2014 – 2015 by Deciso B.V.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
#}
<script src="/ui/js/moment-with-locales.min.js" type="text/javascript"></script>
<script type="text/javascript">
$( document ).ready(function() {
/**
* fetch system activity
*/
function updateTop() {
var gridopt = {
ajax: false,
selection: true,
multiSelect: true
};
$("#grid-top").bootgrid('destroy');
ajaxGet(url = "/api/diagnostics/activity/getActivity",
sendData = {}, callback = function (data, status) {
if (status == "success") {
$("#grid-top > tbody").html('');
$.each(data['details'], function (key, value) {
var fields = ["PID", "USERNAME", "PRI", "NICE", "SIZE", "RES", "STATE", "C", "TIME", "WCPU", "COMMAND"];
tr_str = '<tr>';
for (var i = 0; i < fields.length; i++) {
if (value[fields[i]] != null) {
tr_str += '<td>' + value[fields[i]] + '</td>';
} else {
tr_str += '<td></td>';
}
}
tr_str += '</tr>';
$("#grid-top > tbody").append(tr_str);
});
var header_txt = "";
$.each(data['headers'], function (key, value) {
header_txt += value;
header_txt += "<br/>";
});
$("#header_data").html(header_txt);
$('#header_data').fadeOut('slow');
$('#header_data_show').fadeIn('slow');
}
$("#grid-top").bootgrid(gridopt);
}
);
}
// initial fetch
updateTop();
// hide show header info button
$('#header_data_show').hide();
$("#refresh").click(updateTop);
// link show header info
$("#header_data_show").click(function(){
$('#header_data').fadeIn('slow');
$('#header_data_show').hide();
});
});
</script>
<div class="content-box">
<div class="content-box-main">
<div class="table-responsive">
<div class="col-sm-12">
<table id="grid-top" class="table table-condensed table-hover table-striped table-responsive">
<thead>
<tr>
<th data-column-id="PID" data-type="numeric" data-identifier="true">{{ lang._('PID') }}</th>
<th data-column-id="USERNAME" data-type="string" data-css-class="hidden-xs hidden-sm" data-header-css-class="hidden-xs hidden-sm">{{ lang._('USERNAME') }}</th>
<th data-column-id="PRI" data-type="string" data-css-class="hidden-xs hidden-sm" data-header-css-class="hidden-xs hidden-sm">{{ lang._('PRI') }}</th>
<th data-column-id="NICE" data-type="string" data-css-class="hidden-xs hidden-sm" data-header-css-class="hidden-xs hidden-sm">{{ lang._('NICE') }}</th>
<th data-column-id="SIZE" data-type="string" data-css-class="hidden-xs hidden-sm" data-header-css-class="hidden-xs hidden-sm">{{ lang._('SIZE') }}</th>
<th data-column-id="RES" data-type="string" data-css-class="hidden-xs hidden-sm" data-header-css-class="hidden-xs hidden-sm">{{ lang._('RES') }}</th>
<th data-column-id="STATE" data-type="string">{{ lang._('STATE') }}</th>
<th data-column-id="C" data-type="string" data-css-class="hidden-xs hidden-sm" data-header-css-class="hidden-xs hidden-sm">{{ lang._('C') }}</th>
<th data-column-id="TIME" data-type="string" data-css-class="hidden-xs hidden-sm" data-header-css-class="hidden-xs hidden-sm">{{ lang._('TIME') }}</th>
<th data-column-id="WCPU" data-type="string">{{ lang._('WCPU') }}</th>
<th data-column-id="COMMAND" data-type="string">{{ lang._('COMMAND') }}</th>
</tr>
</thead>
<tbody>
</tbody>
<tfoot>
</tfoot>
</table>
</div>
<div class="col-sm-12">
<div class="row">
<div class="col-xs-12">
<div class="pull-left" data-toggle="popover">
<small id="header_data"></small>
</div>
<div class="pull-right">
<button id="header_data_show" class="btn btn-default"><i class="fa fa-info-circle"></i></button>
<button id="refresh" type="button" class="btn btn-default">
<span>{{ lang._('Refresh') }}</span>
<span class="fa fa-refresh"></span>
</button>
</div>
</div>
</div>
<hr/>
</div>
</div>
</div>
</div>
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