2.3. Misc API¶
Miscellaneous interface functions.
Functions
-
function
setActiveInterfaceId
(int id)¶ Set the active interface by using the interface id.
- Return
- the interface name on success, nil otherwise.
- Parameters
id
: the interface id.
-
function
getIfNames
()¶ Get the available ntopng network interfaces.
- Return
- a table containing (ifid -> ifname) mappings.
-
function
getFirstInterfaceId
()¶ Get the first available interface ID.
- Return
- the first interface ID.
-
function
getId
()¶ Get the currently selected interface ID.
- Return
- the current interface ID.
-
function
select
(string ifname)¶ Set the active interface by using the interface name.
- Parameters
ifname
: the interface name.
-
function
hasVLANs
()¶ Check if the network interface has seen VLAN traffic.
- Return
- true if the interface has VLANs, false otherwise.
-
function
hasEBPF
()¶ Check if the network interface is capturing eBPF events.
- Parameters
true
: if the interface has eBPF, false otherwise.
-
function
getActiveFlowsStats
(string host_ip = nil, int vlan_id = nil)¶ Get statistics including nDPI protocol information of the network interface/a specific host.
- Return
- table with stats on success, nil otherwise.
- Parameters
host_ip
: filter by a specific host/host@vlanvlan_id
: specify the host_ip filter vlan separately
-
function
getMaxIfSpeed
(string ifname)¶ Get the interface maximum speed.
- Return
- the interface maximum speed on success, nil otherwise.
- Parameters
ifname
: the interface name.
-
function
resetCounters
(bool only_drops = true)¶ Reset interface packets counters.
- Parameters
only_drops
: if true, only reset the packet drops counter
-
function
resetStats
()¶ Reset all the hosts and L2 devices stats (e.g. traffic and application data).
- Note
- this will also reset the stats of the inactive hosts.
-
function
getEndpoint
()¶ Get the name of the remote probe when connected via ZMQ.
- Return
- endpoint name on success, nil otherwise.
-
function
isPacketInterface
()¶ Check if the interface captures raw packets.
- Return
- true if the interface is a packet interface, false otherwise.
- Note
- ZMQ interfaces, for example, are not packet interfaces but flow interfaces.
-
function
isDiscoverableInterface
()¶ Check if the network interface can be used to perform network discovery.
- Return
- true if the interface is discoverable, false otherwise.
-
function
isBridgeInterface
()¶ Check if current interface is an nEdge bridge interface.
- Return
- true if the interface is a bridge interface, false otherwise.
-
function
isPcapDumpInterface
()¶ Check if the network interface is a PcapInterface.
- Return
- true if the interface is a PcapInterface, false otherwise.
-
function
isView
()¶ Check if the network interface is a ViewInterface.
- Return
- true if the interface is a ViewInterface, false otherwise.
-
function
isViewed
()¶ Check if the network interface is viewed by a ViewInterface.
- Return
- true if the interface is viewed by a ViewInterface, false otherwise.
-
function
viewedBy
()¶ Get the interface ID of the ViewInterface above the current viewed interface.
- Return
- the ViewInterface interface ID on success, nil otherwise.
-
function
isLoopback
()¶ Get the interface ID of the ViewInterface is a loopback interface.
- Return
- true if the interface is a loopback, false otherwise.
-
function
isRunning
()¶ Check if the network interface has started capturing packets.
- Return
- true if the interface is running, false otherwise.
-
function
isIdle
()¶ Check if the network interface has been temporary paused.
- Return
- true if the interface is paused, false otherwise.
-
function
setInterfaceIdleState
(bool state)¶ Temporary pause or unpause a network interface.
- Parameters
state
: if true, the interface will be paused, otherwise resumed.
-
function
getStats
()¶ Get many information about the interface traffic and status.
- Return
- table with interface stats (see NetworkInterface::lua) on success, nil otherwise.
-
function
getNetworksStats
()¶ Get local network stats.
- Return
- table (network_name -> network_stats) on success (see NetworkStats::lua), nil otherwise.
-
function
getNetworkStats
(int network_id)¶ Get a specific local network stats.
- Return
- the network stats on success (see NetworkStats::lua), nil otherwise.
- Parameters
network_id
: the numeric ID of the network.
-
function
getASesInfo
(table pag_options = nil)¶ Get active autonomous systems information.
- Return
- table (numASes, ASes) on success (see AutonomousSystem::lua), nil otherwise.
- Parameters
pag_options
: options for the paginator.
-
function
getASInfo
(int asn)¶ Get information about a specifc Autonomous System.
- Return
- AS information on success (see AutonomousSystem::lua), nil otherwise.
- Parameters
asn
: the AS number.
-
function
getCountriesInfo
(table pag_options = nil)¶ Get active countries information.
- Return
- table (numCountries, Countries) on success (see Country::lua), nil otherwise.
- Parameters
pag_options
: options for the paginator.
-
function
getVLANsList
()¶ Get active VLAN information.
- Return
- table (numVLANs, VLANs) on success (see VLAN::lua), nil otherwise.
-
function
getVLANInfo
(int vlan_id)¶ Get a specific VLAN information. @oaram vlan_id the VLAN id to query.
- Return
- VLAN information on success (see VLAN::lua), nil otherwise.
-
function
getHostPoolsInfo
()¶ Get host pools information, like the number of members in the pool.
- Return
- host pools information on success, nil otherwise.
-
function
resetPoolsQuotas
()¶ Reset the host pools traffic accounted in quotas (nEdge only).
-
function
getSFlowDevices
()¶ Returns a list of active sFlow probes.
- Return
- table (device_ip -> device_ip_numeric) on success, nil otherwise.
-
function
getSFlowDeviceInfo
(string device_ip)¶ Returns information about a specific sFlow probe interfaces.
- Return
- table (if_idx -> if_information) on success, nil otherwise.
- Parameters
device_ip
: the sFlow probe IP.
-
function
captureToPcap
(int duration, string bpf_filter)¶ Captures a ‘duration’ long pcap file. The capture is performed in background.
- Return
- The path of the pcap file, nil otherwise.
- Parameters
duration
: The pcap duration (in seconds)bpf_filter
: An optional BPF filtering expression
-
function
isCaptureRunning
()¶ Checks if there is a pending captureToPcap() in progress.
- Return
- True is there is an ongoing capture, false otherwise.
-
function
stopRunningCapture
()¶ Stops a running capture.
-
function
getPodsStats
()¶ Get information about the active PODs (eBPF only).
- Return
- a table with active PODs (see ContainerStats::lua).
-
function
getContainersStats
(string pod_filter = nil)¶ Get information about the active Containers (eBPF only).
- Return
- a table with active containers (see ContainerStats::lua).
- Parameters
pod_filter
: a filter to only show containers for the given POD