Implements total counters for RRD writes and dropped points

This commit is contained in:
Simone Mainardi 2020-02-24 23:38:34 +01:00
parent eb4725d530
commit 1840de69bf
6 changed files with 73 additions and 78 deletions

View file

@ -649,6 +649,7 @@ function internals_utils.printPeriodicActivityDetails(ifId, url)
label = i18n("internals.chart_script_rrds", {script = script}),
extra_params = {periodic_script = script},
metrics_labels = {i18n("internals.num_writes"), i18n("internals.num_drops")},
value_formatter = {"fpoints", "formatPoints"}
}
end
end

View file

@ -14,11 +14,11 @@ schema:addTag("ifid")
schema:addTag("periodic_script")
schema:addMetric("num_ms_last")
schema = ts_utils.newSchema("periodic_script:rrd_writes", {step = 60, rrd_fname="ps_rrd_wr", metrics_type = ts_utils.metrics.gauge, is_critical_ts=true})
schema = ts_utils.newSchema("periodic_script:rrd_writes", {step = 60, rrd_fname="ps_rrd_w", is_critical_ts=true})
schema:addTag("ifid")
schema:addTag("periodic_script")
schema:addMetric("num_writes")
schema:addMetric("num_drops")
schema:addMetric("writes")
schema:addMetric("drops")
-------------------------------------------------------
-- TRAFFIC ELEMENTS USER SCRIPTS SCHEMAS

View file

@ -190,8 +190,8 @@ function ts_dump.update_periodic_scripts_stats(when, ifstats, verbose)
cur_ifname = getInterfaceName(cur_ifid)
end
if ps_stats["rrd"] and ps_stats["rrd"]["write"] then
rrd_out = string.format(" [rrd.write.tot_calls: %i][rrd.write.avg_call_duration_ms: %.2f][rrd.write.max_call_duration_ms: %.2f][rrd.write.tot_drops: %u]", ps_stats["rrd"]["write"]["tot_calls"] or 0, ps_stats["rrd"]["write"]["avg_call_duration_ms"], ps_stats["rrd"]["write"]["max_call_duration_ms"], ps_stats["rrd"]["write"]["tot_drops"] or 0)
if ps_stats["rrd"] and ps_stats["rrd"]["write"] and ps_stats["rrd"]["write"]["delta"] then
rrd_out = string.format(" [rrd.write.tot_calls: %i][rrd.write.avg_call_duration_ms: %.2f][rrd.write.max_call_duration_ms: %.2f][rrd.write.tot_drops: %u][slow: %s]", ps_stats["rrd"]["write"]["tot_calls"] or 0, ps_stats["rrd"]["write"]["delta"]["avg_call_duration_ms"], ps_stats["rrd"]["write"]["delta"]["max_call_duration_ms"], ps_stats["rrd"]["write"]["tot_drops"] or 0, tostring(ps_stats["rrd"]["write"]["delta"]["is_slow"]))
end
if rrd_out then
@ -214,7 +214,7 @@ function ts_dump.update_periodic_scripts_stats(when, ifstats, verbose)
-- Only if RRD is enabled, also total number of writes and dropped points are written
if ts_utils.getDriverName() == "rrd" then
if ps_stats["rrd"] and ps_stats["rrd"]["write"] then
ts_utils.append("periodic_script:rrd_writes", {ifid = ifstats.id, periodic_script = ps_name, num_writes = (ps_stats["rrd"]["write"]["tot_calls"] or 0), num_drops = (ps_stats["rrd"]["write"]["tot_drops"] or 0)}, when, verbose)
ts_utils.append("periodic_script:rrd_writes", {ifid = ifstats.id, periodic_script = ps_name, writes = (ps_stats["rrd"]["write"]["tot_calls"] or 0), drops = (ps_stats["rrd"]["write"]["tot_drops"] or 0)}, when, verbose)
end
end
end