aboutsummaryrefslogtreecommitdiffstats
path: root/extras/vpp_stats_fs/README.rst
blob: d6635d146c01b58472518ac7a120df25c71ca72a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
.. _stats_fs_doc:

VPP stats segment FUSE filesystem
=================================

The statfs binary allows to create a FUSE filesystem to expose and to
browse the stats segment. It relies on the Go-FUSE library and requires
Go-VPP stats bindings to work.

The binary mounts a filesystem on the local machine with the data from
the stats segments. The counters can be opened and read as files
(e.g. in a Unix shell). Note that the value of a counter is determined
when the corresponding file is opened (as for /proc/interrupts).

Directories update their contents on epoch changes so that new counters
get added to the filesystem.

The script ``install.sh`` is responsible for building and installing
the filesystem.

Usage
-----

The local Makefile contains targets for all the possible interactions
with the stats_f binary.

Help
~~~~

A basic help menu

.. code:: bash

   make help

Install
~~~~~~~

Building the binary

.. code:: bash

   make install

Start
~~~~~

Starts the filesystem. Requires a running VPP instance using the default
socket /run/vpp/stats.sock.

May require a privileged user (sudo)

.. code:: bash

   make start

Stop
~~~~

Stops and unmounts the filesystem if it is not busy.

May require a privileged user (sudo)

.. code:: bash

   make stop

Force unmount
~~~~~~~~~~~~~

Forces the unmount of the filesystem even if it is busy.

May require a privileged user (sudo)

.. code:: bash

   make force-unmount

Cleanup
~~~~~~~

Cleaning stats_fs binary.

May require a privileged user (sudo).

.. code:: bash

   make clean

Browsing the filesystem
-----------------------

The default mountpoint is /run/vpp/stats_fs_dir. You can browse the
filesystem as a regular user. Example:

.. code:: bash

   cd /run/vpp/stats_fs_dir
   cd sys/node
   ls -al
   cat names

Building and mounting the filesystem manually
---------------------------------------------

For more modularity, you can build and mount the filesystem manually.

Building
~~~~~~~~

Inside the local directory, you can build the go binary:

.. code:: bash

   go build

Mounting
~~~~~~~~

Then, you can mount the filesystem with the local binary.

May require a privileged user (sudo).

The basic usage is:

.. code:: bash

   ./stats_fs <MOUNT_POINT>

**Options:** - debug <true|false> (default is false) - socket
<statSocket> (default is /run/vpp/stats.sock) : VPP socket for stats

Unmounting the file system
~~~~~~~~~~~~~~~~~~~~~~~~~~

You can unmount the filesystem with the fusermount command.

May require a privileged user (sudo)

.. code:: bash

   fusermount -u /path/to/mountpoint

To force the unmount even if the resource is busy, add the -z option:

.. code:: bash

   fusermount -uz /path/to/mountpoint