Fix speed test alerts not generated

This commit is contained in:
emanuele-f 2020-04-17 12:22:45 +02:00
parent fdadaca950
commit 35be58ede9
6 changed files with 19 additions and 8 deletions

View file

@ -324,10 +324,7 @@ $(document).ready(function() {
sortable: false,
render: function(data, type, row) {
if(type === 'display' || type === 'filter') {
if(row.value_js_formatter && row.last_measure)
// Call the provided formatting function
return window[row.value_js_formatter](row.last_measure);
else if(row.last_measure)
if(row.last_measure)
return `${row.last_measure} ${row.unit}`
else
return "";

View file

@ -128,6 +128,8 @@ return {
label=i18n("graphs.http_stats"),
metrics_labels = { i18n("graphs.name_lookup"), i18n("other")},
}},
-- The raw measurement value is multiplied by this factor before being written into the chart
chart_scaling_value = 1,
-- Js function to call to format the measurement value. See ntopng_utils.js .
value_js_formatter = "fmillis",
-- A list of additional notes (localization strings) to show into the timeseries charts
@ -151,6 +153,7 @@ return {
label=i18n("graphs.http_stats"),
metrics_labels = { i18n("graphs.name_lookup"), i18n("graphs.app_connect"), i18n("other") },
}},
chart_scaling_value = 1,
value_js_formatter = "fmillis",
i18n_chart_notes = {
"active_monitoring_stats.app_connect_descr",

View file

@ -147,6 +147,8 @@ return {
additional_timeseries = {},
-- Js function to call to format the measurement value. See ntopng_utils.js .
value_js_formatter = "fmillis",
-- The raw measurement value is multiplied by this factor before being written into the chart
chart_scaling_value = 1,
-- The localization string for the RTT metric in the chart
i18n_am_ts_metric = "flow_details.round_trip_time",
-- A list of additional notes (localization strings) to show into the timeseries charts
@ -165,6 +167,7 @@ return {
operator = "gt",
additional_timeseries = {},
value_js_formatter = "fmillis",
chart_scaling_value = 1,
i18n_chart_notes = {},
force_host = nil,
},

View file

@ -50,7 +50,7 @@ local function run_speedtest(hosts, granularity)
-- NOTE: force_host is set, only a single host will be available
for key, host in pairs(hosts) do
collected_results[key] = {
value = download_mbit * 1000000,
value = download_mbit,
resolved_addr = isp,
}
end
@ -110,6 +110,8 @@ return {
additional_timeseries = {},
-- Js function to call to format the measurement value. See ntopng_utils.js .
value_js_formatter = "fbits",
-- The raw measurement value is multiplied by this factor before being written into the chart
chart_scaling_value = 1000000,
-- A list of additional notes (localization strings) to show into the timeseries charts
i18n_chart_notes = {},
-- If set, the user cannot change the host

View file

@ -107,7 +107,13 @@ local function run_rtt_check(params, all_hosts, granularity)
local operator = info.measurement.operator or "gt"
if params.ts_enabled then
ts_utils.append(rtt_schema, {ifid = getSystemInterfaceId(), host = host.host, measure = host.measurement, millis_rtt = rtt}, when)
local value = rtt
if info.measurement.chart_scaling_value then
value = value * info.measurement.chart_scaling_value
end
ts_utils.append(rtt_schema, {ifid = getSystemInterfaceId(), host = host.host, measure = host.measurement, millis_rtt = value}, when)
end
active_monitoring_utils.setLastRttUpdate(key, when, rtt, resolved_host)