summaryrefslogtreecommitdiffstats
path: root/extras/vpp_stats_fs/README.md
blob: 52610feba941bc79c71b9cf58e0d598f623cb4d8 (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
# 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.
It relies 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 update their contents on epoch changes so that new counters get added to the filesystem.

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

## Usage

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

### Help
A basic help menu
```bash
make help
```

### Install
Building the binary
```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)
```bash
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
```

## Browsing the filesystem

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

```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:
```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

You can unmount the filesystem with the fusermount command.

May require a privileged user (sudo)

```bash
fusermount -u /path/to/mountpoint
```

To force the unmount even if the resource  is busy, add the -z option:
```bash
fusermount -uz /path/to/mountpoint
```
ral.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
#cloud-config
autoinstall:
  version: 1
  apt:
    geoip: true
    preserve_sources_list: false
    primary:
    - arches: [amd64, i386]
      uri: http://ca.archive.ubuntu.com/ubuntu
    - arches: [default]
      uri: http://ports.ubuntu.com/ubuntu-ports
  identity:
    hostname: s17-t33-sut1
    password: $6$Y62lhMGJD8YNzmJn$H4DSqjrwFp5WN3tOvIrF.g/G2duOV76zXHAmaA/RU8jfT8H8sDumLQe/Q.EmI5pjPv7dzgI8j9BQPWes7efBK0
    realname: testuser
    username: testuser
  keyboard:
    layout: us
    toggle: null
    variant: ''
  locale: en_US.UTF-8
  network:
    ethernets:
      enahisic2i0:
        addresses: [ 10.30.51.36/24 ]
        dhcp4: false
        gateway4: 10.30.51.1
        nameservers:
          addresses: [ 1.1.1.1, 8.8.8.8 ]
    version: 2
  packages:
    - python3
  refresh-installer:
    update: no
  ssh:
    allow-pw: true
    authorized-keys: []
    install-server: true
  storage:
    config:
    - grub_device: false
      id: disk-sda
      path: /dev/sda
      ptable: gpt
      preserve: false
      type: disk
      wipe: superblock-recursive
    - device: disk-sda
      grub_device: true
      id: partition-0
      flag: boot
      number: 1
      preserve: false
      size: 536870912
      type: partition
      wipe: superblock
    - id: format-0
      fstype: fat32
      preserve: false
      type: format
      volume: partition-0
    - device: disk-sda
      flag: ''
      grub_device: false
      id: partition-1
      number: 2
      preserve: false
      size: -1
      type: partition
      wipe: superblock
    - fstype: ext4
      id: format-1
      preserve: false
      type: format
      volume: partition-1
    - device: format-1
      id: mount-1
      path: /
      type: mount
    - device: format-0
      id: mount-0
      path: /boot/efi
      type: mount