Results 1 to 9 of 9

Thread: Determination of properties for selected network ports

  1. #1

    Question Determination of properties for selected network ports

    The program “ss” (from the software package “iproute2”) is used to display Linux network information so far.
    The provided data can be filtered afterwards.

    Do you know any tools which can query the properties of such items (especially from a selection of processes and network ports) without retrieving the complete list (or files from the directory “/proc/net”) before?

  2. #2
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    11,264
    Blog Entries
    2

    Default Re: Determination of properties for selected network ports

    according to the MAN pages for ss...

    Displays not just network sockets, can also display UNIX sockets which can be thought of as system internal sockets.
    An example is if you have a frontend and database application running on your machine, you can configure the two to communicate with each other through an "external" path through the localhost network address (ie Network socket) or through a UNIX socket ((internal, is never exposed externally). A few other less used socket types are also listed in the MAN page

    What are you looking for?
    The MAN page describes an -e parameter which displays extended attributes.

    TSU
    Beginner Wiki Quickstart - https://en.opensuse.org/User:Tsu2/Quickstart_Wiki
    Solved a problem recently? Create a wiki page for future personal reference!
    Learn something new?
    Attended a computing event?
    Post and Share!

  3. #3
    Join Date
    Sep 2012
    Posts
    5,116

    Default Re: Determination of properties for selected network ports

    Quote Originally Posted by elfring View Post
    especially from a selection of processes and network ports
    ss can filter by socket addresses, port number is subset of socket address (which wildcard destination). ss cannot directly filter by processes.

  4. #4
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    11,264
    Blog Entries
    2

    Default Re: Determination of properties for selected network ports

    The ss MAN page says...

    can identify the Pid for the process using the socket with the -p option

    Also lists example usage that

    Display all TCP sockets with process SELinux security contexts.
    Code:
    ss -t -a -Z
    Find all local processes connected to X server.
    Code:
    ss -x src /tmp/.X11-unix/*
    Technically speaking, the examples don't actually filter on a Pid but if you know the socket being used by the process, then ss can filter.


    TSU
    Beginner Wiki Quickstart - https://en.opensuse.org/User:Tsu2/Quickstart_Wiki
    Solved a problem recently? Create a wiki page for future personal reference!
    Learn something new?
    Attended a computing event?
    Post and Share!

  5. #5

    Question Re: Determination of properties for selected network ports

    Quote Originally Posted by tsu2 View Post
    What are you looking for?
    Code:
    …
           ss - another utility to investigate sockets
    …
           FILTER := [ state STATE-FILTER ] [ EXPRESSION ]
                  Please take a look at the official documentation for details regarding filters.
    …

  6. #6
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    11,264
    Blog Entries
    2

    Default Re: Determination of properties for selected network ports

    I guess you're going to have to be more clear what you're looking for and how you want it displayed.
    When I run either of the following, I see data in a tab-delimited format, each entry is a single line (wrapped)
    Code:
    ss
    ss -e
    Newbies can paste this kind of data into a spreadsheet application for sorting and filtering.
    More accomplished coders can manipulate this data in a number of different ways, and if desired import the data into a database application where you can query using a database language like SQL.
    I'd also guess that a number of log analytical apps can handle this data.

    TSU
    Beginner Wiki Quickstart - https://en.opensuse.org/User:Tsu2/Quickstart_Wiki
    Solved a problem recently? Create a wiki page for future personal reference!
    Learn something new?
    Attended a computing event?
    Post and Share!

  7. #7

    Question Re: Determination of properties for selected network ports

    Quote Originally Posted by tsu2 View Post
    I guess you're going to have to be more clear what you're looking for and how you want it displayed.
    I became curious in checking the receive (and eventually also send) queue for selected network ports.

    Newbies can paste this kind of data into a spreadsheet application for sorting and filtering.
    More accomplished coders can manipulate this data in a number of different ways, and if desired import the data into a database application where you can query using a database language like SQL.
    I'd also guess that a number of log analytical apps can handle this data.
    These data processing approaches are generally possible.
    But I find that network connections can be very dynamic so that data import efforts should be avoided as much as possible for better responsiveness.

    Can it become more efficient to look only at a tiny fraction from the provided socket statistics?

  8. #8
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    11,264
    Blog Entries
    2

    Default Re: Determination of properties for selected network ports

    Sounds more like you might be interested in monitoring network port activity, which is different than inpsecitng the "properties" of a port which is generally meant to be a configuration.

    Various guides are available on the Internet for using ss if the MAN pages aren't your taste...
    The basic idea is that if you're using ss, you can filter by the "state"of a socket which roughly means what kind of activity

    A few articles on using ss
    https://www.linux.com/tutorials/intr...on-ss-command/
    https://www.networkworld.com/article...nnections.html
    https://www.cyberciti.biz/tips/linux...nnections.html

    My IMO,
    Unless you just have a liking for looking at data at the socket level for some reason, most Admins would probably find routine monitoring using a higher level app which can collect and display multiple data streams would be more useful...

    TSU
    Beginner Wiki Quickstart - https://en.opensuse.org/User:Tsu2/Quickstart_Wiki
    Solved a problem recently? Create a wiki page for future personal reference!
    Learn something new?
    Attended a computing event?
    Post and Share!

  9. #9

    Question Re: Monitoring network port activity

    Quote Originally Posted by tsu2 View Post
    Sounds more like you might be interested in monitoring network port activity,
    Yes!

    which is different than inpsecitng the "properties" of a port which is generally meant to be a configuration.
    Are there any additional views to consider around more efficient handling of socket statistics?

    The basic idea is that if you're using ss, you can filter by the "state"of a socket which roughly means what kind of activity
    • Do you find the available software documentation sufficient and complete here?
    • Which commands can query the receive queue for a single port (without retrieving more network data before)?

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •