• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

.circleci/H15-Sep-2019-6458

bcache/H15-Sep-2019-629462

blockdevice/H15-Sep-2019-315228

internal/H15-Sep-2019-464271

iscsi/H15-Sep-2019-607466

nfs/H15-Sep-2019-1,2991,095

scripts/H15-Sep-2019-3012

sysfs/H15-Sep-2019-2,1981,616

xfs/H15-Sep-2019-1,6981,440

.gitignoreH A D15-Sep-201911 21

.golangci.ymlH A D15-Sep-2019144 76

CONTRIBUTING.mdH A D15-Sep-2019870 1914

LICENSEH A D15-Sep-201911.1 KiB202169

MAINTAINERS.mdH A D15-Sep-2019102 32

MakefileH A D15-Sep-2019859 3012

Makefile.commonH A D15-Sep-20198.9 KiB276201

NOTICEH A D15-Sep-2019237 85

README.mdH A D15-Sep-20192.3 KiB5439

arp.goH A D15-Sep-20192.2 KiB8654

arp_test.goH A D15-Sep-20191.2 KiB4424

buddyinfo.goH A D15-Sep-20192.2 KiB8656

buddyinfo_test.goH A D15-Sep-20192.3 KiB7551

cpuinfo.goH A D15-Sep-20194.2 KiB167144

cpuinfo_test.goH A D15-Sep-20191.9 KiB6141

crypto.goH A D15-Sep-20193.5 KiB132105

crypto_test.goH A D15-Sep-20192.7 KiB5535

doc.goH A D15-Sep-20191.3 KiB461

fixtures.ttarH A D15-Sep-2019163.5 KiB4,5514,439

fs.goH A D15-Sep-20191.4 KiB4418

fs_test.goH A D15-Sep-20191.1 KiB4021

go.modH A D15-Sep-2019136 75

go.sumH A D15-Sep-2019376 54

ipvs.goH A D15-Sep-20195.9 KiB240188

ipvs_test.goH A D15-Sep-20196.6 KiB255229

mdstat.goH A D15-Sep-20195.6 KiB195134

mdstat_test.goH A D15-Sep-20193.9 KiB7047

mountinfo.goH A D15-Sep-20195.5 KiB179123

mountinfo_test.goH A D15-Sep-20194.6 KiB136117

mountstats.goH A D15-Sep-201918.1 KiB622397

mountstats_test.goH A D15-Sep-201911.9 KiB412384

net_dev.goH A D15-Sep-20196.4 KiB207160

net_dev_test.goH A D15-Sep-20192.5 KiB8761

net_softnet.goH A D15-Sep-20192.8 KiB9261

net_softnet_test.goH A D15-Sep-20191.1 KiB4323

net_unix.goH A D15-Sep-20196.8 KiB276208

net_unix_test.goH A D15-Sep-20193.9 KiB180155

proc.goH A D15-Sep-20197 KiB312216

proc_environ.goH A D15-Sep-20191.1 KiB4423

proc_environ_test.goH A D15-Sep-20191.3 KiB4828

proc_fdinfo.goH A D15-Sep-20193.4 KiB13388

proc_fdinfo_test.goH A D15-Sep-2019989 3519

proc_io.goH A D15-Sep-20191.6 KiB6633

proc_io_test.goH A D15-Sep-20191.4 KiB4729

proc_limits.goH A D15-Sep-20194.6 KiB158102

proc_limits_test.goH A D15-Sep-20191.2 KiB4527

proc_ns.goH A D15-Sep-20191.9 KiB6941

proc_ns_test.goH A D15-Sep-20191.2 KiB4526

proc_psi.goH A D15-Sep-20193.3 KiB10256

proc_psi_test.goH A D15-Sep-20193.9 KiB150116

proc_stat.goH A D15-Sep-20195.4 KiB199108

proc_stat_test.goH A D15-Sep-20192.9 KiB12898

proc_status.goH A D15-Sep-20193.9 KiB168107

proc_status_test.goH A D15-Sep-20192.6 KiB7859

proc_test.goH A D15-Sep-20196 KiB257225

schedstat.goH A D15-Sep-20192.9 KiB11973

schedstat_test.goH A D15-Sep-20193.5 KiB13094

stat.goH A D15-Sep-20197 KiB245178

stat_test.goH A D15-Sep-20192.2 KiB7541

ttarH A D15-Sep-201911.6 KiB414328

vm.goH A D15-Sep-20197.7 KiB211178

vm_test.goH A D15-Sep-20192.9 KiB8668

xfrm.goH A D15-Sep-20194.8 KiB188127

xfrm_test.goH A D15-Sep-20193.1 KiB6750

zoneinfo.goH A D15-Sep-20196.3 KiB197166

zoneinfo_test.goH A D15-Sep-20192.6 KiB4524

README.md

1# procfs
2
3This procfs package provides functions to retrieve system, kernel and process
4metrics from the pseudo-filesystems /proc and /sys.
5
6*WARNING*: This package is a work in progress. Its API may still break in
7backwards-incompatible ways without warnings. Use it at your own risk.
8
9[![GoDoc](https://godoc.org/github.com/prometheus/procfs?status.png)](https://godoc.org/github.com/prometheus/procfs)
10[![Build Status](https://travis-ci.org/prometheus/procfs.svg?branch=master)](https://travis-ci.org/prometheus/procfs)
11[![Go Report Card](https://goreportcard.com/badge/github.com/prometheus/procfs)](https://goreportcard.com/report/github.com/prometheus/procfs)
12
13## Usage
14
15The procfs library is organized by packages based on whether the gathered data is coming from
16/proc, /sys, or both.  Each package contains an `FS` type which represents the path to either /proc, /sys, or both.  For example, current cpu statistics are gathered from
17`/proc/stat` and are available via the root procfs package.  First, the proc filesystem mount
18point is initialized, and then the stat information is read.
19
20```go
21fs, err := procfs.NewFS("/proc")
22stats, err := fs.Stat()
23```
24
25Some sub-packages such as `blockdevice`, require access to both the proc and sys filesystems.
26
27```go
28    fs, err := blockdevice.NewFS("/proc", "/sys")
29    stats, err := fs.ProcDiskstats()
30```
31
32## Building and Testing
33
34The procfs library is normally built as part of another application.  However, when making
35changes to the library, the `make test` command can be used to run the API test suite.
36
37### Updating Test Fixtures
38
39The procfs library includes a set of test fixtures which include many example files from
40the `/proc` and `/sys` filesystems.  These fixtures are included as a [ttar](https://github.com/ideaship/ttar) file
41which is extracted automatically during testing.  To add/update the test fixtures, first
42ensure the `fixtures` directory is up to date by removing the existing directory and then
43extracting the ttar file using `make fixtures/.unpacked` or just `make test`.
44
45```bash
46rm -rf fixtures
47make test
48```
49
50Next, make the required changes to the extracted files in the `fixtures` directory.  When
51the changes are complete, run `make update_fixtures` to create a new `fixtures.ttar` file
52based on the updated `fixtures` directory.  And finally, verify the changes using
53`git diff fixtures.ttar`.
54