Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | 03-May-2022 | - | ||||
.circleci/ | H | 10-Feb-2021 | - | |||
bcache/ | H | 10-Feb-2021 | - | |||
blockdevice/ | H | 10-Feb-2021 | - | |||
btrfs/ | H | 10-Feb-2021 | - | |||
internal/ | H | 10-Feb-2021 | - | |||
iscsi/ | H | 10-Feb-2021 | - | |||
nfs/ | H | 10-Feb-2021 | - | |||
scripts/ | H | 10-Feb-2021 | - | |||
sysfs/ | H | 10-Feb-2021 | - | |||
xfs/ | H | 10-Feb-2021 | - | |||
.gitignore | H A D | 10-Feb-2021 | 11 | |||
.golangci.yml | H A D | 10-Feb-2021 | 34 | |||
CODE_OF_CONDUCT.md | H A D | 10-Feb-2021 | 155 | |||
CONTRIBUTING.md | H A D | 10-Feb-2021 | 6.5 KiB | |||
LICENSE | H A D | 10-Feb-2021 | 11.1 KiB | |||
MAINTAINERS.md | H A D | 10-Feb-2021 | 102 | |||
Makefile | H A D | 10-Feb-2021 | 859 | |||
Makefile.common | H A D | 10-Feb-2021 | 9.8 KiB | |||
NOTICE | H A D | 10-Feb-2021 | 237 | |||
README.md | H A D | 10-Feb-2021 | 2.7 KiB | |||
SECURITY.md | H A D | 10-Feb-2021 | 170 | |||
arp.go | H A D | 10-Feb-2021 | 2.2 KiB | |||
arp_test.go | H A D | 10-Feb-2021 | 1.2 KiB | |||
buddyinfo.go | H A D | 10-Feb-2021 | 2.2 KiB | |||
buddyinfo_test.go | H A D | 10-Feb-2021 | 2.3 KiB | |||
cpuinfo.go | H A D | 10-Feb-2021 | 12.2 KiB | |||
cpuinfo_armx.go | H A D | 10-Feb-2021 | 681 | |||
cpuinfo_mipsx.go | H A D | 10-Feb-2021 | 700 | |||
cpuinfo_others.go | H A D | 10-Feb-2021 | 761 | |||
cpuinfo_ppcx.go | H A D | 10-Feb-2021 | 685 | |||
cpuinfo_riscvx.go | H A D | 10-Feb-2021 | 687 | |||
cpuinfo_s390x.go | H A D | 10-Feb-2021 | 663 | |||
cpuinfo_test.go | H A D | 10-Feb-2021 | 11.7 KiB | |||
cpuinfo_x86.go | H A D | 10-Feb-2021 | 681 | |||
crypto.go | H A D | 10-Feb-2021 | 3.5 KiB | |||
crypto_test.go | H A D | 10-Feb-2021 | 3.1 KiB | |||
doc.go | H A D | 10-Feb-2021 | 1.3 KiB | |||
fixtures.ttar | H A D | 10-Feb-2021 | 258 KiB | |||
fs.go | H A D | 10-Feb-2021 | 1.4 KiB | |||
fs_test.go | H A D | 10-Feb-2021 | 1.1 KiB | |||
fscache.go | H A D | 10-Feb-2021 | 15.4 KiB | |||
fscache_test.go | H A D | 10-Feb-2021 | 6.7 KiB | |||
go.mod | H A D | 10-Feb-2021 | 198 | |||
go.sum | H A D | 10-Feb-2021 | 798 | |||
ipvs.go | H A D | 10-Feb-2021 | 5.9 KiB | |||
ipvs_test.go | H A D | 10-Feb-2021 | 6.6 KiB | |||
kernel_random.go | H A D | 10-Feb-2021 | 2.1 KiB | |||
kernel_random_test.go | H A D | 10-Feb-2021 | 1.6 KiB | |||
loadavg.go | H A D | 10-Feb-2021 | 1.6 KiB | |||
loadavg_test.go | H A D | 10-Feb-2021 | 2.1 KiB | |||
mdstat.go | H A D | 10-Feb-2021 | 6.2 KiB | |||
mdstat_test.go | H A D | 10-Feb-2021 | 4.8 KiB | |||
meminfo.go | H A D | 10-Feb-2021 | 8.1 KiB | |||
meminfo_test.go | H A D | 10-Feb-2021 | 2.5 KiB | |||
mountinfo.go | H A D | 10-Feb-2021 | 5.2 KiB | |||
mountinfo_test.go | H A D | 10-Feb-2021 | 6.9 KiB | |||
mountstats.go | H A D | 10-Feb-2021 | 18.6 KiB | |||
mountstats_test.go | H A D | 10-Feb-2021 | 16.8 KiB | |||
net_conntrackstat.go | H A D | 10-Feb-2021 | 3.8 KiB | |||
net_conntrackstat_test.go | H A D | 10-Feb-2021 | 2.6 KiB | |||
net_dev.go | H A D | 10-Feb-2021 | 6.4 KiB | |||
net_dev_test.go | H A D | 10-Feb-2021 | 2.5 KiB | |||
net_ip_socket.go | H A D | 10-Feb-2021 | 6.6 KiB | |||
net_ip_socket_test.go | H A D | 10-Feb-2021 | 3.3 KiB | |||
net_protocols.go | H A D | 10-Feb-2021 | 5.4 KiB | |||
net_protocols_test.go | H A D | 10-Feb-2021 | 4.9 KiB | |||
net_sockstat.go | H A D | 10-Feb-2021 | 4.3 KiB | |||
net_sockstat_test.go | H A D | 10-Feb-2021 | 4.6 KiB | |||
net_softnet.go | H A D | 10-Feb-2021 | 2.5 KiB | |||
net_softnet_test.go | H A D | 10-Feb-2021 | 1.3 KiB | |||
net_tcp.go | H A D | 10-Feb-2021 | 2.1 KiB | |||
net_tcp_test.go | H A D | 10-Feb-2021 | 4.1 KiB | |||
net_udp.go | H A D | 10-Feb-2021 | 2.1 KiB | |||
net_udp_test.go | H A D | 10-Feb-2021 | 4.1 KiB | |||
net_unix.go | H A D | 10-Feb-2021 | 5.9 KiB | |||
net_unix_test.go | H A D | 10-Feb-2021 | 3.8 KiB | |||
proc.go | H A D | 10-Feb-2021 | 7.3 KiB | |||
proc_cgroup.go | H A D | 10-Feb-2021 | 3.6 KiB | |||
proc_cgroup_test.go | H A D | 10-Feb-2021 | 2.4 KiB | |||
proc_environ.go | H A D | 10-Feb-2021 | 1.1 KiB | |||
proc_environ_test.go | H A D | 10-Feb-2021 | 1.3 KiB | |||
proc_fdinfo.go | H A D | 10-Feb-2021 | 3.4 KiB | |||
proc_fdinfo_test.go | H A D | 10-Feb-2021 | 989 | |||
proc_io.go | H A D | 10-Feb-2021 | 1.6 KiB | |||
proc_io_test.go | H A D | 10-Feb-2021 | 1.4 KiB | |||
proc_limits.go | H A D | 10-Feb-2021 | 4.8 KiB | |||
proc_limits_test.go | H A D | 10-Feb-2021 | 1.3 KiB | |||
proc_maps.go | H A D | 10-Feb-2021 | 4.5 KiB | |||
proc_maps32_test.go | H A D | 10-Feb-2021 | 2.2 KiB | |||
proc_maps64_test.go | H A D | 10-Feb-2021 | 3.4 KiB | |||
proc_ns.go | H A D | 10-Feb-2021 | 1.9 KiB | |||
proc_ns_test.go | H A D | 10-Feb-2021 | 1.2 KiB | |||
proc_psi.go | H A D | 10-Feb-2021 | 3.3 KiB | |||
proc_psi_test.go | H A D | 10-Feb-2021 | 3.9 KiB | |||
proc_smaps.go | H A D | 10-Feb-2021 | 3.8 KiB | |||
proc_smaps_test.go | H A D | 10-Feb-2021 | 2.3 KiB | |||
proc_stat.go | H A D | 10-Feb-2021 | 5.3 KiB | |||
proc_stat_test.go | H A D | 10-Feb-2021 | 2.9 KiB | |||
proc_status.go | H A D | 10-Feb-2021 | 4.4 KiB | |||
proc_status_test.go | H A D | 10-Feb-2021 | 3.2 KiB | |||
proc_test.go | H A D | 10-Feb-2021 | 6.5 KiB | |||
schedstat.go | H A D | 10-Feb-2021 | 3 KiB | |||
schedstat_test.go | H A D | 10-Feb-2021 | 3.5 KiB | |||
slab.go | H A D | 10-Feb-2021 | 3.5 KiB | |||
slab_test.go | H A D | 10-Feb-2021 | 2.3 KiB | |||
stat.go | H A D | 10-Feb-2021 | 7.1 KiB | |||
stat_test.go | H A D | 10-Feb-2021 | 2.2 KiB | |||
swaps.go | H A D | 10-Feb-2021 | 2.2 KiB | |||
swaps_test.go | H A D | 10-Feb-2021 | 2.7 KiB | |||
ttar | H A D | 10-Feb-2021 | 11.6 KiB | |||
vm.go | H A D | 10-Feb-2021 | 7.7 KiB | |||
vm_test.go | H A D | 10-Feb-2021 | 3 KiB | |||
xfrm.go | H A D | 10-Feb-2021 | 4.8 KiB | |||
xfrm_test.go | H A D | 10-Feb-2021 | 3.1 KiB | |||
zoneinfo.go | H A D | 10-Feb-2021 | 6.3 KiB | |||
zoneinfo_test.go | H A D | 10-Feb-2021 | 2.6 KiB |
README.md
1# procfs 2 3This 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, 17/sys, or both. For example, cpu statistics are gathered from 18`/proc/stat` and are available via the root procfs package. First, the proc filesystem mount 19point is initialized, and then the stat information is read. 20 21```go 22fs, err := procfs.NewFS("/proc") 23stats, err := fs.Stat() 24``` 25 26Some sub-packages such as `blockdevice`, require access to both the proc and sys filesystems. 27 28```go 29 fs, err := blockdevice.NewFS("/proc", "/sys") 30 stats, err := fs.ProcDiskstats() 31``` 32 33## Package Organization 34 35The packages in this project are organized according to (1) whether the data comes from the `/proc` or 36`/sys` filesystem and (2) the type of information being retrieved. For example, most process information 37can be gathered from the functions in the root `procfs` package. Information about block devices such as disk drives 38is available in the `blockdevices` sub-package. 39 40## Building and Testing 41 42The procfs library is intended to be built as part of another application, so there are no distributable binaries. 43However, most of the API includes unit tests which can be run with `make test`. 44 45### Updating Test Fixtures 46 47The procfs library includes a set of test fixtures which include many example files from 48the `/proc` and `/sys` filesystems. These fixtures are included as a [ttar](https://github.com/ideaship/ttar) file 49which is extracted automatically during testing. To add/update the test fixtures, first 50ensure the `fixtures` directory is up to date by removing the existing directory and then 51extracting the ttar file using `make fixtures/.unpacked` or just `make test`. 52 53```bash 54rm -rf fixtures 55make test 56``` 57 58Next, make the required changes to the extracted files in the `fixtures` directory. When 59the changes are complete, run `make update_fixtures` to create a new `fixtures.ttar` file 60based on the updated `fixtures` directory. And finally, verify the changes using 61`git diff fixtures.ttar`. 62