Fast Path Statistics library

The fast path statistics library can be preloaded (using LD_PRELOAD) when starting an application that accesses to network statistics. It hooks some glibc functions to inspect and to modify network statistics retrieved from the operating system.

It includes:

  • Interface statistics retrieved through netlink (RTM_NEWLINK and RTM_NEWSTATS messages)

  • Interface statistics retrieved through /proc/net/dev

  • Interface statistics retrieved through /sys/device/.../net/.../statistics

  • IP statistics retrieved through /proc/net/snmp

  • IPv6 statistics retrieved through /proc/net/snmp6

Usage

An application can be started with the fast path statistics library preloaded using the fps helper script.

# fps --help
usage: /usr/bin/fps [--log-level=<level>] [--use-syslog=0|1] <cmd> args...
--log-level=<level>

Set the log level. Valid range is from 0 (no log) to 7 (debug). Default is 4 (warning). The LIBFPS_LOG_LEVEL environment variable can be used for the same purpose.

--use-syslog=0|1

Set this option to 1 to redirect fast path statistics library logs to syslog. By default (0), logs are issued on stderr. The LIBFPS_USE_SYSLOG can be used for the same purpose.

Example

In this example, we want to print information provided by /proc/net/dev.

# cat /proc/net/dev
<linux-only statistics>

# fps cat /proc/net/dev
<fast path aware statistics>

When we execute "cat /proc/net/dev" whithout fps, the file /proc/net/dev only contains Linux network statistics.

In order to take into account the traffic managed by the Fast-Path, each Linux commands handling network statistics must be preloaded by the fps library.

Limitations

The fast path statistics library retrieves the fast path statistics from the fast path shared memories. If the fast path is updated with a new shared memory format, the applications using the fast path statistics library should be restarted.