mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-06 03:45:26 +00:00
Added other timeseries to the new pages
This commit is contained in:
parent
75eabb8b1b
commit
5c93cfe76b
8 changed files with 82 additions and 56 deletions
|
|
@ -1,85 +0,0 @@
|
|||
--
|
||||
-- (C) 2013-22 - ntop.org
|
||||
--
|
||||
|
||||
local dirs = ntop.getDirs()
|
||||
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
|
||||
|
||||
if(ntop.isPro()) then
|
||||
package.path = dirs.installdir .. "/pro/scripts/lua/modules/?.lua;" .. package.path
|
||||
end
|
||||
|
||||
require "lua_utils"
|
||||
local graph_utils = require "graph_utils"
|
||||
local page_utils = require("page_utils")
|
||||
local os_utils = require "os_utils"
|
||||
local ts_utils = require "ts_utils"
|
||||
|
||||
local check = _GET["check"]
|
||||
local subdir = _GET["subdir"]
|
||||
|
||||
local ifstats = interface.getStats()
|
||||
local ifId = ifstats.id
|
||||
local schema_prefix = ternary(subdir == "flow", "flow_check", "elem_check")
|
||||
sendHTTPContentTypeHeader('text/html')
|
||||
|
||||
|
||||
page_utils.set_active_menu_entry(page_utils.menu_entries.scripts_config)
|
||||
|
||||
dofile(dirs.installdir .. "/scripts/lua/inc/menu.lua")
|
||||
|
||||
if((check == nil) or (subdir == nil)) then
|
||||
print("<div class=\"alert alert alert-danger\"><i class='fas fa-exclamation-triangle fa-lg fa-ntopng-warning'></i> check/subdir parameter is missing (internal error ?)</div>")
|
||||
dofile(dirs.installdir .. "/scripts/lua/inc/footer.lua")
|
||||
return
|
||||
end
|
||||
|
||||
if(not ts_utils.exists(schema_prefix .. ":duration", {ifid = ifId, check = check, subdir = subdir})) then
|
||||
print("<div class=\"alert alert alert-danger\"><i class='fas fa-exclamation-triangle fa-lg fa-ntopng-warning'></i> No available stats for user script "..check.."</div>")
|
||||
dofile(dirs.installdir .. "/scripts/lua/inc/footer.lua")
|
||||
return
|
||||
end
|
||||
|
||||
local nav_url = ntop.getHttpPrefix().."/lua/check_details.lua?ifid="..interface.getId()
|
||||
local title = "User Script: "..check
|
||||
|
||||
page_utils.print_navbar(title, nav_url,
|
||||
{
|
||||
{
|
||||
active = page == "overview" or not page,
|
||||
page_name = "overview",
|
||||
label = "<i class=\"fas fa-home fa-lg\"></i>",
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
local schema = _GET["ts_schema"] or "custom:".. schema_prefix ..":vs_total"
|
||||
local selected_epoch = _GET["epoch"] or ""
|
||||
local url = ntop.getHttpPrefix()..'/lua/check_details.lua?ifid='..ifId..'&check='..check..'&page=historical&subdir='..subdir
|
||||
|
||||
local tags = {
|
||||
ifid = ifId,
|
||||
check = check,
|
||||
subdir = subdir,
|
||||
}
|
||||
|
||||
graph_utils.drawGraphs(ifId, schema, tags, _GET["zoom"], url, selected_epoch, {
|
||||
top_check = "top:".. schema_prefix ..":duration",
|
||||
|
||||
timeseries = {
|
||||
{schema = "custom:" .. schema_prefix .. ":total_stats", label = i18n("internals.total_stats", {subdir = firstToUpper(subdir)}), metrics_labels = {i18n("duration")}},
|
||||
{
|
||||
schema = "custom:".. schema_prefix ..":vs_total",
|
||||
label = i18n("internals.script_stats", {script = check}),
|
||||
value_formatter = {"NtopUtils.fmillis"},
|
||||
value_formatter2 = {"NtopUtils.fint"},
|
||||
metrics_labels = {
|
||||
i18n("internals.script_duration", {script = check}),
|
||||
i18n("internals.total_duration", {subdir = firstToUpper(subdir)}),
|
||||
i18n("internals.script_num_calls", {script = check}),
|
||||
},
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
dofile(dirs.installdir .. "/scripts/lua/inc/footer.lua")
|
||||
|
|
@ -53,22 +53,7 @@ page_utils.print_navbar(title, nav_url,
|
|||
Selectively render information pages
|
||||
--]]
|
||||
if page == "historical" then
|
||||
local schema = _GET["ts_schema"] or "container:num_flows"
|
||||
local selected_epoch = _GET["epoch"] or ""
|
||||
local url = ntop.getHttpPrefix()..'/lua/container_details.lua?container='..container..'&page=historical'
|
||||
|
||||
local tags = {
|
||||
ifid = ifId,
|
||||
container = container,
|
||||
}
|
||||
|
||||
graph_utils.drawGraphs(ifId, schema, tags, _GET["zoom"], url, selected_epoch, {
|
||||
timeseries = {
|
||||
{schema="container:num_flows", label=i18n("graphs.active_flows")},
|
||||
{schema="container:rtt", label=i18n("containers_stats.avg_rtt")},
|
||||
{schema="container:rtt_variance", label=i18n("containers_stats.avg_rtt_variance")},
|
||||
}
|
||||
})
|
||||
graph_utils.drawNewGraphs(container, interface.getId())
|
||||
end
|
||||
|
||||
dofile(dirs.installdir .. "/scripts/lua/inc/footer.lua")
|
||||
|
|
|
|||
|
|
@ -12,9 +12,7 @@ end
|
|||
|
||||
require "lua_utils"
|
||||
local graph_utils = require "graph_utils"
|
||||
local alert_utils = require "alert_utils"
|
||||
local page_utils = require("page_utils")
|
||||
local os_utils = require "os_utils"
|
||||
local ts_utils = require "ts_utils"
|
||||
|
||||
local hash_table = _GET["hash_table"]
|
||||
|
|
@ -54,25 +52,6 @@ page_utils.print_navbar(title, nav_url,
|
|||
}
|
||||
)
|
||||
|
||||
local schema = _GET["ts_schema"] or "ht:state"
|
||||
local selected_epoch = _GET["epoch"] or ""
|
||||
local url = ntop.getHttpPrefix()..'/lua/hash_table_details.lua?ifid='..ifId..'&page=historical'
|
||||
|
||||
local tags = {
|
||||
ifid = ifId,
|
||||
hash_table = hash_table,
|
||||
}
|
||||
|
||||
graph_utils.drawGraphs(ifId, schema, tags, _GET["zoom"], url, selected_epoch, {
|
||||
timeseries = {
|
||||
{schema = "ht:state", label = i18n("hash_table.CountriesHash"), extra_params = {hash_table = "CountriesHash"}},
|
||||
{schema = "ht:state", label = i18n("hash_table.HostHash"), extra_params = {hash_table = "HostHash"}},
|
||||
{schema = "ht:state", label = i18n("hash_table.MacHash"), extra_params = {hash_table = "MacHash"}},
|
||||
{schema = "ht:state", label = i18n("hash_table.FlowHash"), extra_params = {hash_table = "FlowHash"}},
|
||||
{schema = "ht:state", label = i18n("hash_table.AutonomousSystemHash"), extra_params = {hash_table = "AutonomousSystemHash"}},
|
||||
{schema = "ht:state", label = i18n("hash_table.ObservationPointHash"), extra_params = {hash_table = "ObservationPointHash"}},
|
||||
{schema = "ht:state", label = i18n("hash_table.VlanHash"), extra_params = {hash_table = "VlanHash"}},
|
||||
}
|
||||
})
|
||||
graph_utils.drawNewGraphs(hash_table, interface.getId())
|
||||
|
||||
dofile(dirs.installdir .. "/scripts/lua/inc/footer.lua")
|
||||
|
|
|
|||
|
|
@ -157,6 +157,26 @@ local community_timeseries = {
|
|||
{ schema = "host_pool:blocked_flows", label = i18n("graphs.blocked_flows"), priority = 0, measure_unit = "number", scale = 0, timeseries = { num_flows = { label = i18n('graphs.metric_labels.num_flows'), color = timeseries_info.get_timeseries_color('default') } } },
|
||||
{ schema = "host_pool:hosts", label = i18n("graphs.active_hosts"), priority = 0, measure_unit = "number", scale = 0, timeseries = { num_hosts = { label = i18n('graphs.metric_labels.num_hosts'), color = timeseries_info.get_timeseries_color('default') } } },
|
||||
{ schema = "host_pool:devices", label = i18n("graphs.active_devices"), priority = 0, measure_unit = "number", scale = 0, timeseries = { num_devices = { label = i18n('graphs.metric_labels.num_devices'), color = timeseries_info.get_timeseries_color('default') } } },
|
||||
|
||||
-- pod_details.lua (Pod): --
|
||||
{ schema = "pod:num_flows", label = i18n("graphs.active_flows"), priority = 0, measure_unit = "fps", scale = 0, timeseries = { as_client = { label = i18n('graphs.flows_as_client'), color = timeseries_info.get_timeseries_color('flows') }, as_server = { label = i18n('graphs.flows_as_server'), color = timeseries_info.get_timeseries_color('bytes_rcvd') }}, default_visible = true },
|
||||
{ schema = "pod:num_containers", label = i18n("containers_stats.containers"), priority = 0, measure_unit = "number", scale = 0, timeseries = { num_containers = { label = i18n('graphs.metric_labels.num_containers'), color = timeseries_info.get_timeseries_color('default') } } },
|
||||
{ schema = "pod:rtt", label = i18n("containers_stats.avg_rtt"), priority = 0, measure_unit = "rtt", scale = 0, timeseries = { as_client = { label = i18n('graphs.rtt_as_client'), color = timeseries_info.get_timeseries_color('default') }, as_server = { label = i18n('graphs.rtt_as_server'), color = timeseries_info.get_timeseries_color('default') } } },
|
||||
{ schema = "pod:rtt_variance", label = i18n("containers_stats.avg_rtt_variance"),priority = 0, measure_unit = "rtt", scale = 0, timeseries = { as_client = { label = i18n('graphs.variance_as_client'), color = timeseries_info.get_timeseries_color('default') }, as_server = { label = i18n('graphs.variance_as_server'), color = timeseries_info.get_timeseries_color('default') } } },
|
||||
|
||||
-- container_details.lua (Container): --
|
||||
{ schema = "container:num_flows", label = i18n("graphs.active_flows"), priority = 0, measure_unit = "fps", scale = 0, timeseries = { as_client = { label = i18n('graphs.flows_as_client'), color = timeseries_info.get_timeseries_color('flows') }, as_server = { label = i18n('graphs.flows_as_server'), color = timeseries_info.get_timeseries_color('bytes_rcvd') }}, default_visible = true },
|
||||
{ schema = "container:rtt", label = i18n("containers_stats.avg_rtt"), priority = 0, measure_unit = "rtt", scale = 0, timeseries = { as_client = { label = i18n('graphs.rtt_as_client'), color = timeseries_info.get_timeseries_color('default') }, as_server = { label = i18n('graphs.rtt_as_server'), color = timeseries_info.get_timeseries_color('default') } } },
|
||||
{ schema = "container:rtt_variance", label = i18n("containers_stats.avg_rtt_variance"),priority = 0, measure_unit = "rtt", scale = 0, timeseries = { as_client = { label = i18n('graphs.variance_as_client'), color = timeseries_info.get_timeseries_color('default') }, as_server = { label = i18n('graphs.variance_as_server'), color = timeseries_info.get_timeseries_color('default') } } },
|
||||
|
||||
-- hash_table_details.lua (Hash Table): --
|
||||
{ schema = "ht:state", label = i18n("hash_table.CountriesHash"), priority = 0, measure_unit = "number", ts_query = "CountriesHash", scale = 0, timeseries = { num_idle = { label = i18n('graphs.metric_labels.num_idle'), color = timeseries_info.get_timeseries_color('default') }, num_active = { label = i18n('graphs.metric_labels.num_active'), color = timeseries_info.get_timeseries_color('default') }}, default_visible = true },
|
||||
{ schema = "ht:state", label = i18n("hash_table.HostHash"), priority = 0, measure_unit = "number", ts_query = "HostHash", scale = 0, timeseries = { num_idle = { label = i18n('graphs.metric_labels.num_idle'), color = timeseries_info.get_timeseries_color('default') }, num_active = { label = i18n('graphs.metric_labels.num_active'), color = timeseries_info.get_timeseries_color('default') }}, default_visible = true },
|
||||
{ schema = "ht:state", label = i18n("hash_table.MacHash"), priority = 0, measure_unit = "number", ts_query = "MacHash", scale = 0, timeseries = { num_idle = { label = i18n('graphs.metric_labels.num_idle'), color = timeseries_info.get_timeseries_color('default') }, num_active = { label = i18n('graphs.metric_labels.num_active'), color = timeseries_info.get_timeseries_color('default') }}, default_visible = true },
|
||||
{ schema = "ht:state", label = i18n("hash_table.FlowHash"), priority = 0, measure_unit = "number", ts_query = "FlowHash", scale = 0, timeseries = { num_idle = { label = i18n('graphs.metric_labels.num_idle'), color = timeseries_info.get_timeseries_color('default') }, num_active = { label = i18n('graphs.metric_labels.num_active'), color = timeseries_info.get_timeseries_color('default') }}, default_visible = true },
|
||||
{ schema = "ht:state", label = i18n("hash_table.AutonomousSystemHash"), priority = 0, measure_unit = "number", ts_query = "AutonomousSystemHash", scale = 0, timeseries = { num_idle = { label = i18n('graphs.metric_labels.num_idle'), color = timeseries_info.get_timeseries_color('default') }, num_active = { label = i18n('graphs.metric_labels.num_active'), color = timeseries_info.get_timeseries_color('default') }}, default_visible = true },
|
||||
{ schema = "ht:state", label = i18n("hash_table.ObservationPointHash"), priority = 0, measure_unit = "number", ts_query = "ObservationPointHash", scale = 0, timeseries = { num_idle = { label = i18n('graphs.metric_labels.num_idle'), color = timeseries_info.get_timeseries_color('default') }, num_active = { label = i18n('graphs.metric_labels.num_active'), color = timeseries_info.get_timeseries_color('default') }}, default_visible = true },
|
||||
{ schema = "ht:state", label = i18n("hash_table.VlanHash"), priority = 0, measure_unit = "number", ts_query = "VlanHash", scale = 0, timeseries = { num_idle = { label = i18n('graphs.metric_labels.num_idle'), color = timeseries_info.get_timeseries_color('default') }, num_active = { label = i18n('graphs.metric_labels.num_active'), color = timeseries_info.get_timeseries_color('default') }}, default_visible = true },
|
||||
}
|
||||
|
||||
-- #################################
|
||||
|
|
|
|||
|
|
@ -49,23 +49,7 @@ page_utils.print_navbar(title, nav_url,
|
|||
Selectively render information pages
|
||||
--]]
|
||||
if page == "historical" then
|
||||
local schema = _GET["ts_schema"] or "pod:num_flows"
|
||||
local selected_epoch = _GET["epoch"] or ""
|
||||
local url = ntop.getHttpPrefix()..'/lua/pod_details.lua?pod='..pod..'&page=historical'
|
||||
|
||||
local tags = {
|
||||
ifid = ifId,
|
||||
pod = pod,
|
||||
}
|
||||
|
||||
graph_utils.drawGraphs(ifId, schema, tags, _GET["zoom"], url, selected_epoch, {
|
||||
timeseries = {
|
||||
{schema="pod:num_flows", label=i18n("graphs.active_flows")},
|
||||
{schema="pod:num_containers", label=i18n("containers_stats.containers")},
|
||||
{schema="pod:rtt", label=i18n("containers_stats.avg_rtt")},
|
||||
{schema="pod:rtt_variance", label=i18n("containers_stats.avg_rtt_variance")},
|
||||
}
|
||||
})
|
||||
graph_utils.drawNewGraphs(pod, interface.getId())
|
||||
end
|
||||
|
||||
dofile(dirs.installdir .. "/scripts/lua/inc/footer.lua")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue