--
-- (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("".. i18n("system_stats.health") .." "..i18n("system_stats.short_desc_influxdb_health").." |  .. ) |
\n")
local storage_chart_available = ts_utils.exists("influxdb:storage_size", tags)
print("".. i18n("traffic_recording.storage_utilization") .." "..ternary(storage_chart_available, "", "").." "..i18n("system_stats.short_desc_influxdb_storage_utilization").." |  .. ) |
\n")
-- No need to determine whether the chart exists for this as memory is always fetched straigth from influxdb
print("".. i18n("about.ram_memory") .." ".." "..i18n("system_stats.short_desc_influxdb_ram_memory").." |  .. ) |
\n")
if(probe ~= nil) then
local stats = probe.getExportStats()
local exports_chart_available = ts_utils.exists("influxdb:exports", tags)
print("".. i18n("system_stats.exports") .." "..ternary(exports_chart_available, "", "").." "..i18n("system_stats.short_desc_influxdb_exports").." | ".. formatValue(stats.exports) .." |
\n")
local exported_points_chart_available = ts_utils.exists("influxdb:exported_points", tags)
print("".. i18n("system_stats.exported_points") .." "..ternary(exported_points_chart_available, "", "").." "..i18n("system_stats.short_desc_influxdb_exported_points").." | ".. formatValue(stats.points_exported) .." |
\n")
local dropped_points_chart_available = ts_utils.exists("influxdb:dropped_points", tags)
print("".. i18n("system_stats.dropped_points") .." "..ternary(dropped_points_chart_available, "", "").." "..i18n("system_stats.short_desc_influxdb_dropped_points").." | ".. formatValue(stats.points_dropped) .." |
\n")
end
print("".. i18n("system_stats.series_cardinality") .." "..i18n("system_stats.short_desc_influxdb_cardinality").." |  .. ) |
\n")
print[[
]]
print("
\n")
print("