Commit 831f98b1 authored by Olav Kvittem's avatar Olav Kvittem
Browse files

traceroute err on map

parent d350dca2
Pipeline #47356 passed with stages
in 3 minutes and 2 seconds
......@@ -88,9 +88,11 @@
<option value=uninett>Uninett</option>
</select>
<select id=event_type>
<option value=gapsum>Summary</option>
<option value=gapsum>Gap summary</option>
<option value=gap>Gaps</option>
<option value=jitter>Queues</option>
<option value=routesum>Route summary</option>
<option value=routeerr>Route errors</option>
</select>
<select id=prop_select></select>
<select id=stats_type>
......@@ -145,9 +147,9 @@
<button class=knapp id=search>Search</button>
-->
<input class=knapp type="search" id="search_input" size=5em placeholder=search>
<!--
<!---->
<button class=knapp id=check>Check links</button>
-->
<!---->
<span class=knapp id=refs></span>
<button class=knapp id=live title="Refresh display every minute">Autorefresh</button>
......@@ -205,15 +207,23 @@ var no_coords= new LatLon(70.98584, -8.49243); // Jan Mayen
var points=[];
var empty_color="LightGray";
var prop_names_list = {gapsum: "down_ppm h_ddelay h_jit h_min_d big_gaps big_time small_gaps small_time".split(" "),
gap: "down_ppm tloss h_ddelay h_jit h_min_d h_slope_10".split(" "),
jitter: "h_ddelay h_jit h_min_d h_slope_10".split(" ")
};
var prop_names_list = {
gapsum: "down_ppm h_ddelay h_jit h_min_d big_gaps big_time small_gaps small_time".split(" "),
gap: "down_ppm tloss h_ddelay h_jit h_min_d h_slope_10".split(" "),
jitter: "h_ddelay h_jit h_min_d h_slope_10".split(" "),
routesum: "route_errors stopped_probes stopped_routes non_dest_probes total_analysed dest_reached max_length".split(" "),
routeerr: "anomaly_count duration last_hop last_reply_from icmp_errors".split(" ")
};
var prop_names;
var prop_desc= { down_ppm:"Unavailability (PPM)", h_ddelay:"Queue(ms)", h_jit:"Jitter(ms)",
h_min_d:"Min delay(ms)", h_delay:"Avg delay(ms)",
tloss:"Time lost(ms)", h_slope_10:"Slope",
big_gaps:"Big gaps(#)", big_time:"Big gap time(s)", small_gaps:"Small gaps(#)", small_time:"Small gap time(s)",
total_analysed:"total_analysed", dest_reached:"dest_reached", max_length:"max_length",
route_errors:"route_errors", stopped_probes:"stopped_probes", stopped_routes:"stopped_routes",
non_dest_probes:"non_dest_probes",
anomaly_count:"anomaly_count", duration:"duration",
last_hop:"last_hop", last_reply_from:"last_reply_from", icmp_errors:"icmp_errors"
};
var thresholds={
h_delay:[10,50],
......@@ -666,10 +676,10 @@ function make_tooltip(title, link){
if ( prop in link ){
var desc=prop_desc[prop] != null ? prop_desc[prop] : "no description";
// var val= ! isNaN(link[prop]) ? link[prop].toFixed(1) : 'no data';
var val;
var val = link[prop];
if ( isNaN(link[prop]) ){
val='no data';
console.log('Invalid value of "' + title + '" prop:' + prop + ' val:' + link[prop] );
; // som text value
} else {
try {val = parseInt( link[prop] ).toFixed(1) ; }
catch(e) {
......@@ -677,6 +687,7 @@ function make_tooltip(title, link){
}
}
tip+= "<tr><td>" + desc + '<td align=right>' + val + "\n";
if ( prop === "down_ppm" && typeof link[prop] == 'number' ){
tip+= "<tr><td>" + "Unavail (sec/day)" + '<td align=right>' +
( link[prop] * 86400 / 10**6 ).toFixed(1) + "\n";
......@@ -729,14 +740,14 @@ function get_thresholds( hits, prop){
var vals=[];
$.each(hits, function(i, link){
if ( typeof(link._source[prop]) === "numeric" ){
if ( typeof(link._source[prop]) === "number" ){
vals.push( link._source[prop] );
}
});
if ( vals.length > 0 ){
var max = Math.max(vals);
var min = Math.min(vals);
var max = Math.max( ...vals);
var min = Math.min( ...vals);
var interval=max-min;
var logint=0;
......@@ -772,11 +783,17 @@ function zero_fill(n){
}
function gap_list( from, to){
var html="<table><thead><td>Day Time<td>Lost(s)<td>Queue</thead>";
var etype, html;
var n=0;
for ( var hit of last_hits){
for ( var hit of last_hits){
var gap = hit._source;
if ( gap.from === from && gap.to === to && gap.event_type === "gap"){
if ( ! etype) { // take first record as defining
etype = gap.event_type;
var amount_head = etype === "gap" ? "Queue" : "Cause";
html="<table><thead><td>Day Time<td>Lost(s)<td>" + amount_head + "</thead>";
}
if ( gap.from === from && gap.to === to ){
var d = new Date( Number(gap.timestamp * 1000) );
var tid = zero_fill( d.getDate() ) + " " + zero_fill( d.getHours() ) + ":" + zero_fill( d.getMinutes() ); // ddhh
......@@ -787,7 +804,11 @@ function gap_list( from, to){
+ '&redirect=1&timestamp=' + gap.timestamp
+ '&from=' + gap.from_adr + '&to=' + gap.to_adr + '&ip=1';
var telemetry_href = tid;
var sec = ( gap.tloss / 1000 ).toFixed(1);
var sec;
if ( etype === "gap"){
sec = ( gap.tloss / 1000 ).toFixed(1);
} else if ( etype === "routeerr" )
sec = ( gap.duration ).toFixed(1);
var syslog_href= sec;
var tail="";
if ( $("#network").val() === "uninett" ){
......@@ -796,10 +817,17 @@ function gap_list( from, to){
tail = "<td><button class=knapp>" + syslog_href + "</button>"
+ "<td><button class=knapp>" + telemetry_href + "</button>";
}
var h_ddelay=gap.h_ddelay;
if ( typeof h_ddelay == "numeric") h_ddelay = h_ddelay.toFixed(1) ;
var amount;
if ( etype === "gap"){
amount = gap.h_ddelay;
if ( typeof amount == "numeric") amount = amount.toFixed(1) ;
} else if ( etype === "routeerr" ){
//amount = typeof gap.icmp_errors === "undefined" ? "" : JSON.stringify( gap.icmp_errors );
amount = gap.cause + " " + gap.last_reply_from;
}
//html += "<tr><td>" + syslog_href + "<td>" + telemetry_href + "<td>" + gap.h_ddelay.toFixed(1) + "<td>" + "\n";
html += "<tr><td>" + tid + "<td>" + sec + "<td>" + h_ddelay + tail + "\n";
html += "<tr><td>" + tid + "<td>" + sec + "<td>" + amount + tail + "\n";
n++;
}
}
......@@ -815,33 +843,56 @@ function gap_list( from, to){
}
// summarize gap and jitter records into gapsum format
function digest_es_data(hits){
var stat=[];
function digest_es_data(etype, hits){
var stat=[]; // numeric stats
var msg=[]; // text lists
var digest=[];
for (var i=0; i < hits.length; i++){
var event = hits[i]._source;
if ( event.event_type === "gap"){
if ( event.event_type === etype){
var ab = event.from + "," + event.to;
if ( ! (ab in stat) ){ // first record for event
stat[ab]=[];
stat[ab].from = event.from;
stat[ab].to = event.to;
for ( const prop of prop_names_list["gap"]){
for ( const prop of prop_names_list[etype]){
stat[ab][prop]=new stats();
}
msg[ab]=[];
msg[ab].from = event.from;
msg[ab].to = event.to;
for ( const prop of prop_names_list[etype]){
msg[ab][prop]=[];
}
}
for ( const prop of prop_names_list["gap"] ){
stat[ab][prop].add( event[prop] );
// accumulate values
for ( const prop of prop_names_list[etype] ){
let value=event[prop];
if ( typeof(value) === "undefined" )
value="";
else if ( typeof value === "object" )
value = JSON.stringify(value);
if ( typeof value === "string"){
if ( msg[ab][prop].indexOf( value) < 0 )
msg[ab][prop].push(value);
} else {
stat[ab][prop].add( value );
}
}
}
}
// make stats
for ( const ab in stat ){
var rec={ from: stat[ab].from, to: stat[ab].to};
for ( const prop of prop_names_list["gap"] ){
rec[prop]=stat[ab][prop].average();
rec[prop + "_max"]=stat[ab][prop].max();
for ( const prop of prop_names_list[etype] ){
if ( stat[ab][prop].n > 0 ){
rec[prop]=stat[ab][prop].average();
rec[prop + "_max"]=stat[ab][prop].max();
} else {
rec[prop] = msg[ab][prop].join();
}
}
if ( stat[ab].tloss )
rec.down_ppm = ( stat[ab].tloss.sum * 1000000 / 1000 / period_length );
......@@ -1038,7 +1089,7 @@ function taint_topology( topo, prop){
var popup=link_popup(link._source);
var tooltip= link_tooltip( link._source.from + " to " + link._source.to , link._source, prop );
annotate_link( ab, linkByName[ab], tooltip, popup );
annotate_link( ab.join(), linkByName[ab], tooltip, popup );
}
}
......@@ -1053,19 +1104,20 @@ function taint_links( hits, prop){
for (var i=0; i < hits.length; i++){
var link=hits[i];
var ab=[link._source.from, link._source.to];
if ( link._source.from_adr === "185.71.209.4" ) ab[0]="runar-mp";
if ( link._source.to_adr === "185.71.209.4" ) ab[1]="runar-mp";
// if ( link._source.from_adr === "185.71.209.4" ) ab[0]="runar-mp";
// if ( link._source.to_adr === "185.71.209.4" ) ab[1]="runar-mp";
var abs = ab.join();
done[ab]=1;
if ( linkByName[ab] ){
done[abs]=1;
if ( linkByName[abs] ){
var color=get_color( link._source[prop], threshes);
taint_link( linkByName[ab], color );
taint_link( linkByName[abs], color );
var popup=link_popup(link._source);
var tooltip= link_tooltip( link._source.from + " to " + link._source.to , link._source, prop );
annotate_link( ab, linkByName[ab], tooltip, popup );
annotate_link( abs, linkByName[abs], tooltip, popup );
} else
console.log("Missing link for data for " + prop + " : " + ab);
console.log("Missing link for data for " + prop + " : " + abs);
}
}
......@@ -1073,7 +1125,7 @@ function taint_links( hits, prop){
if ( ! done[abs]){ // links without data
if ( linkByName[abs] ){
taint_link( linkByName[abs], empty_color );
annotate_link( abs.split(","), linkByName[ab], abs + ': no data', abs + " no data" );
annotate_link( abs, linkByName[abs], abs + ': no data', abs + " no data" );
}
}
}
......@@ -1089,12 +1141,11 @@ function taint_link( link, color ){
}
}
function annotate_link(ab,link, tooltip, popup){
function annotate_link(abs,link, tooltip, popup){
if (link){
link.bindTooltip( tooltip, {"sticky":true} );
link.bindPopup( popup );
}
var abs=ab.join();
$("#" + abs + '-from' ).on('click', "button.knapp" , function( e){
focus_links(e.id, 'flip');
});
......@@ -1241,6 +1292,7 @@ function show_network(network){
} else {
load_coords(network, "base",2);
load_coords(network, "extra",2);
load_coords(network, "cnaas",2);
}
}
......@@ -1309,6 +1361,89 @@ function check_ends(){
}
function sort_diff(a , b){
return
var aa=a.split(" ");
var bb=b.split(" ");
if ( aa[0] === bb[0]){
return aa[1].localeCompare( bb[1] );
} else {
return aa[0].localeCompare( bb[0] );
}
}
function check_asymmetry(){
var ab=[], down=[], diff=[], pair=[], i;
var nok=0, nmiss=0, missing=[];
for (i=0;i< summary.length;i++){
var entry=summary[i]._source;
var a=entry.from + " " + entry.to;
down[a]= entry.down_ppm;
ab[a]=true;
}
for (i=0;i<summary.length;i++){
var entry=summary[i]._source;
var a=entry.from + " " + entry.to;
var b=entry.to + " " + entry.from;
if ( ! ( b in pair ) ){
var delta=0;
if ( typeof(down[b]) === "number" && typeof(down[a]) === "number" )
delta= down[b] - down[a];
diff.push( {id: a, val: Math.abs( delta ) } );
}
pair[a] = b;
pair[b] = a;
if (ab[b]){
nok++;
} else {
// console.log( "Missing link : " + b);
missing.push(b);
nmiss++;
}
}
var html= '<h3>Missing opposite end of links</h3>';
html += '<table title="Missing oposite end"><tr><th>From<th>To';
missing.sort(sort_missing);
for (i=0; i< missing.length; i++){
var ft=missing[i].split(" ");
html+='<tr><td>' +ft[0] + '<td>'+ ft[1];
}
// console.log("Ok " + nok + " Missing " + nmiss );
html+='</table>';
html+='<p>' + "Ok " + nok + " Missing " + nmiss;
html += "<h3>Asymmetry in dependability(PPM)</h3>";
html += '<table border=1><tr><th>From<th>To<th> PPM <th> PPM <th> Diff';
diff.sort( function(a,b){
if ( typeof(a.val) === "number" && typeof(b.val) === "number" )
return b.val - a.val;
return 0;
});
for (i=0; i< diff.length; i++){
let a = diff[i].id;
let ft=a.split(" ");
let aval= down[a] ? down[a].toFixed(0) : down[a];
let bval= down[pair[a]] ? down[pair[a]].toFixed(0) : down[pair[a]];
let diffval = diff[i].val ? diff[i].val.toFixed(0) : 0 ;
html+='<tr><td>' +ft[0] + '<td>'+ ft[1] +
'<td align=right>' + aval + '<td align=right>' + bval + '<td align=right>' + diffval;
}
html+='</table>';
$("#missing").html(html);
$("#missing").dialog("open");
// alert(html);
}
// compute decimal hour
function dec_hour( date ){
return date.getHours() + date.getMinutes() / 60 + date.getSeconds() / 3600;
......@@ -1417,13 +1552,20 @@ function log_summary(summary){
}
// get measurement data
var links_on = false;
var links_on = false;
const index_extension={};
function get_connections(){
//links=[];
var index=parms.net;
var index=parms.net;
var etype= $("#event_type").val();
if ( etype === "gap" || etype === "gapsum" )
;
else if ( etype === "routeerr" || etype === "routesum" )
index = index + "_" + "routemon";
else
index = index + "_" + etype;
var hour=0;
var period=$("#period").val();
var start, end;
......@@ -1468,7 +1610,6 @@ function get_connections(){
}
if ( etype === "jitter") index= index + "_jitter";
var url="elastic-get-date-type.pl?index=" + index + "&event_type=" + etype
+ "&start=" + start + "&end=" + end;
......@@ -1478,8 +1619,8 @@ function get_connections(){
function(resp){
if (resp.hits.total.value > 0){
var nrecs=resp.hits.total.value.toString();
;
if (etype === "gapsum"){
if ( etype === "gapsum" || etype === "routesum" ){
$("#stats_type").hide();
summary=resp.hits.hits;
} else if ( resp.aggregations){
......@@ -1488,7 +1629,7 @@ function get_connections(){
summary=digest_aggregates(aggregates, $("#stats_type").val());
nrecs = count_aggregates( aggregates );
} else { // gap records
summary=digest_es_data(resp.hits.hits);
summary=digest_es_data(etype, resp.hits.hits);
last_hits=resp.hits.hits;
}
harvest_ip_name(summary);
......@@ -1673,7 +1814,7 @@ $(document).ready ( function(){
links_on=true;
}
$("#check").click( function(){check_ends()} );
$("#check").click( function(){check_asymmetry()} );
// read coordinates
document.getElementById("mapid").addEventListener("contextmenu", function (event) {
......@@ -1697,7 +1838,7 @@ $(document).ready ( function(){
fix_url( base, "net", "dragonlab" ) + '"> Dragonlab </button> ';
*/
$( "#missing" ).dialog({ autoOpen: false, minWidth: 600 });
$( "#missing" ).dialog({ autoOpen: false, minWidth: 800 });
// catch focus on
$("#mapid").on('click', "a.trigger", function(e){
......
Supports Markdown
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