|
@ -47,11 +47,12 @@ async function fetchPings(hostId, start, end) { |
|
|
async function transformChartData(pings) { |
|
|
async function transformChartData(pings) { |
|
|
var res = { date: [], min: [], avg: [], max: [], failures: []}; |
|
|
var res = { date: [], min: [], avg: [], max: [], failures: []}; |
|
|
for (let ping of pings) { |
|
|
for (let ping of pings) { |
|
|
res.date.push(ping.date); |
|
|
var jsDate = new Date(ping.date); |
|
|
res.min.push(ping.min); |
|
|
//res.date.push(ping.date);
|
|
|
res.avg.push(ping.avg); |
|
|
res.min.push({ x: jsDate, y: ping.min }); |
|
|
res.max.push(ping.max); |
|
|
res.avg.push({ x: jsDate, y: ping.avg }); |
|
|
res.failures.push(ping.failures); |
|
|
res.max.push({ x: jsDate, y: ping.max }); |
|
|
|
|
|
res.failures.push({ x: jsDate, y: ping.failures }); |
|
|
} |
|
|
} |
|
|
return res; |
|
|
return res; |
|
|
} |
|
|
} |
|
@ -71,7 +72,7 @@ async function updateGraphs() { |
|
|
charts[host.hostId] = new Chart(ctx, { |
|
|
charts[host.hostId] = new Chart(ctx, { |
|
|
type: 'line', |
|
|
type: 'line', |
|
|
data: { |
|
|
data: { |
|
|
labels: val.date, |
|
|
//labels: val.date,
|
|
|
datasets: [ |
|
|
datasets: [ |
|
|
{ |
|
|
{ |
|
|
label: 'min', |
|
|
label: 'min', |
|
@ -102,6 +103,13 @@ async function updateGraphs() { |
|
|
text: host.name |
|
|
text: host.name |
|
|
}, |
|
|
}, |
|
|
scales: { |
|
|
scales: { |
|
|
|
|
|
xAxes: [{ |
|
|
|
|
|
type: 'time', |
|
|
|
|
|
distribution: 'linear', |
|
|
|
|
|
time: { |
|
|
|
|
|
unit: 'hour' |
|
|
|
|
|
} |
|
|
|
|
|
}], |
|
|
yAxes: [ |
|
|
yAxes: [ |
|
|
{ |
|
|
{ |
|
|
id: "y-latency", |
|
|
id: "y-latency", |
|
|