Skip to content

recording_utils API ​

Extraction params:
  • time_from: epoch
  • time_to: epoch
  • filter: nBPF filter
Recording configuration params:
  • buffer_size: Buffer size (MB)
  • max_file_size: Max file length (MB)
  • max_file_duration: Max file duration (sec)
  • max_disk_space: Max disk space (MB)
  • snaplen: Capture length
  • writer_core: Writer thread affinity
  • reader_core: Reader thread affinity
  • indexer_cores: Indexer threads affinity
  • zmq_endpoint: ZMQ endpoint (optional)

recording_utils.isSupportedZMQInterface(ifid) ​

Check if an interface is a ZMQ interface that can be used with external interfaces for traffic recording and flow import

Parameters

  • ifid: the interface identifier

Returns: true if supported, false otherwise

recording_utils.getZMQProbeAddr(ifid) ​

Return the ZMQ endpoint that should be used by an external process (n2disk) to deliver flows to ntopng

Parameters

  • ifid: the interface identifier

Returns: the endpoint

recording_utils.isSupportedInterface(ifid) ​

Check if an interface is supported for recording (packet interface, or ZMQ interface that can be used with external interfaces for traffic dump and flow import)

Parameters

  • ifid: the interface identifier

Returns: true if supported, false otherwise

recording_utils.isExternalProvidersReminderDismissed(ifid) ​

Check if a reminder that warns the user about available external traffic rec. providers has to be shown

Returns: true if the reminder has to be shown, false otherwise

recording_utils.dismissExternalProvidersReminder(ifid) ​

Dismiss the reminder for external traffic recording providers

Returns: nil

recording_utils.isExtractionAvailable() ​

Check if traffic recording and extraction is allowed for the current user on an interface

Returns: true if extraction is available, false otherwise

recording_utils.getN2diskInfo() ​

Return information about the recording service (n2disk) including systemid and version

Returns: a table with the information

recording_utils.setLicense(key) ​

Install a license for n2disk

Parameters

  • key: The license key

Returns: true if the license is installed, false in case it is not possible

recording_utils.getExtInterfaces(ifid, show_all) ​

Return external interfaces, not in use by ntopng, that can be used through ZMQ interface for traffic recording and flow import

Parameters

  • ifid: the interface identifier

Returns: a table with external interfaces information

recording_utils.getPcapPath(ifid) ​

Return the root path for recorded pcap data

Parameters

  • ifid: the interface identifier

Returns: the path

recording_utils.volumeInfo(path) ​

Read information about a volume, including storage size and available space

Parameters

  • path: the volume path (or a folder inside the volume)

recording_utils.storageInfo(ifid, timeout) ​

Read information about the storage, including storage size and available space

Parameters

  • ifid: the interface identifier
  • timeout: the maxium time to compute the size

Returns: a table containing storage information (size is in bytes)

recording_utils.createConfig(ifid, params) ​

Generate a configuration for the traffic recording service (n2disk)

Parameters

  • ifid: the interface identifier
  • params: the traffic recording settings

recording_utils.isEnabled(ifid) ​

Check if traffic recording is available and enabled on an interface

Parameters

  • ifid: the interface identifier

Returns: true if recording is enabled, false otherwise

recording_utils.getViewedInterfacesWithRecording(view_ifid) ​

Return the list of viewed interfaces that have traffic recording enabled.

Returns: array of

recording_utils.isExtractionEnabled(ifid) ​

Check if traffic extraction is available and recording is enabled on an interface

recording_utils.isActive(ifid) ​

Check if the traffic recording service is running

Parameters

  • ifid: the interface identifier

Returns: true if the service is running, false otherwise

recording_utils.isExtractionActive(ifid) ​

Check if traffic recording is running and extraction is allowed for the current user on an interface

Parameters

  • ifid: the interface identifier

Returns: true if the service is running and extraction available, false otherwise

parse_proc_stats(proc_stats) ​

Return statistics from the traffic recording service (n2disk)

Parameters

  • ifid: the interface identifier

Returns: the statistics

recording_utils.stats(ifid) ​

Return statistics from the traffic recording service (n2disk)

Parameters

  • ifid: the interface identifier

Returns: the statistics

recording_utils.getStats(ifid) ​

Return dump window stats using recording_utils.stats() In case of View interface stats are aggregated from all virwed interfaces In case of View interface stats are aggregated from all virwed interfaces

Returns: stats with FirstDumpedEpoch/LastDumpedEpoch, is_active boolean

recording_utils.smartStats(ifid) ​

Return statistics from the traffic recording service (n2disk)

Parameters

  • ifid: the interface identifier

Returns: the statistics

recording_utils.getCurrentTrafficRecordingProviderTimelinePath(ifid) ​

Returns the path to the timeline of the selected traffic recorder

Parameters

  • ifid: the interface identifier

Returns: the timeline, if found, or nil

recording_utils.getTimelineByInterval(ifid, epoch_begin, epoch_end) ​

Return the current n2disk timeline, or the "Smart" timeline if active, based on the time interval

recording_utils.checkExtraction(ifid, use_smart) ​

Parse the configuration file of a manually-started n2disk and returns the timeline if found

Parameters

  • ifid: the interface identifier

Returns: true if extraction is possible and false otherwise, along with a check message

recording_utils.restart(ifid, config) ​

Start (or restart) the traffic recording service

Parameters

  • ifid: the interface identifier

recording_utils.stop(ifid) ​

Stop the traffic recording service

Parameters

  • ifid: the interface identifier

recording_utils.log(ifid, rows) ​

Returns: the log trace

recording_utils.isDataAvailable(ifid, epoch_begin, epoch_end) ​

Check if there is pcap data for a specified time interval (fully included in the dump window)

Parameters

  • ifid: the interface identifier
  • epoch_begin: the begin time (epoch)
  • epoch_end: the end time (epoch)

Returns: a table with 'available' = true if the specified interval is included in the dump window, 'epoch_begin'/'epoch_end' are also returned with the actual available window.

recording_utils.getJobFiles(id) ​

Return the list of pcap files extracted for a job

Parameters

  • job_id: the job identifier

Returns: the list of pcap files (paths)

recording_utils.deleteJob(job_id) ​

Delete an extraction job and its pcap data on disk, if any

Parameters

  • job_id: the job identifier

recording_utils.deleteAndStopAllJobs(ifid) ​

Delete and stop all the extraction jobs for the specified interface.

Parameters

  • ifid: the interface identifier

recording_utils.extractionJobsInfo(ifid) ​

Return statistics about the extraction jobs.

Parameters

  • ifid: the interface identifier

Returns: the jobs statistics (ready, total)

recording_utils.getExtractionJobs(ifid) ​

Return the list of scheduled extraction jobs.

Parameters

  • ifid: the interface identifier

Returns: the list of jobs

recording_utils.stopJob(job_id) ​

Stop a running extraction job.

Parameters

  • job_id: the job identifier

recording_utils.scheduleExtraction(ifid, params) ​

Schedule a new extraction job.

Parameters

  • ifid: the interface identifier
  • params: the extraction parameters. time_from/time_to (epoch) are mandatory. filter (nBPF format) is optional.

Returns: the newly created job

Documentation of the ntop open source tools.