Slices historical application data via MySQL

MySQL engine is leveraged to slice and order historical
data.
This commit is contained in:
Simone Mainardi 2016-02-07 14:32:46 +01:00
parent 25ee0d5c11
commit e1e0e9cab0
3 changed files with 83 additions and 54 deletions

View file

@ -59,31 +59,34 @@ function historicalTopApplicationsTable(ifid, epoch_begin, epoch_end, host)
if not sort_column or sort_column == "column_" then sort_column = "column_tot_bytes" end
print[[
<div id="historical-top-applications-table">
<div id="historical-top-applications-table" total_rows=-1>
</div>
<script type="text/javascript">
var totalRows = -1;
$('a[href="#historical-top-apps"]').on('shown.bs.tab', function (e) {
var target = $(e.target).attr("href"); // activated tab
$('#historical-top-applications-table').datatable({
title: "",]]
title: "", id: "a-big-dog",]]
print("url: '"..ntop.getHttpPrefix().."/lua/get_historical_data.lua?stats_type=top_applications"..top_apps_url_params.."',")
if preference ~= "" then print ('perPage: '..preference.. ",\n") end
if preference ~= "" then print ('perPage: '..preference.. ",") end
-- Automatic default sorted. NB: the column must be exists.
print ('sort: [ ["'..sort_column..'","'..sort_order..'"] ],\n')
print ('sort: [ ["'..sort_column..'","'..sort_order..'"] ],')
print [[
post: {totalRows: function(){ return $('#historical-top-applications-table').attr("total_rows");} },
showFilter: true,
showPagination: true,
tableCallback: function(){$('#historical-top-applications-table').attr("total_rows", this.options.totalRows);},
columns:
[
{title: "Protocol id", field: "column_application", hidden: true},
{title: "Application", field: "column_label", sortable: true},
{title: "Traffic Volume", field: "column_bytes", sortable: true},
{title: "Packets", field: "column_packets", sortable: true},
{title: "Flows", field: "column_flows", sortable: true}
{title: "Application", field: "column_label", sortable: false},
{title: "Traffic Volume", field: "column_bytes", sortable: true, css: {textAlign:'right'}},
{title: "Packets", field: "column_packets", sortable: true, css: {textAlign:'right'}},
{title: "Flows", field: "column_flows", sortable: true, css: {textAlign:'right'}}
]
});