From 70eecaf44d61f2cabcd22ffb407b904242a122c9 Mon Sep 17 00:00:00 2001 From: Chris Lalancette Date: Tue, 6 Sep 2022 12:23:08 -0400 Subject: Add in support for network interface flags. (#2037) Signed-off-by: Chris Lalancette --- docs/index.rst | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'docs') diff --git a/docs/index.rst b/docs/index.rst index 8d663c7e..c30f7d6a 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -735,13 +735,21 @@ Network - **speed**: the NIC speed expressed in mega bits (MB), if it can't be determined (e.g. 'localhost') it will be set to ``0``. - **mtu**: NIC's maximum transmission unit expressed in bytes. + - **flags**: a string of comma-separated flags on the interface (may be an empty string). + Possible flags are: ``up``, ``broadcast``, ``debug``, ``loopback``, + ``pointopoint``, ``notrailers``, ``running``, ``noarp``, ``promisc``, + ``allmulti``, ``master``, ``slave``, ``multicast``, ``portsel``, + ``dynamic``, ``oactive``, ``simplex``, ``link0``, ``link1``, ``link2``, + and ``d2`` (some flags are only available on certain platforms). + + Availability: UNIX Example: >>> import psutil >>> psutil.net_if_stats() - {'eth0': snicstats(isup=True, duplex=, speed=100, mtu=1500), - 'lo': snicstats(isup=True, duplex=, speed=0, mtu=65536)} + {'eth0': snicstats(isup=True, duplex=, speed=100, mtu=1500, flags='up,broadcast,running,multicast'), + 'lo': snicstats(isup=True, duplex=, speed=0, mtu=65536, flags='up,loopback,running')} Also see `nettop.py`_ and `ifconfig.py`_ for an example application. @@ -749,6 +757,8 @@ Network .. versionchanged:: 5.7.3 `isup` on UNIX also checks whether the NIC is running. + .. versionchanged:: 5.9.3 *flags* field was added on POSIX. + Sensors ------- -- cgit v1.2.1