aboutsummaryrefslogtreecommitdiffstats
path: root/extras/vpp_stats_fs/README.md
blob: c5ec8127d8aec9cbed3c6bbf1c220ca1b57ca79a (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
# VPP stats segment FUSE filesystem  {#stats_fs_doc}

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

The binary mounts a filesystem on the local machine whith 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 regularly update their contents so that new counters get added to the filesystem.

## Prerequisites (for building)

**GoVPP** library (master branch)
**Go-FUSE** library
vpp, vppapi

## Building

Here, we add the Go librairies before building the binary
```bash
go mod init stats_fs
go get git.fd.io/govpp.git@master
go get git.fd.io/govpp.git/adapter/statsclient@master
go get github.com/hanwen/go-fuse/v2
go build
```

## Usage

The basic usage is:
```bash
sudo ./statfs <MOUNT_POINT> &
```
**Options:**
 - debug \<true|false\> (default is false)
 - socket \<statSocket\> (default is /run/vpp/stats.sock)

## Browsing the filesystem

You can browse the filesystem as a regular user.
Example:

```bash
cd /path/to/mountpoint
cd sys/node
ls -al
cat names
```

## Unmounting the file system

You can unmount the filesystem with the fusermount command.
```bash
sudo fusermount -u /path/to/mountpoint
```

To force the unmount even if the resource  is busy, add the -z option:
```bash
sudo fusermount -uz /path/to/mountpoint
```