tx/rx bytes counters and some more stats as a libnl public API

Thomas Haller thaller at redhat.com
Thu Jan 22 09:05:54 PST 2015


On Wed, 2015-01-21 at 01:53 -0500, Ido Barkan wrote:
> Hi guys,
> 
> Is it possible to add some more nic stats as a rtnl_link_get_STAT API?
> 
> We need it to report to report current NIC health and bandwidth in ovirt/vdsm.
> 
> Specifically we use rx_bytes, tx_bytes, rx_dropped, tx_dropped, rx_errors, tx_errors
> and we have to read /sys/class/net/*/statistics/* in a cumbersome way.


Hi,


isn't this already there?



include/netlink/route/link.h:


typedef enum {
        RTNL_LINK_RX_BYTES,             /*!< Bytes received */
        RTNL_LINK_TX_BYTES,             /*!< Bytes sent */
        RTNL_LINK_RX_ERRORS,            /*!< Receive errors */
        RTNL_LINK_TX_ERRORS,            /*!< Send errors */
        RTNL_LINK_RX_DROPPED,           /*!< Received packets dropped */
        RTNL_LINK_TX_DROPPED,           /*!< Packets dropped during transmit */
} rtnl_link_stat_id_t;

extern uint64_t rtnl_link_get_stat(struct rtnl_link *, rtnl_link_stat_id_t);



Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.infradead.org/pipermail/libnl/attachments/20150122/f4c6af0b/attachment.sig>


More information about the libnl mailing list