2021-05-13 18:00:23 -04:00
|
|
|
# VPP stats segment FUSE filesystem {#stats_fs_doc}
|
2021-03-03 08:49:15 -08:00
|
|
|
|
|
|
|
The statfs binary allows to create a FUSE filesystem to expose and to browse the stats segment.
|
2021-03-24 07:32:07 -07:00
|
|
|
It relies on the Go-FUSE library and requires Go-VPP stats bindings to work.
|
2021-03-03 08:49:15 -08:00
|
|
|
|
|
|
|
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).
|
|
|
|
|
2021-03-24 07:32:07 -07:00
|
|
|
Directories update their contents on epoch changes so that new counters get added to the filesystem.
|
2021-03-03 08:49:15 -08:00
|
|
|
|
2021-03-24 07:32:07 -07:00
|
|
|
The script `install.sh` is responsible for buildiing and installing the filesystem.
|
2021-03-03 08:49:15 -08:00
|
|
|
|
2021-03-24 07:32:07 -07:00
|
|
|
## Usage
|
2021-03-03 08:49:15 -08:00
|
|
|
|
2021-03-24 07:32:07 -07:00
|
|
|
The local Makefile contains targets for all the possible intercations with the stats_f binary.
|
2021-03-03 08:49:15 -08:00
|
|
|
|
2021-03-24 07:32:07 -07:00
|
|
|
### Help
|
|
|
|
A basic help menu
|
2021-03-03 08:49:15 -08:00
|
|
|
```bash
|
2021-03-24 07:32:07 -07:00
|
|
|
make help
|
2021-03-03 08:49:15 -08:00
|
|
|
```
|
|
|
|
|
2021-03-24 07:32:07 -07:00
|
|
|
### Install
|
|
|
|
Building the binary
|
|
|
|
```bash
|
|
|
|
make install
|
|
|
|
```
|
2021-03-03 08:49:15 -08:00
|
|
|
|
2021-03-24 07:32:07 -07:00
|
|
|
### Start
|
|
|
|
Starts the filesystem. Requires a running VPP instance using the default socket /run/vpp/stats.sock.
|
|
|
|
|
|
|
|
May require a privileged user (sudo)
|
2021-03-03 08:49:15 -08:00
|
|
|
```bash
|
2021-03-24 07:32:07 -07:00
|
|
|
make start
|
|
|
|
```
|
|
|
|
|
|
|
|
### Stop
|
|
|
|
Stops and unmounts the filesystem if it is not busy.
|
|
|
|
|
|
|
|
May require a privileged user (sudo)
|
|
|
|
```bash
|
|
|
|
make stop
|
|
|
|
```
|
|
|
|
|
|
|
|
### Force unmount
|
|
|
|
Forces the unmount of the filesystem even if it is busy.
|
|
|
|
|
|
|
|
May require a privileged user (sudo)
|
|
|
|
```bash
|
|
|
|
make force-unmount
|
|
|
|
```
|
|
|
|
|
|
|
|
### Cleanup
|
|
|
|
Cleaning stats_fs binary.
|
|
|
|
|
|
|
|
May require a privileged user (sudo).
|
|
|
|
```bash
|
|
|
|
make clean
|
2021-03-03 08:49:15 -08:00
|
|
|
```
|
|
|
|
|
|
|
|
## Browsing the filesystem
|
|
|
|
|
2021-03-24 07:32:07 -07:00
|
|
|
The default mountpoint is /run/vpp/stats_fs_dir.
|
2021-03-03 08:49:15 -08:00
|
|
|
You can browse the filesystem as a regular user.
|
|
|
|
Example:
|
|
|
|
|
|
|
|
```bash
|
2021-03-24 07:32:07 -07:00
|
|
|
cd /run/vpp/stats_fs_dir
|
2021-03-03 08:49:15 -08:00
|
|
|
cd sys/node
|
|
|
|
ls -al
|
|
|
|
cat names
|
|
|
|
```
|
|
|
|
|
2021-03-24 07:32:07 -07:00
|
|
|
## 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:
|
|
|
|
```bash
|
|
|
|
go build
|
|
|
|
```
|
|
|
|
|
|
|
|
### Mounting
|
|
|
|
Then, ou can mount the filesystem with the local binary.
|
|
|
|
|
|
|
|
May require a privileged user (sudo).
|
|
|
|
|
|
|
|
The basic usage is:
|
|
|
|
```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
|
2021-03-03 08:49:15 -08:00
|
|
|
|
|
|
|
You can unmount the filesystem with the fusermount command.
|
2021-03-24 07:32:07 -07:00
|
|
|
|
|
|
|
May require a privileged user (sudo)
|
|
|
|
|
2021-03-03 08:49:15 -08:00
|
|
|
```bash
|
2021-03-24 07:32:07 -07:00
|
|
|
fusermount -u /path/to/mountpoint
|
2021-03-03 08:49:15 -08:00
|
|
|
```
|
|
|
|
|
|
|
|
To force the unmount even if the resource is busy, add the -z option:
|
|
|
|
```bash
|
2021-03-24 07:32:07 -07:00
|
|
|
fusermount -uz /path/to/mountpoint
|
2021-05-13 18:00:23 -04:00
|
|
|
```
|