mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-02 00:40:10 +00:00
Implements per-MAC RRDs (backend)
MAC bytes rrd is currently created if enabled from the preferences.
This commit is contained in:
parent
3b59672436
commit
c54b2523a1
4 changed files with 93 additions and 28 deletions
|
|
@ -32,6 +32,8 @@ local interface_rrd_creation = ntop.getPref("ntopng.prefs.interface_rrd_creation
|
|||
local interface_ndpi_timeseries_creation = ntop.getPref("ntopng.prefs.interface_ndpi_timeseries_creation")
|
||||
local host_rrd_creation = ntop.getPref("ntopng.prefs.host_rrd_creation")
|
||||
local host_ndpi_timeseries_creation = ntop.getPref("ntopng.prefs.host_ndpi_timeseries_creation")
|
||||
local l2_device_rrd_creation = ntop.getPref("ntopng.prefs.l2_device_rrd_creation")
|
||||
local l2_device_ndpi_timeseries_creation = ntop.getPref("ntopng.prefs.l2_device_ndpi_timeseries_creation")
|
||||
local host_categories_rrd_creation = ntop.getPref("ntopng.prefs.host_categories_rrd_creation")
|
||||
local flow_devices_rrd_creation = ntop.getPref("ntopng.prefs.flow_device_port_rrd_creation")
|
||||
local host_pools_rrd_creation = ntop.getPref("ntopng.prefs.host_pools_rrd_creation")
|
||||
|
|
@ -40,6 +42,7 @@ local asn_rrd_creation = ntop.getPref("ntopng.prefs.asn_rrd_creation")
|
|||
local vlan_rrd_creation = ntop.getPref("ntopng.prefs.vlan_rrd_creation")
|
||||
local tcp_retr_ooo_lost_rrd_creation = ntop.getPref("ntopng.prefs.tcp_retr_ooo_lost_rrd_creation")
|
||||
|
||||
-- ########################################################
|
||||
-- Populate some defaults
|
||||
if(tostring(flow_devices_rrd_creation) == "1" and ntop.isEnterprise() == false) then
|
||||
flow_devices_rrd_creation = "0"
|
||||
|
|
@ -57,6 +60,10 @@ if isEmptyString(interface_ndpi_timeseries_creation) then interface_ndpi_timeser
|
|||
if isEmptyString(host_rrd_creation) then host_rrd_creation = "1" end
|
||||
if isEmptyString(host_ndpi_timeseries_creation) then host_ndpi_timeseries_creation = "none" end
|
||||
|
||||
-- Devices RRD creation is OFF, as OFF is the nDPI rrd creation
|
||||
if isEmptyString(l2_device_rrd_creation) then l2_device_rrd_creation = "0" end
|
||||
if isEmptyString(l2_device_ndpi_timeseries_creation) then l2_device_ndpi_timeseries_creation = "none" end
|
||||
|
||||
-- tprint({interface_rrd_creation=interface_rrd_creation, interface_ndpi_timeseries_creation=interface_ndpi_timeseries_creation,host_rrd_creation=host_rrd_creation,host_ndpi_timeseries_creation=host_ndpi_timeseries_creation})
|
||||
|
||||
local ifnames = interface.getIfNames()
|
||||
|
|
@ -119,11 +126,9 @@ callback_utils.foreachInterface(ifnames, interface_rrd_creation_enabled, functio
|
|||
end
|
||||
|
||||
-- Save hosts stats (if enabled from the preferences)
|
||||
if host_rrd_creation ~= "0" or host_ndpi_timeseries_creation ~= "none" or host_categories_rrd_creation ~= "0" then
|
||||
if host_rrd_creation ~= "0" or host_categories_rrd_creation ~= "0" then
|
||||
|
||||
local localHostsOnly = true -- stats only for local hosts
|
||||
|
||||
local in_time = callback_utils.foreachHost(_ifname, verbose, localHostsOnly, function (hostname, host, hostbase)
|
||||
local in_time = callback_utils.foreachLocalHost(_ifname, time_threshold, function (hostname, host, hostbase)
|
||||
-- Crunch additional stats for local hosts only
|
||||
if(host.localhost) then
|
||||
-- Traffic stats
|
||||
|
|
@ -199,13 +204,27 @@ callback_utils.foreachInterface(ifnames, interface_rrd_creation_enabled, functio
|
|||
end
|
||||
end
|
||||
end -- ends if host.localhost
|
||||
end, time_threshold) -- end foreeachHost
|
||||
|
||||
end) -- end foreeachHost
|
||||
if not in_time then
|
||||
callback_utils.print(__FILE__(), __LINE__(), "ERROR: Cannot complete local hosts RRD dump in 5 minutes. Please check your RRD configuration.")
|
||||
return false
|
||||
end
|
||||
|
||||
if l2_device_rrd_creation ~= "0" then
|
||||
local in_time = callback_utils.foreachDevice(_ifname, time_threshold, function (devicename, device, devicebase)
|
||||
local name = fixPath(devicebase .. "/bytes.rrd")
|
||||
|
||||
createRRDcounter(name, 300, verbose)
|
||||
ntop.rrd_update(name, "N:"..tolongint(device["bytes.sent"]) .. ":" .. tolongint(device["bytes.rcvd"]))
|
||||
|
||||
end)
|
||||
|
||||
if not in_time then
|
||||
callback_utils.print(__FILE__(), __LINE__(), "ERROR: Cannot devices RRD dump in 5 minutes. Please check your RRD configuration.")
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
-- create RRD for ASN
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue