xref: /dpdk/doc/guides/howto/telemetry.rst (revision 25d11a86c56d50947af33d0b79ede622809bd8b9)
1..  SPDX-License-Identifier: BSD-3-Clause
2    Copyright(c) 2018 Intel Corporation.
3
4DPDK Telemetry API User Guide
5==============================
6
7This document describes how the Data Plane Development Kit(DPDK) Telemetry API
8is used for querying port statistics from incoming traffic.
9
10Introduction
11------------
12
13The ``librte_telemetry`` provides the functionality so that users may query
14metrics from incoming port traffic. The application which initializes packet
15forwarding will act as the server, sending metrics to the requesting application
16which acts as the client.
17
18In DPDK, applications are used to initialize the ``telemetry``. To view incoming
19traffic on featured ports, the application should be run first (ie. after ports
20are configured). Once the application is running, the service assurance agent
21(for example the collectd plugin) should be run to begin querying the API.
22
23A client connects their Service Assurance application to the DPDK application
24via a UNIX socket. Once a connection is established, a client can send JSON
25messages to the DPDK application requesting metrics via another UNIX client.
26This request is then handled and parsed if valid. The response is then
27formatted in JSON and sent back to the requesting client.
28
29Pre-requisites
30~~~~~~~~~~~~~~
31
32* Python >= 2.5
33
34* Jansson library for JSON serialization
35
36Test Environment
37----------------
38
39``telemetry`` offers a range of selftests that a client can run within
40the DPDK application.
41
42Selftests are disabled by default. They can be enabled by setting the 'selftest'
43variable to 1 in rte_telemetry_initial_accept().
44
45Note: this 'hardcoded' value is temporary.
46
47Configuration
48-------------
49
50Enable the telemetry API by modifying the following config option before
51building DPDK::
52
53        CONFIG_RTE_LIBRTE_TELEMETRY=y
54
55Note: Meson will pick this up automatically if ``libjansson`` is available.
56
57Running the Application
58-----------------------
59
60The following steps demonstrate how to run the ``telemetry`` API  to query all
61statistics on all active ports, using the ``telemetry_client`` python script
62to query.
63Note: This guide assumes packet generation is applicable and the user is
64testing with testpmd as a DPDK primary application to forward packets, although
65any DPDK application is applicable.
66
67#. Launch testpmd as the primary application with ``telemetry``.::
68
69        ./app/testpmd --telemetry
70
71#. Launch the ``telemetry`` python script with a client filepath.::
72
73        python usertools/telemetry_client.py /var/run/some_client
74
75   The client filepath is going to be used to setup our UNIX connection with the
76   DPDK primary application, in this case ``testpmd``
77   This will initialize a menu where a client can proceed to recursively query
78   statistics, request statistics once or unregister the file_path, thus exiting
79   the menu.
80
81#. Send traffic to any or all available ports from a traffic generator.
82   Select a query option(recursive or singular polling).
83   The metrics will then be displayed on the client terminal in JSON format.
84
85#. Once finished, unregister the client using the menu command.
86