mirror of
https://github.com/ntop/ntopng.git
synced 2026-08-01 03:08:11 +00:00
76 lines
2.3 KiB
PHP
76 lines
2.3 KiB
PHP
|
|
|
|
// ---------------- Automatic AS table update code ------------------------
|
|
|
|
function as_table_setID (row) {
|
|
var index = 0;
|
|
var as_key = row.find("td").eq(0).text();
|
|
|
|
// Set the row index to the AS key
|
|
row.attr('id', as_key);
|
|
|
|
row.find("td").eq(index++).attr('id', as_key+"_key");
|
|
|
|
row.find("td").eq(index++).attr('id', as_key+"_asn");
|
|
row.find("td").eq(index++).attr('id', as_key+"_chart");
|
|
|
|
row.find("td").eq(index++).attr('id', as_key+"_hosts");
|
|
row.find("td").eq(index++).attr('id', as_key+"_score");
|
|
row.find("td").eq(index++).attr('id', as_key+"_host_score_ratio");
|
|
|
|
row.find("td").eq(index++).attr('id', as_key+"_asname");
|
|
|
|
row.find("td").eq(index++).attr('id', as_key+"_since");
|
|
row.find("td").eq(index++).attr('id', as_key+"_alerted_flows");
|
|
row.find("td").eq(index++).attr('id', as_key+"_breakdown");
|
|
row.find("td").eq(index++).attr('id', as_key+"_throughput");
|
|
row.find("td").eq(index++).attr('id', as_key+"_traffic");
|
|
|
|
return row;
|
|
|
|
}
|
|
|
|
function as_row_update(as_key) {
|
|
var url = "@HTTP_PREFIX@/lua/get_as_data.lua?asn="+as_key;
|
|
|
|
$.ajax({
|
|
type: 'GET',
|
|
url: url,
|
|
cache: false,
|
|
success: function(content) {
|
|
var data = jQuery.parseJSON(content);
|
|
$("#"+as_key+'_asn').html(data.column_asn);
|
|
$("#"+as_key+'_chart').html(data.column_chart);
|
|
|
|
$("#"+as_key+'_hosts').html(data.column_hosts);
|
|
$("#"+as_key+'_score').html(data.column_score);
|
|
$("#"+as_key+'_host_score_ratio').html(data.column_host_score_ratio);
|
|
|
|
$("#"+as_key+'_asname').html(data.column_asname);
|
|
|
|
$("#"+as_key+'_since').html(data.column_since);
|
|
$("#"+as_key+'_alerted_flows').html(data.column_alerted_flows);
|
|
$("#"+as_key+'_breakdown').html(data.column_breakdown);
|
|
$("#"+as_key+'_throughput').html(data.column_thpt);
|
|
$("#"+as_key+'_traffic').html(data.column_traffic);
|
|
},
|
|
error: function(content) {
|
|
console.log("error");
|
|
}
|
|
});
|
|
}
|
|
|
|
// Updating function
|
|
function as_table_update () {
|
|
var $dt = $("#table-as").data("datatable");
|
|
var rows = $dt.rows;
|
|
|
|
for (var row in rows){
|
|
var as_key = rows[row][0].id;
|
|
as_row_update(as_key);
|
|
}
|
|
}
|
|
|
|
// Refresh Interval (10 sec)
|
|
var as_table_interval = window.setInterval(as_table_update, 10000);
|
|
// ---------------- End automatic table update code ------------------------
|