Commit 79a661c2 authored by Olav Kvittem's avatar Olav Kvittem

curves indexed by time, keep previous results, add time, table headings, bugs

parent 0918f328
favicon.ico

1.12 KB

......@@ -31,6 +31,7 @@ This implements a web front end to a json iperf service.
<script type="text/javascript">
var mp_url="https://kind.uninett.no/autoregister/utstyr_mp.json";
var graf_no=0;
var x_name=[]; // the name of hops in tooltip
function debug_log ( msg){
......@@ -54,6 +55,7 @@ function iperf(host, nobs, interval){
if ( ! nobs ) nobs=10;
if ( ! host) host="";
var html='<table cellpadding="0" cellspacing="0" border="0" class="display" id="tracetable">';
html+='<caption>Bandwidth report at ' + new Date().toLocaleTimeString() + '</caption>';
var title=true;
$("#busy").show();
var url='iperf-x.pl?host=' + host + '&nobs=' + nobs + '&interval=' + interval;
......@@ -75,7 +77,7 @@ function iperf(host, nobs, interval){
$("#tracetablecontainer").html = mtr_rows[0]; // error message
} else {
html += '<thead><th>[ID]<th>Interval<th>Transfer<th>Bandwidth</thead><tbody>';
var xtime=0.0;
$.each(mtr_rows, function(tr) {
if ( mtr_rows[tr].length === 7 && ! isNaN(mtr_rows[tr][5]) ){ // is a data row
html += '<tr><td>' + mtr_rows[tr][0]
......@@ -83,8 +85,10 @@ function iperf(host, nobs, interval){
+ '<td>' + mtr_rows[tr][3]+ ' ' + mtr_rows[tr][4]
+ '<td>' + mtr_rows[tr][5]+ ' ' + mtr_rows[tr][6]
+ "\n";
bytes.push( parseInt( mtr_rows[tr][3]) );
thru.push( parseInt( mtr_rows[tr][5]) );
var inter = mtr_rows[tr][1]; // like 0.5-1.0 sec
xtime= parseFloat(inter.match(/[\d\.]+/g )[1] );
bytes.push( [ xtime, parseInt( mtr_rows[tr][3]) ] );
thru.push( [ xtime, parseInt( mtr_rows[tr][5]) ] );
}
});
thru_avg=thru.pop();
......@@ -92,16 +96,16 @@ function iperf(host, nobs, interval){
html+= '</tbody></table><p> ';
console.log(html);
$("#tracetablecontainer").html(html);
$('#tracetable').dataTable( { "bPaginate": false, "bAutoWidth": false,
$("#tracetablecontainer").prepend(html + '<p> <br><hr>');
$('#tracetable').dataTable( { "bPaginate": false, "bAutoWidth": false, "bFilter": false,
"oLanguage": { "sSearch": "Filter lines:" } });
$("#busy").hide();
// var series= [{name:'test', data: [2,4,8,16,25,36,49,64,81]}];
var series= [{ name: 'Bandwidth', data: thru, type: 'line'},
{name: 'Average', data: [ [0, thru_avg], [thru.length-1, thru_avg]]}
{name: 'Average', data: [ [0, thru_avg[1]], thru_avg]}
/* { name: 'Data', data: bytes, type: 'line'} */
];
tegn_graf('graf', 'Bandwidth graph', 'To ' + $('#tr_host').val(), series, '', 1,
tegn_graf('graf', 'Bandwidth graph', 'To ' + $('#tr_host').val() + ' at ' + new Date().toLocaleTimeString(), series, '', graf_no++,
$('#tracetablecontainer').width());
$('#traces').tabs( "enable", 0);
$('#traces').tabs( "enable", 1);
......@@ -165,7 +169,7 @@ html+= 'action="javascript:iperf( $(\'#tr_host\').val(), $(\'#tr_times\').val(),
function tegn_graf( div, tittel, subtittel, tider, leg_band, grafno, width ){
var divid=div+(grafno);
if ( $('#' + divid).length <= null ){
$('#'+div).append('<div id=' + divid + '></div>');
$('#'+div).prepend('<div id=' + divid + '></div><p> <hr>');
// debug_log('div created: ' + divid );
}
// $.highcharts({
......@@ -185,7 +189,7 @@ function tegn_graf( div, tittel, subtittel, tider, leg_band, grafno, width ){
text: subtittel
},
xAxis: {
title : {text: 'Interval'},
title : {text: 'Seconds'},
minorTickInterval : 1
// plotBands: leg_band
},
......@@ -263,7 +267,7 @@ $(document).ready( function(){
<h3>Throughput analysis by <script>document.write(location.hostname)</script></h3>
<p> <span id=tr_button></span>
<script>make_select( '#tr_button', mp_url );</script>
<div id=busy><img src=/images/ajax-loader.gif> Testing - please wait at least 'times*(1+every)' seconds.<p></div>
<div id=busy><img src=/images/ajax-loader.gif> Testing - please wait for test to complete.<p></div>
<div id=traces align=left class=datadiv>
<ul>
......
......@@ -12,7 +12,7 @@
</ul>
<td>
</table>
<div id=logo> <a href=http://uninett.no><img src="images/UNINETT_logo_t.png" alt="uninettlogo" /></a></div>
<div id=logo> <a href=http://uninett.no><img src="/images/UNINETT_logo_t.png" alt="uninettlogo" /></a></div>
<!--
<div id="logo"><img src="images/UNINETT_logo_0613.jpg" alt="uninettlogo" /> Mletjenester</div>
<span align=right><a href=http://uninett.no><img src="images/UNINETT_logo_menu.jpg" alt="uninettlogo" /></a></span>
......
......@@ -32,6 +32,7 @@ This implements a web front end to a json traceroute service.
<script type="text/javascript">
var mp_url="https://kind.uninett.no/autoregister/utstyr_mp.json";
var x_name=[]; // the name of hops in tooltip
var graf_no=0;
function debug_log ( msg){
if(typeof(console) === 'undefined') { /* ie < 9 adaption */
......@@ -53,7 +54,9 @@ function make_table(mtr_rows){
function traceroute(host, nobs, psize, interval){
if ( ! nobs ) nobs=10;
if ( ! host) host="";
var html='<table cellpadding="0" cellspacing="0" border="0" class="display" id="tracetable"><thead>';
var html='<table cellpadding="0" cellspacing="0" border="0" class="display" id="tracetable">';
html+='<caption>Route report at ' + new Date().toLocaleTimeString() + '</caption><thead>';
var title=true;
$("#busy").show();
// var url='http://fou1.uninett.no/cgi-bin/traceroute.pl?host=' + host + '&nobs=' + nobs + '&psize=' + psize + '&interval=' + interval;
......@@ -105,7 +108,7 @@ function traceroute(host, nobs, psize, interval){
});
}
html+= '</tbody></table><p> ';
$("#tracetablecontainer").html(html);
$("#tracetablecontainer").prepend(html + '<p> <br><hr>');
$('#tracetable').dataTable( { "bPaginate": false, "bAutoWidth": false,
"oLanguage": { "sSearch": "Filter lines:" } });
$("#busy").hide();
......@@ -115,7 +118,7 @@ function traceroute(host, nobs, psize, interval){
{ name: 'Best', data: best, type: 'scatter'},
{ name: 'Loss', data: loss, type: 'scatter', yAxis: 1},
];
tegn_graf('graf', 'Latency graph', 'To ' + $('#tr_host').val(), series, '', 1,
tegn_graf('graf', 'Latency graph ', 'To ' + $('#tr_host').val() + ' at ' + new Date().toLocaleTimeString(), series, '', graf_no++,
$('#tracetablecontainer').width());
$('#traces').tabs( "enable", 0);
$('#traces').tabs( "enable", 1);
......@@ -149,7 +152,7 @@ html+= 'action="javascript:traceroute( $(\'#tr_host\').val(), $(\'#tr_times\').v
html+='</form>';
$(elm).html(html);
var items=[];
var items=["caida.org", "uninett.no", "nordu.net"];
var request=$.ajax( {url: url, type: 'GET', dataType: 'json', crossDomain: true } );
request.done( function( mps){
// console.log(mps);
......@@ -178,7 +181,7 @@ html+= 'action="javascript:traceroute( $(\'#tr_host\').val(), $(\'#tr_times\').v
function tegn_graf( div, tittel, subtittel, tider, leg_band, grafno, width ){
var divid=div+(grafno);
if ( $('#' + divid).length <= null ){
$('#'+div).append('<div id=' + divid + '></div>');
$('#'+div).prepend('<div id=' + divid + '></div><p> <br><hr>');
// debug_log('div created: ' + divid );
}
// $.highcharts({
......@@ -274,7 +277,7 @@ $(document).ready( function(){
<h3>Route analysis by <script>document.write(location.hostname)</script></h3>
<p> <span id=tr_button></span>
<script>make_select( '#tr_button', mp_url );</script>
<div id=busy><img src=ajax-loader.gif> Traceing route - please wait at least 'times*(1+every)' seconds.<p></div>
<div id=busy><img src=/images/ajax-loader.gif> Traceing route - please wait at least 'times*(1+every)' seconds.<p></div>
<div id=traces align=left class=datadiv>
<ul>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment