Add get_portidx_by_name and snmp_mappings.get_iface_idx

This commit is contained in:
Alfredo Cardigliano 2022-11-28 15:40:56 +01:00
parent 39aaaf58da
commit a206f83b4b
4 changed files with 78 additions and 11 deletions

View file

@ -15,18 +15,28 @@ package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
local rest_utils = require("rest_utils")
local ts_rest_utils = require("ts_rest_utils")
local tags = tsQueryToTags(_GET["ts_query"])
if not isEmptyString(tags.device) and not isEmptyString(tags.port) and not isnumber(tags.port) then
-- Ty to convert port name to index
local port_idx = get_portidx_by_name(tags.device, tags.port)
if port_idx then
tags.port = port_idx
end
end
local http_context = {
ts_schema = _GET["ts_schema"],
ts_schema = _GET["ts_schema"],
epoch_begin = _GET["epoch_begin"],
epoch_end = _GET["epoch_end"],
ts_compare = _GET["ts_compare"],
ts_query = _GET["ts_query"],
extended = _GET["extended"],
ts_aggregation = _GET["ts_aggregation"],
no_fill = _GET["no_fill"],
tskey = _GET["tskey"],
limit = _GET["limit"],
initial_point = _GET["initial_point"],
ts_compare = _GET["ts_compare"],
tags = tags,
extended = _GET["extended"],
ts_aggregation = _GET["ts_aggregation"],
no_fill = _GET["no_fill"],
tskey = _GET["tskey"],
limit = _GET["limit"],
initial_point = _GET["initial_point"],
}
-- Epochs in _GET are assumed to be adjusted to UTC. This is always the case when the browser submits epoch using a
-- datetimepicker (e.g., from any chart page).