2.3. Misc API

Miscellaneous interface functions.

Functions

function getIfNames()

Get the available ntopng network interfaces.

Returns:

a table containing (ifid -> ifname) mappings.

function getFirstInterfaceId()

Get the first available interface ID.

Returns:

the first interface ID.

function getId()

Get the currently selected interface ID.

Returns:

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.

Returns:

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.

Parameters:
  • host_ip – filter by a specific host/host@vlan

  • vlan_id – specify the host_ip filter vlan separately

Returns:

table with stats on success, nil otherwise.

function getMaxIfSpeed(string ifname)

Get the interface maximum speed.

Parameters:

ifname – the interface name.

Returns:

the interface maximum speed on success, nil otherwise.

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.

Returns:

endpoint name on success, nil otherwise.

function isPacketInterface()

Check if the interface captures raw packets.

Note

ZMQ interfaces, for example, are not packet interfaces but flow interfaces.

Returns:

true if the interface is a packet interface, false otherwise.

function isDiscoverableInterface()

Check if the network interface can be used to perform network discovery.

Returns:

true if the interface is discoverable, false otherwise.

function isBridgeInterface()

Check if current interface is an nEdge bridge interface.

Returns:

true if the interface is a bridge interface, false otherwise.

function isPcapDumpInterface()

Check if the network interface is a PcapInterface.

Returns:

true if the interface is a PcapInterface, false otherwise.

function isView()

Check if the network interface is a ViewInterface.

Returns:

true if the interface is a ViewInterface, false otherwise.

function isViewed()

Check if the network interface is viewed by a ViewInterface.

Returns:

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.

Returns:

the ViewInterface interface ID on success, nil otherwise.

function isLoopback()

Get the interface ID of the ViewInterface is a loopback interface.

Returns:

true if the interface is a loopback, false otherwise.

function isRunning()

Check if the network interface has started capturing packets.

Returns:

true if the interface is running, false otherwise.

function isIdle()

Check if the network interface has been temporary paused.

Returns:

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.

Returns:

table with interface stats (see NetworkInterface::lua) on success, nil otherwise.

function getNetworksStats()

Get local network stats.

Returns:

table (network_name -> network_stats) on success (see NetworkStats::lua), nil otherwise.

function getNetworkStats(int network_id)

Get a specific local network stats.

Parameters:

network_id – the numeric ID of the network.

Returns:

the network stats on success (see NetworkStats::lua), nil otherwise.

function getASesInfo(table pag_options = nil)

Get active autonomous systems information.

Parameters:

pag_options – options for the paginator.

Returns:

table (numASes, ASes) on success (see AutonomousSystem::lua), nil otherwise.

function getASInfo(int asn)

Get information about a specifc Autonomous System.

Parameters:

asn – the AS number.

Returns:

AS information on success (see AutonomousSystem::lua), nil otherwise.

function getCountriesInfo(table pag_options = nil)

Get active countries information.

Parameters:

pag_options – options for the paginator.

Returns:

table (numCountries, Countries) on success (see Country::lua), nil otherwise.

function getVLANsList()

Get active VLAN information.

Returns:

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.

Returns:

VLAN information on success (see VLAN::lua), nil otherwise.

function getHostPoolsInfo()

Get host pools information, like the number of members in the pool.

Returns:

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.

Returns:

table (device_ip -> device_ip_numeric) on success, nil otherwise.

function getSFlowDeviceInfo(string device_ip)

Returns information about a specific sFlow probe interfaces.

Parameters:

device_ip – the sFlow probe IP.

Returns:

table (if_idx -> if_information) on success, nil otherwise.

function captureToPcap(int duration, string bpf_filter)

Captures a ‘duration’ long pcap file. The capture is performed in background.

Parameters:
  • duration – The pcap duration (in seconds)

  • bpf_filter – An optional BPF filtering expression

Returns:

The path of the pcap file, nil otherwise.

function isCaptureRunning()

Checks if there is a pending captureToPcap() in progress.

Returns:

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).

Returns:

a table with active PODs (see ContainerStats::lua).

function getContainersStats(string pod_filter = nil)

Get information about the active Containers (eBPF only).

Parameters:

pod_filter – a filter to only show containers for the given POD

Returns:

a table with active containers (see ContainerStats::lua).