mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-06 03:45:26 +00:00
Calculates and charts RRD queue length
This commit is contained in:
parent
bf2e37178e
commit
04f5b99342
11 changed files with 88 additions and 13 deletions
|
|
@ -615,7 +615,7 @@ function internals_utils.printPeriodicActivityDetails(ifId, url)
|
|||
local periodic_scripts_ts = {}
|
||||
|
||||
for script, script_details in pairsByKeys(periodic_activities_utils.periodic_activities) do
|
||||
local max_duration = script_details["periodicity"]
|
||||
local max_duration = script_details["max_duration"]
|
||||
|
||||
periodic_scripts_ts[#periodic_scripts_ts + 1] = {
|
||||
schema = "periodic_script:duration",
|
||||
|
|
@ -644,9 +644,21 @@ function internals_utils.printPeriodicActivityDetails(ifId, url)
|
|||
metrics_labels = {i18n("internals.num_writes"), i18n("internals.num_drops")},
|
||||
value_formatter = {"fpoints", "formatPoints"}
|
||||
}
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
if ts_utils.getDriverName() == "rrd" then
|
||||
periodic_scripts_ts[#periodic_scripts_ts + 1] = {
|
||||
separator = 1,
|
||||
}
|
||||
periodic_scripts_ts[#periodic_scripts_ts + 1] = {
|
||||
schema = "iface:ts_queue_length",
|
||||
label = i18n("internals.timeseries_queue_length"),
|
||||
metrics_labels = {i18n("internals.timeseries_queued_points")},
|
||||
}
|
||||
end
|
||||
|
||||
local timeseries = periodic_scripts_ts
|
||||
|
||||
if tostring(ifId) ~= getSystemInterfaceId() and ntop.getPref("ntopng.prefs.user_scripts_rrd_creation") == "1" then
|
||||
|
|
|
|||
|
|
@ -9,16 +9,17 @@ local periodic_activities_utils = {}
|
|||
|
||||
periodic_activities_utils.periodic_activities = {
|
||||
-- Can use this table to keep certain information for every periodic activity
|
||||
["stats_update.lua"] = { },
|
||||
["ht_state_update.lua"] = { },
|
||||
["minute.lua"] = { },
|
||||
["5min.lua"] = { },
|
||||
["hourly.lua"] = { },
|
||||
["daily.lua"] = { },
|
||||
["housekeeping.lua"] = { },
|
||||
["discover.lua"] = { },
|
||||
["timeseries.lua"] = { },
|
||||
["second.lua"] = { },
|
||||
-- Keep in sync with PeriodicActivities.cpp
|
||||
["stats_update.lua"] = { max_duration = 10 },
|
||||
["ht_state_update.lua"] = { max_duration = 10 },
|
||||
["minute.lua"] = { max_duration = 60 },
|
||||
["5min.lua"] = { max_duration = 300 },
|
||||
["hourly.lua"] = { max_duration = 600 },
|
||||
["daily.lua"] = { max_duration = 3600 },
|
||||
["housekeeping.lua"] = { max_duration = 6 },
|
||||
["discover.lua"] = { max_duration = 3600 },
|
||||
["timeseries.lua"] = { max_duration = 3600 },
|
||||
["second.lua"] = { max_duration = 2 },
|
||||
}
|
||||
|
||||
-- ###########################################
|
||||
|
|
|
|||
|
|
@ -18,7 +18,15 @@ schema:addMetric("idle_pct") -- idle
|
|||
schema = ts_utils.newSchema("system:cpu_load", {step = 5, metrics_type = ts_utils.metrics.gauge, rrd_fname="cpu_ld", is_critical_ts = true})
|
||||
schema:addTag("ifid")
|
||||
schema:addMetric("load_percentage")
|
||||
|
||||
|
||||
-------------------------------------------------------
|
||||
-- Timeseries write queue length
|
||||
-------------------------------------------------------
|
||||
|
||||
schema = ts_utils.newSchema("iface:ts_queue_length", {step = 5, metrics_type = ts_utils.metrics.gauge, is_critical_ts = true})
|
||||
schema:addTag("ifid")
|
||||
schema:addMetric("num_ts") -- Number of timeseries currently in the queue
|
||||
|
||||
-------------------------------------------------------
|
||||
-- FLOW USER SCRIPTS SCHEMAS
|
||||
-------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -48,6 +48,19 @@ end
|
|||
|
||||
-- ########################################################
|
||||
|
||||
function ts_dump.update_rrd_queue_length(ifid, when)
|
||||
if ts_utils.getDriverName() == "rrd" then
|
||||
ts_utils.append("iface:ts_queue_length",
|
||||
{
|
||||
ifid = ifid,
|
||||
num_ts = interface.rrd_queue_length(ifid) or 0
|
||||
},
|
||||
when)
|
||||
end
|
||||
end
|
||||
|
||||
-- ########################################################
|
||||
|
||||
function ts_dump.run_5sec_dump(ifid, when, periodic_ht_state_update_stats)
|
||||
local iface_rrd_creation_enabled = (ntop.getPref("ntopng.prefs.ifid_"..ifid..".interface_rrd_creation") ~= "false")
|
||||
and (ntop.getPref("ntopng.prefs.interface_rrd_creation") ~= "0")
|
||||
|
|
@ -59,6 +72,7 @@ function ts_dump.run_5sec_dump(ifid, when, periodic_ht_state_update_stats)
|
|||
|
||||
iface_update_periodic_ht_state_update_stats(when, ifid, periodic_ht_state_update_stats)
|
||||
update_user_scripts_stats(when, ifid, verbose)
|
||||
ts_dump.update_rrd_queue_length(ifid, when)
|
||||
end
|
||||
|
||||
-- ########################################################
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue