Fixed top rrd.lua id

This commit is contained in:
Matteo Biscosi 2023-06-28 16:01:24 +00:00
parent fb751f4277
commit fc43d660de
3 changed files with 12 additions and 4 deletions

View file

@ -904,6 +904,11 @@ function driver:timeseries_top(options, top_tags)
local top_series = {}
local count = 0
local id = "bytes"
if ends(options.schema, "packets") then
id = "packets"
end
for top_item, value in pairsByValues(available_items, rev) do
if value > 0 then
@ -911,15 +916,15 @@ function driver:timeseries_top(options, top_tags)
local snmp_cached_dev = require "snmp_cached_dev"
local cached_device = snmp_cached_dev:create(options.tags.device)
local ifindex = available_tags[top_item][1].if_index
local id = shortenString(snmp_utils.get_snmp_interface_label(cached_device["interfaces"][ifindex]), 64)
local ext_label = shortenString(snmp_utils.get_snmp_interface_label(cached_device["interfaces"][ifindex]), 64)
count = table.len(available_series[top_item].data)
top_series[#top_series + 1] = {
data = available_series[top_item].data,
id = "bytes",
id = id,
type = "line",
statistics = available_series[top_item].statistics,
ext_label = id
ext_label = ext_label
}
end