diff --git a/scripts/callbacks/minute.lua b/scripts/callbacks/minute.lua index a7b7e6bbb0..aaf6727095 100644 --- a/scripts/callbacks/minute.lua +++ b/scripts/callbacks/minute.lua @@ -71,7 +71,7 @@ for _,_ifname in pairs(ifnames) do if ntop.isPro() and ifstats.profiles then -- profiles are only available in the Pro version basedir = fixPath(dirs.workingdir .. "/" .. ifstats.id..'/profilestats') for pname, ptraffic in pairs(ifstats.profiles) do - local rrdpath = fixPath(basedir.. "/" .. pname) + local rrdpath = fixPath(basedir.. "/" .. getPathFromKey(trimSpace(pname))) if(not(ntop.exists(rrdpath))) then ntop.mkdir(rrdpath) end diff --git a/scripts/lua/if_stats.lua b/scripts/lua/if_stats.lua index 6f98f9448d..0f754e9dc9 100644 --- a/scripts/lua/if_stats.lua +++ b/scripts/lua/if_stats.lua @@ -461,9 +461,15 @@ elseif(page == "trafficprofiles") then print("\n") print("\n") - for k,v in pairs(ifstats.profiles) do - trimmed = trimSpace(k) - print("\n") + for pname,pbytes in pairs(ifstats.profiles) do + local trimmed = trimSpace(pname) + local rrdname = fixPath(dirs.workingdir .. "/" .. ifid .. "/profilestats/" .. getPathFromKey(trimmed) .. "/bytes.rrd") + local statschart_icon = '' + if ntop.exists(rrdname) then + statschart_icon = '' + end + + print("\n") end print [[ diff --git a/scripts/lua/modules/graph_utils.lua b/scripts/lua/modules/graph_utils.lua index a4d1c010e9..01d7bea9ab 100644 --- a/scripts/lua/modules/graph_utils.lua +++ b/scripts/lua/modules/graph_utils.lua @@ -159,11 +159,16 @@ function percentageBar(total, value, valueLabel) end -- ######################################################## --- host_or_network: host or network name. If network, must be prefixed with 'net:' +-- host_or_network: host or network name. +-- If network, must be prefixed with 'net:' +-- If profile, must be prefixed with 'profile:' function getRRDName(ifid, host_or_network, rrdFile) if host_or_network ~= nil and string.starts(host_or_network, 'net:') then host_or_network = string.gsub(host_or_network, 'net:', '') rrdname = fixPath(dirs.workingdir .. "/" .. ifid .. "/subnetstats/") + elseif host_or_network ~= nil and string.starts(host_or_network, 'profile:') then + host_or_network = string.gsub(host_or_network, 'profile:', '') + rrdname = fixPath(dirs.workingdir .. "/" .. ifid .. "/profilestats/") else rrdname = fixPath(dirs.workingdir .. "/" .. ifid .. "/rrd/") end @@ -452,7 +457,11 @@ for k,v in ipairs(zoom_vals) do -- display 1 minute button only for networks and interface stats -- but exclude applications. Application statistics are gathered -- every 5 minutes - if zoom_vals[k][1] == '1m' and ((host and not string.starts(host, 'net:')) or not top_rrds[rrdFile]) then + local net_or_profile = false + if host and (string.starts(host, 'net:') or string.starts(host, 'profile:')) then + net_or_profile = true + end + if zoom_vals[k][1] == '1m' and (not net_or_profile and not top_rrds[rrdFile]) then goto continue end print('
Profile NameTraffic
"..k..""..bytesToSize(v).."
"..pname.." "..statschart_icon..""..bytesToSize(pbytes).."