3 This example demonstrates how to retrieve statistics from VPP using [the new Stats API](https://github.com/FDio/vpp/blob/master/src/vpp/stats/stats.md).
7 The following requirements are required to run this example:
9 - install **VPP 18.10+**
10 - enable stats in VPP:
17 > The [default socket](https://wiki.fd.io/view/VPP/Command-line_Arguments#.22statseg.22_parameters) is located at `/run/vpp/stats.sock`.
18 - run the VPP, ideally with some traffic
22 First build the example: `go build git.fd.io/govpp.git/examples/stats-api`.
24 Use commands `ls` and `dump` to list and dump statistics. Optionally, patterns can be used to filter the results.
26 ### List stats matching patterns `/sys/` and `/if/`
28 $ ./stats-api ls /sys/ /if/
29 Listing stats.. /sys/ /if/
33 - /sys/last_stats_clear
58 ### Dump all stats with their types and values
62 - /sys/last_update ScalarIndex 10408
63 - /sys/heartbeat ScalarIndex 1041
64 - /err/ip4-icmp-error/unknown type ErrorIndex 5
65 - /net/route/to CombinedCounterVector [[{Packets:0 Bytes:0} {Packets:0 Bytes:0} {Packets:0 Bytes:0} {Packets:0 Bytes:0} {Packets:0 Bytes:0} {Packets:0 Bytes:0} {Packets:0 Bytes:0} {Packets:0 Bytes:0} {Packets:0 Bytes:0} {Packets:0 Bytes:0} {Packets:0 Bytes:0} {Packets:0 Bytes:0} {Packets:0 Bytes:0} {Packets:5 Bytes:420}]]
66 - /if/drops SimpleCounterVector [[0 5 5]]