mirror of
https://github.com/opnsense/plugins.git
synced 2026-05-01 08:31:38 -05:00
net/vnstat: added yearly table to vnstat service (#2452)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
PLUGIN_NAME= vnstat
|
||||
PLUGIN_VERSION= 1.2
|
||||
PLUGIN_VERSION= 1.3
|
||||
PLUGIN_REVISION= 1
|
||||
PLUGIN_COMMENT= vnStat is a console-based network traffic monitor
|
||||
PLUGIN_DEPENDS= vnstat
|
||||
|
||||
@@ -9,6 +9,11 @@ ensures light use of system resources.
|
||||
Plugin Changelog
|
||||
================
|
||||
|
||||
1.3
|
||||
|
||||
* Added Yearly statistics.
|
||||
* Fixed typo leftover from removing weekly statistics.
|
||||
|
||||
1.2
|
||||
|
||||
* Remove Weekly statistics, unsupported since vnStat v2
|
||||
|
||||
@@ -78,6 +78,17 @@ class ServiceController extends ApiMutableServiceControllerBase
|
||||
return array("response" => $response);
|
||||
}
|
||||
|
||||
/**
|
||||
* list yearly statistics
|
||||
* @return array
|
||||
*/
|
||||
public function yearlyAction()
|
||||
{
|
||||
$backend = new Backend();
|
||||
$response = $backend->configdRun("vnstat yearly");
|
||||
return array("response" => $response);
|
||||
}
|
||||
|
||||
/**
|
||||
* remove database folder
|
||||
* @return array
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
<li><a data-toggle="tab" href="#hourly">{{ lang._('Hourly Statistics') }}</a></li>
|
||||
<li><a data-toggle="tab" href="#daily">{{ lang._('Daily Statistics') }}</a></li>
|
||||
<li><a data-toggle="tab" href="#monthly">{{ lang._('Monthly Statistics') }}</a></li>
|
||||
<li><a data-toggle="tab" href="#yearly">{{ lang._('Yearly Statistics') }}</a></li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content content-box tab-content">
|
||||
@@ -53,6 +54,9 @@
|
||||
<div id="monthly" class="tab-pane fade in">
|
||||
<pre id="listmonthly"></pre>
|
||||
</div>
|
||||
<div id="yearly" class="tab-pane fade in">
|
||||
<pre id="listyearly"></pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
@@ -73,6 +77,11 @@ function update_monthly() {
|
||||
$("#listmonthly").text(data['response']);
|
||||
});
|
||||
}
|
||||
function update_yearly() {
|
||||
ajaxCall(url="/api/vnstat/service/yearly", sendData={}, callback=function(data,status) {
|
||||
$("#listyearly").text(data['response']);
|
||||
});
|
||||
}
|
||||
|
||||
$( document ).ready(function() {
|
||||
var data_get_map = {'frm_general_settings':"/api/vnstat/general/get"};
|
||||
@@ -87,6 +96,7 @@ $( document ).ready(function() {
|
||||
setInterval(update_hourly, 3000);
|
||||
setInterval(update_daily, 3000);
|
||||
setInterval(update_monthly, 3000);
|
||||
setInterval(update_yearly, 3000);
|
||||
|
||||
$("#saveAct").click(function(){
|
||||
saveFormToEndpoint(url="/api/vnstat/general/set", formid='frm_general_settings',callback_ok=function(){
|
||||
|
||||
@@ -38,7 +38,13 @@ message:request Vnstat daily status
|
||||
command:/usr/local/bin/vnstat -m
|
||||
parameters:
|
||||
type:script_output
|
||||
message:request Vnstat weekly status
|
||||
message:request Vnstat monthly status
|
||||
|
||||
[yearly]
|
||||
command:/usr/local/bin/vnstat -y
|
||||
parameters:
|
||||
type:script_output
|
||||
message:request Vnstat yearly status
|
||||
|
||||
[resetdb]
|
||||
command:rm -rf /var/lib/vnstat
|
||||
|
||||
Reference in New Issue
Block a user