RRD rework

This commit is contained in:
Luca Deri 2017-10-30 23:56:15 +01:00
parent 0413516686
commit 31e26923b1
5 changed files with 68 additions and 95 deletions

View file

@ -978,7 +978,10 @@ function makeRRD(basedir, ifname, rrdname, step, value)
else
create_rrd(name, step, rrdname)
end
ntop.rrd_update(name, nil, tolongint(value))
ntop.tsSet(ifname..":"..rrdname, tonumber(value), 0)
if(enable_second_debug) then
io.write('Updating RRD ['.. ifname..'] '.. name .. " " .. value ..'\n')
end
@ -1070,14 +1073,13 @@ function touchRRD(rrdname)
if((last ~= nil) and ((now-last) > 3600)) then
local tdiff = now - 1800 -- This avoids to set the update continuously
local label = tdiff
if(ds_count == 1) then
ntop.rrd_update(rrdname, tdiff, 0)
elseif(ds_count == 2) then
ntop.rrd_update(rrdname, tdiff, 0, 0)
elseif(ds_count == 3) then
ntop.rrd_update(rrdname, tdiff, 0, 0, 0)
for i=1,ds_count do
label = label .. ":0"
end
ntop.rrd_update(rrdname, label)
end
end