Implement redis num calls charts

This commit is contained in:
emanuele-f 2019-11-06 18:12:17 +01:00
parent d44dad6f31
commit 58d88d161e
10 changed files with 75 additions and 14 deletions

View file

@ -6,6 +6,7 @@ dirs = ntop.getDirs()
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
require "lua_utils"
local ts_utils = require("ts_utils")
--local json = require("dkjson")
sendHTTPContentTypeHeader('text/html')
@ -14,7 +15,13 @@ local stats = ntop.getCacheStats()
for key,val in pairsByValues(stats, rev) do
if(key ~= "num_reconnections") then
print("<tr><td>"..string.upper(string.sub(key, 5)).."</td><td align=right>"..val.."</td></tr>\n")
local chart = ""
if(ts_utils.exists("redis:hits", {ifid=getSystemInterfaceId(), command=key})) then
chart = '<a href="?page=historical&redis_command='..key..'&ts_schema=redis:hits"><i class=\'fa fa-area-chart fa-lg\'></i></a>'
end
print("<tr><td>"..string.upper(string.sub(key, 5)).."</td><td class='text-center'>".. chart .."</td><td align=right>"..val.."</td></tr>\n")
end
end