-- -- (C) 2013-18 - ntop.org -- local dirs = ntop.getDirs() package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path if((dirs.scriptdir ~= nil) and (dirs.scriptdir ~= "")) then package.path = dirs.scriptdir .. "/lua/modules/?.lua;" .. package.path end active_page = "system_stats" require "lua_utils" local page_utils = require("page_utils") local ts_utils = require("ts_utils") local system_scripts = require("system_scripts_utils") require("graph_utils") require("alert_utils") if not isAllowedSystemInterface() or (ts_utils.getDriverName() ~= "influxdb") then return end sendHTTPContentTypeHeader('text/html') page_utils.print_header() dofile(dirs.installdir .. "/scripts/lua/inc/menu.lua") local probe = system_scripts.getSystemProbe("influxdb") local page = _GET["page"] or "overview" local url = system_scripts.getPageScriptPath(probe) .. "?ifid=" .. getInterfaceId(ifname) system_schemas = system_scripts.getAdditionalTimeseries("influxdb") print [[ ]] -- ####################################################### if(page == "overview") then local fa_external = "" local tags = {ifid=getSystemInterfaceId()} print("\n") print("\n") local storage_chart_available = ts_utils.exists("influxdb:storage_size", tags) print("\n") -- No need to determine whether the chart exists for this as memory is always fetched straigth from influxdb print("\n") if(probe ~= nil) then local stats = probe.getExportStats() local exports_chart_available = ts_utils.exists("influxdb:exports", tags) print("\n") local exported_points_chart_available = ts_utils.exists("influxdb:exported_points", tags) print("\n") local dropped_points_chart_available = ts_utils.exists("influxdb:dropped_points", tags) print("\n") end print("\n") print[[ ]] print("
".. i18n("system_stats.health") .."
"..i18n("system_stats.short_desc_influxdb_health").."
".. i18n("traffic_recording.storage_utilization") .." "..ternary(storage_chart_available, "", "").."
"..i18n("system_stats.short_desc_influxdb_storage_utilization").."
".. i18n("about.ram_memory") .." ".."
"..i18n("system_stats.short_desc_influxdb_ram_memory").."
".. i18n("system_stats.exports") .." "..ternary(exports_chart_available, "", "").."
"..i18n("system_stats.short_desc_influxdb_exports").."
".. formatValue(stats.exports) .."
".. i18n("system_stats.exported_points") .." "..ternary(exported_points_chart_available, "", "").."
"..i18n("system_stats.short_desc_influxdb_exported_points").."
".. formatValue(stats.points_exported) .."
".. i18n("system_stats.dropped_points") .." "..ternary(dropped_points_chart_available, "", "").."
"..i18n("system_stats.short_desc_influxdb_dropped_points").."
".. formatValue(stats.points_dropped) .."
".. i18n("system_stats.series_cardinality") .."
"..i18n("system_stats.short_desc_influxdb_cardinality").."
\n") print(""..i18n("notes").."") print("") elseif(page == "historical") then local schema = _GET["ts_schema"] or "influxdb:storage_size" local selected_epoch = _GET["epoch"] or "" local tags = {ifid = getSystemInterfaceId()} url = url.."&page=historical" drawGraphs(getSystemInterfaceId(), schema, tags, _GET["zoom"], url, selected_epoch, { timeseries = system_schemas, }) elseif((page == "alerts") and isAdministrator()) then local old_ifname = ifname local influxdb = ts_utils.getQueryDriver() interface.select(getSystemInterfaceId()) _GET["ifid"] = getSystemInterfaceId() _GET["entity"] = alertEntity("influx_db") drawAlerts() interface.select(old_ifname) end -- ####################################################### dofile(dirs.installdir .. "/scripts/lua/inc/footer.lua")