From 4cde74af2bb0edfb037af8bafb03da0c3c87d7c9 Mon Sep 17 00:00:00 2001 From: Simone Mainardi Date: Wed, 20 Nov 2019 16:05:14 +0100 Subject: [PATCH] Allows system probes timeseries to be enabled/disabled Fixes #3069 --- scripts/callbacks/system/5min/influxdb.lua | 202 ++++++++++--------- scripts/callbacks/system/minute/redis.lua | 48 +++-- scripts/callbacks/system/minute/rtt.lua | 6 +- scripts/callbacks/system/second/cpu.lua | 14 +- scripts/locales/en.lua | 3 + scripts/lua/admin/prefs.lua | 7 + scripts/lua/modules/http_lint.lua | 1 + scripts/lua/modules/internals_utils.lua | 15 +- scripts/lua/modules/prefs_menu.lua | 3 + scripts/lua/modules/system_scripts_utils.lua | 15 +- scripts/lua/system/influxdb_stats.lua | 24 ++- scripts/lua/system/redis_stats.lua | 19 +- scripts/lua/system/rtt_stats.lua | 3 + scripts/lua/system_stats.lua | 16 +- 14 files changed, 214 insertions(+), 162 deletions(-) diff --git a/scripts/callbacks/system/5min/influxdb.lua b/scripts/callbacks/system/5min/influxdb.lua index 6535154301..8d8c9c6235 100644 --- a/scripts/callbacks/system/5min/influxdb.lua +++ b/scripts/callbacks/system/5min/influxdb.lua @@ -7,29 +7,29 @@ local ts_utils = require("ts_utils_core") local MAX_INFLUX_EXPORT_QUEUE_LEN = 30 local probe = { - name = "InfluxDB", - description = "Monitors InfluxDB health and performance", - page_script = "influxdb_stats.lua", - page_order = 1600, + name = "InfluxDB", + description = "Monitors InfluxDB health and performance", + page_script = "influxdb_stats.lua", + page_order = 1600, } -- ############################################## local function get_memory_size_query(influxdb, schema, tstart, tend, time_step) - --[[ - See comments in function driver:getMemoryUsage() to understand - why it is necessary to subtract the HeapReleased from Sys. - --]] - local q = 'SELECT MEAN(Sys) - MEAN(HeapReleased) as mem_bytes' .. + --[[ + See comments in function driver:getMemoryUsage() to understand + why it is necessary to subtract the HeapReleased from Sys. + --]] + local q = 'SELECT MEAN(Sys) - MEAN(HeapReleased) as mem_bytes' .. ' FROM "_internal".."runtime"' .. " WHERE time >= " .. tstart .. "000000000 AND time <= " .. tend .. "000000000" .. " GROUP BY TIME(".. time_step .."s)" - return(q) + return(q) end local function get_write_success_query(influxdb, schema, tstart, tend, time_step) - local q = 'SELECT SUM(writePointsOk) as points' .. + local q = 'SELECT SUM(writePointsOk) as points' .. ' FROM (SELECT '.. ' (DERIVATIVE(MEAN(writePointsOk)) / '.. time_step ..') as writePointsOk' .. ' FROM "monitor"."shard" WHERE "database"=\''.. influxdb.db ..'\'' .. @@ -37,152 +37,154 @@ local function get_write_success_query(influxdb, schema, tstart, tend, time_step " GROUP BY id)" .. " GROUP BY TIME(".. time_step .."s)" - return(q) + return(q) end -- ############################################## function probe.isEnabled() - return(ts_utils.getDriverName() == "influxdb") + return(ts_utils.getDriverName() == "influxdb") end -- ############################################## function probe.loadSchemas(ts_utils) - local schema + local schema - schema = ts_utils.newSchema("influxdb:storage_size", { - metrics_type = ts_utils.metrics.gauge, - }) - schema:addTag("ifid") - schema:addMetric("disk_bytes") + schema = ts_utils.newSchema("influxdb:storage_size", { + metrics_type = ts_utils.metrics.gauge, + }) + schema:addTag("ifid") + schema:addMetric("disk_bytes") - schema = ts_utils.newSchema("influxdb:exported_points", - {metrics_type = ts_utils.metrics.counter}) - schema:addTag("ifid") - schema:addMetric("points") + schema = ts_utils.newSchema("influxdb:exported_points", + {metrics_type = ts_utils.metrics.counter}) + schema:addTag("ifid") + schema:addMetric("points") - schema = ts_utils.newSchema("influxdb:dropped_points",{metrics_type = ts_utils.metrics.counter}) - schema:addTag("ifid") - schema:addMetric("points") + schema = ts_utils.newSchema("influxdb:dropped_points",{metrics_type = ts_utils.metrics.counter}) + schema:addTag("ifid") + schema:addMetric("points") - schema = ts_utils.newSchema("influxdb:exports", {metrics_type = ts_utils.metrics.counter}) - schema:addTag("ifid") - schema:addMetric("num_exports") + schema = ts_utils.newSchema("influxdb:exports", {metrics_type = ts_utils.metrics.counter}) + schema:addTag("ifid") + schema:addMetric("num_exports") - schema = ts_utils.newSchema("influxdb:rtt", {metrics_type = ts_utils.metrics.gauge}) - schema:addTag("ifid") - schema:addMetric("millis_rtt") + schema = ts_utils.newSchema("influxdb:rtt", {metrics_type = ts_utils.metrics.gauge}) + schema:addTag("ifid") + schema:addMetric("millis_rtt") - -- The following metrics are built-in into influxdb - schema = ts_utils.newSchema("influxdb:memory_size", { - influx_internal_query = get_memory_size_query, - metrics_type = ts_utils.metrics.gauge, step = 10 - }) - schema:addTag("ifid") - schema:addMetric("mem_bytes") + -- The following metrics are built-in into influxdb + schema = ts_utils.newSchema("influxdb:memory_size", { + influx_internal_query = get_memory_size_query, + metrics_type = ts_utils.metrics.gauge, step = 10 + }) + schema:addTag("ifid") + schema:addMetric("mem_bytes") - schema = ts_utils.newSchema("influxdb:write_successes", { - influx_internal_query = get_write_success_query, - metrics_type = ts_utils.metrics.counter, step = 10 - }) - schema:addTag("ifid") - schema:addMetric("points") + schema = ts_utils.newSchema("influxdb:write_successes", { + influx_internal_query = get_write_success_query, + metrics_type = ts_utils.metrics.counter, step = 10 + }) + schema:addTag("ifid") + schema:addMetric("points") end -- ############################################## function probe.getTimeseriesMenu(ts_utils) - local influxdb = ts_utils.getQueryDriver() + local influxdb = ts_utils.getQueryDriver() - return { - {schema="influxdb:storage_size", label=i18n("traffic_recording.storage_utilization")}, - {schema="influxdb:memory_size", label=i18n("about.ram_memory")}, - {schema="influxdb:write_successes", label=i18n("system_stats.write_througput")}, - {schema="influxdb:exports", label=i18n("system_stats.exports_label"), - value_formatter = {"export_rate", "exports_format"}, - metrics_labels = {i18n("system_stats.exports_label")}}, - {schema="influxdb:exported_points", label=i18n("system_stats.exported_points")}, - {schema="influxdb:dropped_points", label=i18n("system_stats.dropped_points")}, - {schema="custom:infludb_exported_vs_dropped_points", label=i18n("system_stats.exported_vs_dropped_points"), - custom_schema = { - bases = {"influxdb:exported_points", "influxdb:dropped_points"}, - types = {"area", "line"}, axis = {1,2}, + return { + {schema="influxdb:storage_size", label=i18n("traffic_recording.storage_utilization")}, + {schema="influxdb:memory_size", label=i18n("about.ram_memory")}, + {schema="influxdb:write_successes", label=i18n("system_stats.write_througput")}, + {schema="influxdb:exports", label=i18n("system_stats.exports_label"), + value_formatter = {"export_rate", "exports_format"}, + metrics_labels = {i18n("system_stats.exports_label")}}, + {schema="influxdb:exported_points", label=i18n("system_stats.exported_points")}, + {schema="influxdb:dropped_points", label=i18n("system_stats.dropped_points")}, + {schema="custom:infludb_exported_vs_dropped_points", label=i18n("system_stats.exported_vs_dropped_points"), + custom_schema = { + bases = {"influxdb:exported_points", "influxdb:dropped_points"}, + types = {"area", "line"}, axis = {1,2}, + }, + metrics_labels = {i18n("system_stats.exported_points"), i18n("system_stats.dropped_points")}, }, - metrics_labels = {i18n("system_stats.exported_points"), i18n("system_stats.dropped_points")}, - }, - {schema="influxdb:rtt", label=i18n("graphs.num_ms_rtt")}, - } + {schema="influxdb:rtt", label=i18n("graphs.num_ms_rtt")}, + } end -- ############################################## function probe.getExportStats() - local points_exported - local points_dropped - local exports - local ifnames = interface.getIfNames() + local points_exported + local points_dropped + local exports + local ifnames = interface.getIfNames() - local influxdb = ts_utils.getQueryDriver() + local influxdb = ts_utils.getQueryDriver() - points_exported = influxdb:get_exported_points() - points_dropped = influxdb:get_dropped_points() - exports = influxdb:get_exports() + points_exported = influxdb:get_exported_points() + points_dropped = influxdb:get_dropped_points() + exports = influxdb:get_exports() - local res = { - health = influxdb:get_health(), - points_exported = points_exported, - points_dropped = points_dropped, - exports = exports, - } + local res = { + health = influxdb:get_health(), + points_exported = points_exported, + points_dropped = points_dropped, + exports = exports, + } - return(res) + return(res) end -- ############################################## function probe._measureRtt(when, ts_utils, influxdb) - local start_ms = ntop.gettimemsec() - local res = influxdb:getInfluxdbVersion() - local ifid = getSystemInterfaceId() + local start_ms = ntop.gettimemsec() + local res = influxdb:getInfluxdbVersion() + local ifid = getSystemInterfaceId() - if res ~= nil then - local end_ms = ntop.gettimemsec() + if res ~= nil then + local end_ms = ntop.gettimemsec() - ts_utils.append("influxdb:rtt", {ifid = ifid, millis_rtt = ((end_ms-start_ms)*1000)}, when) - end + ts_utils.append("influxdb:rtt", {ifid = ifid, millis_rtt = ((end_ms-start_ms)*1000)}, when) + end end -- ############################################## function probe._exportStats(when, ts_utils, influxdb) - local stats = probe.getExportStats() - local ifid = getSystemInterfaceId() + local stats = probe.getExportStats() + local ifid = getSystemInterfaceId() - ts_utils.append("influxdb:exported_points", {ifid = ifid, points = stats.points_exported}, when) - ts_utils.append("influxdb:dropped_points", {ifid = ifid, points = stats.points_dropped}, when) - ts_utils.append("influxdb:exports", {ifid = ifid, num_exports = stats.exports}, when) + ts_utils.append("influxdb:exported_points", {ifid = ifid, points = stats.points_exported}, when) + ts_utils.append("influxdb:dropped_points", {ifid = ifid, points = stats.points_dropped}, when) + ts_utils.append("influxdb:exports", {ifid = ifid, num_exports = stats.exports}, when) end -- ############################################## function probe._exportStorageSize(when, ts_utils, influxdb) - local disk_bytes = influxdb:getDiskUsage() - local ifid = getSystemInterfaceId() + local disk_bytes = influxdb:getDiskUsage() + local ifid = getSystemInterfaceId() - if(disk_bytes ~= nil) then - ts_utils.append("influxdb:storage_size", {ifid = ifid, disk_bytes = disk_bytes}, when) - end + if(disk_bytes ~= nil) then + ts_utils.append("influxdb:storage_size", {ifid = ifid, disk_bytes = disk_bytes}, when) + end end -- ############################################## -function probe.runTask(when, ts_utils) - local influxdb = ts_utils.getQueryDriver() +function probe.runTask(when, ts_utils, ts_creation) + if ts_creation then + local influxdb = ts_utils.getQueryDriver() - probe._exportStats(when, ts_utils, influxdb) - probe._measureRtt(when, ts_utils, influxdb) - probe._exportStorageSize(when, ts_utils, influxdb) + probe._exportStats(when, ts_utils, influxdb) + probe._measureRtt(when, ts_utils, influxdb) + probe._exportStorageSize(when, ts_utils, influxdb) + end end -- ############################################## diff --git a/scripts/callbacks/system/minute/redis.lua b/scripts/callbacks/system/minute/redis.lua index 6daab73405..b65bd00404 100644 --- a/scripts/callbacks/system/minute/redis.lua +++ b/scripts/callbacks/system/minute/redis.lua @@ -134,33 +134,37 @@ end -- ############################################## -function probe.runTask(when, ts_utils) - local ifid = getSystemInterfaceId() - local stats = probe.getStats() - local hits_key = "ntopng.cache.redis.stats" - local json = require("dkjson") - local old_hits_stats = ntop.getCache(hits_key) - local hits_stats = ntop.getCacheStats() +function probe.runTask(when, ts_utils, ts_creation) + if ts_creation then + local ifid = getSystemInterfaceId() + local stats = probe.getStats() + local hits_key = "ntopng.cache.redis.stats" + local json = require("dkjson") + local hits_stats = ntop.getCacheStats() - if(not isEmptyString(old_hits_stats)) then - old_hits_stats = json.decode(old_hits_stats) or {} - else - old_hits_stats = {} - end - ts_utils.append("redis:memory", {ifid = ifid, resident_bytes = stats["memory"]}, when) - ts_utils.append("redis:keys", {ifid = ifid, num_keys = stats["dbsize"]}, when) + local old_hits_stats = ntop.getCache(hits_key) - for key, val in pairs(hits_stats) do - if(old_hits_stats[key] ~= nil) then - local delta = math.max(val - old_hits_stats[key], 0) - - -- Dump the delta value as a gauge - ts_utils.append("redis:hits", {ifid = ifid, command = key, num_calls = delta}, when) + if(not isEmptyString(old_hits_stats)) then + old_hits_stats = json.decode(old_hits_stats) or {} + else + old_hits_stats = {} end - end - ntop.setCache(hits_key, json.encode(hits_stats)) + ts_utils.append("redis:memory", {ifid = ifid, resident_bytes = stats["memory"]}, when) + ts_utils.append("redis:keys", {ifid = ifid, num_keys = stats["dbsize"]}, when) + + for key, val in pairs(hits_stats) do + if(old_hits_stats[key] ~= nil) then + local delta = math.max(val - old_hits_stats[key], 0) + + -- Dump the delta value as a gauge + ts_utils.append("redis:hits", {ifid = ifid, command = key, num_calls = delta}, when) + end + end + + ntop.setCache(hits_key, json.encode(hits_stats)) + end end -- ############################################## diff --git a/scripts/callbacks/system/minute/rtt.lua b/scripts/callbacks/system/minute/rtt.lua index 240daeeffd..746c7325c5 100644 --- a/scripts/callbacks/system/minute/rtt.lua +++ b/scripts/callbacks/system/minute/rtt.lua @@ -77,7 +77,7 @@ end -- ############################################## -function probe.runTask(when, ts_utils) +function probe.runTask(when, ts_utils, ts_creation) local hosts = rtt_utils.getHosts() local pinged_hosts = {} local max_latency = {} @@ -145,7 +145,9 @@ function probe.runTask(when, ts_utils) print("[RTT] Reading response for host ".. host .."\n") end - ts_utils.append("monitored_host:rtt", {ifid = getSystemInterfaceId(), host = key, millis_rtt = rtt}, when) + if ts_creation then + ts_utils.append("monitored_host:rtt", {ifid = getSystemInterfaceId(), host = key, millis_rtt = rtt}, when) + end rtt = tonumber(rtt) rtt_utils.setLastRttUpdate(key, when, rtt, host) diff --git a/scripts/callbacks/system/second/cpu.lua b/scripts/callbacks/system/second/cpu.lua index aa95ab80e3..9a62f3064e 100644 --- a/scripts/callbacks/system/second/cpu.lua +++ b/scripts/callbacks/system/second/cpu.lua @@ -3,18 +3,18 @@ -- local probe = { - name = "CPU", - descripton = "Monitors the CPU usage", + name = "CPU", + descripton = "Monitors the CPU usage", } -- ############################################## -function probe.runTask(when, ts_utils) - local cpu_load = ntop.refreshCpuLoad() +function probe.runTask(when, ts_utils, ts_creation) + local cpu_load = ntop.refreshCpuLoad() - if(cpu_load ~= nil) then - ts_utils.append("system:cpu_load", {ifid = getSystemInterfaceId(), load_percentage = cpu_load}, when) - end + if ts_creation and cpu_load then + ts_utils.append("system:cpu_load", {ifid = getSystemInterfaceId(), load_percentage = cpu_load}, when) + end end -- ############################################## diff --git a/scripts/locales/en.lua b/scripts/locales/en.lua index 322aa8506d..2fa55aaf06 100644 --- a/scripts/locales/en.lua +++ b/scripts/locales/en.lua @@ -2854,6 +2854,7 @@ local lang = { ["none"] = "None", ["note_timeseries_resolution_disabled"] = "NOTE: this is disabled because \"%{pref}\" is not set to the default value.", ["note_update_frequency_disabled"] = "NOTE: this is disabled because of the \"%{pref}\" requirements.", + ["system_probes_timeseries"] = "Probes Timeseries", ["other_timeseries"] = "Other Timeseries", ["per_category"] = "Per Category", ["per_protocol"] = "Per Application", @@ -2957,6 +2958,8 @@ local lang = { ["toggle_email_notification_title"] = "Toggle Email Notification", ["toggle_flow_db_dump_export_description"] = "Toggle the export of tiny flows, that are flows with few packets or bytes. Reduces flow cardinality in databases, speeds-up inserts and searches. Tuning tiny flows can help to limit flow cardinality while not reducing visibility on dumped information.", ["toggle_flow_db_dump_export_title"] = "Tiny Flows Export", + ["toggle_system_probes_timeseries_title"] = "Probes", + ["toggle_system_probes_timeseries_description"] = "Toggle the creation of timeseries for system probes such as the RTT and the Redis monitor.", ["toggle_flow_rrds_description"] = "Toggle the creation of bytes timeseries for each port of the remote device as received through ZMQ (e.g. sFlow/NetFlow/SNMP).
For non sFlow devices, %%INPUT_SNMP and %%OUTPUT_SNMP must appear into the nprobe template.", ["toggle_flow_rrds_title"] = "Flow Devices", ["toggle_host_mask_description"] = "For privacy reasons it might be necessary to mask hosts IP addresses. For instance if you are an ISP you are not supposed to know which local addresses are accessing remote hosts.", diff --git a/scripts/lua/admin/prefs.lua b/scripts/lua/admin/prefs.lua index af897659ad..e4891a474e 100644 --- a/scripts/lua/admin/prefs.lua +++ b/scripts/lua/admin/prefs.lua @@ -1432,6 +1432,13 @@ function printStatsTimeseries() "ntopng.prefs.l2_device_ndpi_timeseries_creation", nil, elementToSwitch, showElementArray, javascriptAfterSwitch, showElement) + print(''..i18n('prefs.system_probes_timeseries')..'') + + prefsToggleButton(subpage_active, { + field = "toggle_system_probes_timeseries", + default = "1", + pref = "system_probes_timeseries", + }) print(''..i18n('prefs.other_timeseries')..'') diff --git a/scripts/lua/modules/http_lint.lua b/scripts/lua/modules/http_lint.lua index 3194571d1f..bbfebd3449 100644 --- a/scripts/lua/modules/http_lint.lua +++ b/scripts/lua/modules/http_lint.lua @@ -1194,6 +1194,7 @@ local known_parameters = { ["toggle_interface_traffic_rrd_creation"] = validateBool, ["toggle_local_hosts_traffic_rrd_creation"] = validateBool, ["toggle_l2_devices_traffic_rrd_creation"] = validateBool, + ["toggle_system_probes_timeseries"] = validateBool, ["toggle_flow_rrds"] = validateBool, ["toggle_pools_rrds"] = validateBool, ["toggle_flow_snmp_ports_rrds"] = validateBool, diff --git a/scripts/lua/modules/internals_utils.lua b/scripts/lua/modules/internals_utils.lua index 890dab1e6a..56331ae188 100644 --- a/scripts/lua/modules/internals_utils.lua +++ b/scripts/lua/modules/internals_utils.lua @@ -33,7 +33,7 @@ end -- ########################################### -local function printHashTablesTable(base_url, ifid) +local function printHashTablesTable(base_url, ifid, ts_creation) local page_params = {hash_table = _GET["hash_table"], tab = _GET["tab"], iffilter = ifid} print[[ @@ -84,7 +84,7 @@ $("#table-system-interfaces-stats").datatable({ }, { title: "]] print(i18n("chart")) print[[", field: "column_chart", - hidden: ]] if not ifid then print('true') else print('false') end print[[, + hidden: ]] if not ifid or not ts_creation then print('true') else print('false') end print[[, sortable: false, css: { textAlign: 'center', @@ -152,7 +152,7 @@ end -- ########################################### -local function printPeriodicActivitiesTable(base_url, ifid) +local function printPeriodicActivitiesTable(base_url, ifid, ts_creation) local page_params = {periodic_script = _GET["periodic_script"], tab = _GET["tab"], iffilter = ifid} print[[ @@ -186,7 +186,7 @@ $("#table-internals-periodic-activities").datatable({ }, { title: "]] print(i18n("interface")) print[[", field: "column_name", - hidden: ]] if ifid then print('true') else print('false') end print[[, + hidden: ]] if ifid and not ts_creation then print('true') else print('false') end print[[, sortable: true, css: { textAlign: 'left', @@ -203,7 +203,7 @@ $("#table-internals-periodic-activities").datatable({ }, { title: "]] print(i18n("chart")) print[[", field: "column_chart", - hidden: ]] if not ifid then print('true') else print('false') end print[[, + hidden: ]] if not ifid or not ts_creation then print('true') else print('false') end print[[, sortable: false, css: { textAlign: 'center', @@ -252,6 +252,7 @@ end function internals_utils.printInternals(ifid) local tab = _GET["tab"] or "hash_tables" + local ts_creation = ntop.getPref("ntopng.prefs.ifid_"..(ifid or getSystemInterfaceId())..".interface_rrd_creation") ~= "false" print[[ ") -elseif(page == "historical") then +elseif(page == "historical" and ts_creation) then local schema = _GET["ts_schema"] or "influxdb:storage_size" local selected_epoch = _GET["epoch"] or "" local tags = {ifid = getSystemInterfaceId()} diff --git a/scripts/lua/system/redis_stats.lua b/scripts/lua/system/redis_stats.lua index 875de6accc..2f204f788b 100644 --- a/scripts/lua/system/redis_stats.lua +++ b/scripts/lua/system/redis_stats.lua @@ -15,6 +15,8 @@ local system_scripts = require("system_scripts_utils") require("graph_utils") require("alert_utils") +local ts_creation = system_scripts.timeseriesCreationEnabled() + if not isAllowedSystemInterface() then return end @@ -50,10 +52,12 @@ else print("
  • ") end -if(page == "historical") then - print("
  • ") -else - print("
  • ") +if ts_creation then + if(page == "historical") then + print("
  • ") + else + print("
  • ") + end end if isAdministrator() @@ -87,10 +91,10 @@ if(page == "overview") then print("".. i18n("system_stats.health") .."
    "..i18n("system_stats.redis.short_desc_redis_health").."\n") -- No need to determine whether the chart exists for this as memory is always fetched straigth from redis - local storage_chart_available = ts_utils.exists("redis:memory", tags) + local storage_chart_available = ts_creation and ts_utils.exists("redis:memory", tags) print("".. i18n("about.ram_memory") .." "..ternary(storage_chart_available, "", "").."
    "..i18n("system_stats.redis.short_desc_redis_ram_memory").."\n") - local keys_chart_available = ts_utils.exists("redis:keys", tags) + local keys_chart_available = ts_creation and ts_utils.exists("redis:keys", tags) print("".. i18n("system_stats.redis.redis_keys") .." "..ternary(keys_chart_available, "", "").."
    "..i18n("system_stats.redis.short_desc_redis_keys").."\n") print[[ ]] -elseif(page == "historical") then +elseif(page == "historical" and ts_creation) then local schema = _GET["ts_schema"] or "redis:memory" local selected_epoch = _GET["epoch"] or "" local tags = {ifid = getSystemInterfaceId(), command = _GET["redis_command"]} diff --git a/scripts/lua/system/rtt_stats.lua b/scripts/lua/system/rtt_stats.lua index 01a699da2c..4f7fa3fe23 100644 --- a/scripts/lua/system/rtt_stats.lua +++ b/scripts/lua/system/rtt_stats.lua @@ -17,6 +17,8 @@ local template = require("template_utils") require("graph_utils") require("alert_utils") +local ts_creation = system_scripts.timeseriesCreationEnabled() + if not isAllowedSystemInterface() then return end @@ -175,6 +177,7 @@ if(page == "overview") then }, { title: "]] print(i18n("chart")) print[[", field: "column_chart", + hidden: ]] if not ts_creation then print("true") else print("false") end print[[, sortable: false, css: { textAlign: 'center', diff --git a/scripts/lua/system_stats.lua b/scripts/lua/system_stats.lua index fa0adaa3b1..edcf173e98 100644 --- a/scripts/lua/system_stats.lua +++ b/scripts/lua/system_stats.lua @@ -15,6 +15,8 @@ local alert_consts = require("alert_consts") require("graph_utils") require("alert_utils") +local ts_creation = system_scripts.timeseriesCreationEnabled() + if not isAllowedSystemInterface() then return end @@ -44,11 +46,13 @@ else print("
  • ") end -if(ts_utils.exists("process:resident_memory", {ifid=getSystemInterfaceId()})) then - if(page == "historical") then - print("
  • ") - else - print("
  • ") +if ts_creation then + if(ts_utils.exists("process:resident_memory", {ifid=getSystemInterfaceId()})) then + if(page == "historical") then + print("
  • ") + else + print("
  • ") + end end end @@ -197,7 +201,7 @@ if(page == "overview") then print("\n") print("\n") -elseif(page == "historical") then +elseif(page == "historical" and ts_creation) then local schema = _GET["ts_schema"] or "system:cpu_load" local selected_epoch = _GET["epoch"] or "" local tags = {ifid = getSystemInterfaceId()}