IpNetnsExecNamespaceLsofI - command /sbin/ip netns exec [network-namespace] lsof -i"

This module provides class IpNetnsExecNamespaceLsofI for parsing the output of command /sbin/ip netns exec [network-namespace] lsof -i. Filters have been added so that sensitive information can be filtered out. This results in the modification of the original structure of data.

class insights.parsers.ip_netns_exec_namespace_lsof.IpNetnsExecNamespaceLsofI(context, extra_bad_lines=None)[source]

Bases: insights.core.CommandParser

This class provides processing for the output of command /sbin/ip netns exec [network-namespace] lsof -i.

Sample command output:

COMMAND   PID   USER    FD  TYPE  DEVICE     SIZE/OFF  NODE NAME
neutron-n 975   root    5u  IPv4  6482691    0t0        TCP *:http (LISTEN)

Examples

>>> len(ns_lsof.search(command="neutron-n"))
1
>>> ns_lsof.data[0]["command"] == "neutron-n"
True
fields

List of KeyValue namedtupules for each line in the command.

Type

list

data

List of key value pair derived from the command.

Type

list

Raises

SkipException -- When the file is empty or data is useless.

keyvalue

alias of KeyValue

parse_content(content)[source]

This method must be implemented by classes based on this class.

search(**kw)[source]

Search item based on key value pair.

Example

>>> len(ns_lsof.search(command="neutron-n")) == 1
True
>>> len(ns_lsof.search(user="nobody")) == 0
True