aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Drung <benjamin.drung@cloud.ionos.com>2019-06-25 19:27:07 +0200
committerBen Kochie <superq@gmail.com>2019-06-25 19:27:07 +0200
commit4f074dfbc73803b532bf02d8aab4efcbacec311b (patch)
treead6665650268873d5b41dea6b83bb6839aede4f3
parente972e38b423632a4f45326bd33eb127a4935f1f6 (diff)
downloadprometheus_node_collector-4f074dfbc73803b532bf02d8aab4efcbacec311b.tar.bz2
prometheus_node_collector-4f074dfbc73803b532bf02d8aab4efcbacec311b.tar.xz
prometheus_node_collector-4f074dfbc73803b532bf02d8aab4efcbacec311b.zip
Update procfs to v0.0.3 (#1395)
procfs v0.0.3 is a requirement for https://github.com/prometheus/node_exporter/pull/1357 Signed-off-by: Benjamin Drung <benjamin.drung@cloud.ionos.com>
-rw-r--r--go.mod3
-rw-r--r--go.sum2
-rw-r--r--vendor/github.com/prometheus/procfs/Makefile.common7
-rw-r--r--vendor/github.com/prometheus/procfs/fixtures.ttar551
-rw-r--r--vendor/github.com/prometheus/procfs/go.mod5
-rw-r--r--vendor/github.com/prometheus/procfs/go.sum2
-rw-r--r--vendor/github.com/prometheus/procfs/internal/fs/fs.go3
-rw-r--r--vendor/github.com/prometheus/procfs/internal/util/valueparser.go77
-rw-r--r--vendor/github.com/prometheus/procfs/mdstat.go111
-rw-r--r--vendor/github.com/prometheus/procfs/mountinfo.go178
-rw-r--r--vendor/github.com/prometheus/procfs/proc.go14
-rw-r--r--vendor/github.com/prometheus/procfs/proc_environ.go43
-rw-r--r--vendor/github.com/prometheus/procfs/proc_stat.go2
-rw-r--r--vendor/github.com/prometheus/procfs/sysfs/class_infiniband.go370
-rw-r--r--vendor/github.com/prometheus/procfs/sysfs/class_power_supply.go362
-rw-r--r--vendor/modules.txt2
16 files changed, 1559 insertions, 173 deletions
diff --git a/go.mod b/go.mod
index 7fa5042..8252c44 100644
--- a/go.mod
+++ b/go.mod
@@ -5,7 +5,6 @@ require (
5 github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e 5 github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e
6 github.com/ema/qdisc v0.0.0-20180104102928-b307c22d3ce7 6 github.com/ema/qdisc v0.0.0-20180104102928-b307c22d3ce7
7 github.com/godbus/dbus v0.0.0-20190402143921-271e53dc4968 7 github.com/godbus/dbus v0.0.0-20190402143921-271e53dc4968
8 github.com/google/go-cmp v0.3.0 // indirect
9 github.com/hodgesds/perf-utils v0.0.7 8 github.com/hodgesds/perf-utils v0.0.7
10 github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect 9 github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect
11 github.com/lufia/iostat v0.0.0-20170605150913-9f7362b77ad3 10 github.com/lufia/iostat v0.0.0-20170605150913-9f7362b77ad3
@@ -16,7 +15,7 @@ require (
16 github.com/prometheus/client_golang v1.0.0 15 github.com/prometheus/client_golang v1.0.0
17 github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90 16 github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90
18 github.com/prometheus/common v0.4.1 17 github.com/prometheus/common v0.4.1
19 github.com/prometheus/procfs v0.0.2 18 github.com/prometheus/procfs v0.0.3
20 github.com/siebenmann/go-kstat v0.0.0-20160321171754-d34789b79745 19 github.com/siebenmann/go-kstat v0.0.0-20160321171754-d34789b79745
21 github.com/sirupsen/logrus v1.4.2 // indirect 20 github.com/sirupsen/logrus v1.4.2 // indirect
22 github.com/soundcloud/go-runit v0.0.0-20150630195641-06ad41a06c4a 21 github.com/soundcloud/go-runit v0.0.0-20150630195641-06ad41a06c4a
diff --git a/go.sum b/go.sum
index d7b9a33..c528f35 100644
--- a/go.sum
+++ b/go.sum
@@ -68,6 +68,8 @@ github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y8
68github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= 68github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
69github.com/prometheus/procfs v0.0.2 h1:6LJUbpNm42llc4HRCuvApCSWB/WfhuNo9K98Q9sNGfs= 69github.com/prometheus/procfs v0.0.2 h1:6LJUbpNm42llc4HRCuvApCSWB/WfhuNo9K98Q9sNGfs=
70github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= 70github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
71github.com/prometheus/procfs v0.0.3 h1:CTwfnzjQ+8dS6MhHHu4YswVAD99sL2wjPqP+VkURmKE=
72github.com/prometheus/procfs v0.0.3/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ=
71github.com/siebenmann/go-kstat v0.0.0-20160321171754-d34789b79745 h1:IuH7WumZNax0D+rEqmy2TyhKCzrtMGqbZO0b8rO00JA= 73github.com/siebenmann/go-kstat v0.0.0-20160321171754-d34789b79745 h1:IuH7WumZNax0D+rEqmy2TyhKCzrtMGqbZO0b8rO00JA=
72github.com/siebenmann/go-kstat v0.0.0-20160321171754-d34789b79745/go.mod h1:G81aIFAMS9ECrwBYR9YxhlPjWgrItd+Kje78O6+uqm8= 74github.com/siebenmann/go-kstat v0.0.0-20160321171754-d34789b79745/go.mod h1:G81aIFAMS9ECrwBYR9YxhlPjWgrItd+Kje78O6+uqm8=
73github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= 75github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
diff --git a/vendor/github.com/prometheus/procfs/Makefile.common b/vendor/github.com/prometheus/procfs/Makefile.common
index c7f9ea6..d7aea1b 100644
--- a/vendor/github.com/prometheus/procfs/Makefile.common
+++ b/vendor/github.com/prometheus/procfs/Makefile.common
@@ -86,6 +86,7 @@ endif
86PREFIX ?= $(shell pwd) 86PREFIX ?= $(shell pwd)
87BIN_DIR ?= $(shell pwd) 87BIN_DIR ?= $(shell pwd)
88DOCKER_IMAGE_TAG ?= $(subst /,-,$(shell git rev-parse --abbrev-ref HEAD)) 88DOCKER_IMAGE_TAG ?= $(subst /,-,$(shell git rev-parse --abbrev-ref HEAD))
89DOCKERFILE_PATH ?= ./
89DOCKER_REPO ?= prom 90DOCKER_REPO ?= prom
90 91
91DOCKER_ARCHS ?= amd64 92DOCKER_ARCHS ?= amd64
@@ -212,7 +213,7 @@ $(BUILD_DOCKER_ARCHS): common-docker-%:
212 docker build -t "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(DOCKER_IMAGE_TAG)" \ 213 docker build -t "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(DOCKER_IMAGE_TAG)" \
213 --build-arg ARCH="$*" \ 214 --build-arg ARCH="$*" \
214 --build-arg OS="linux" \ 215 --build-arg OS="linux" \
215 . 216 $(DOCKERFILE_PATH)
216 217
217.PHONY: common-docker-publish $(PUBLISH_DOCKER_ARCHS) 218.PHONY: common-docker-publish $(PUBLISH_DOCKER_ARCHS)
218common-docker-publish: $(PUBLISH_DOCKER_ARCHS) 219common-docker-publish: $(PUBLISH_DOCKER_ARCHS)
@@ -247,7 +248,9 @@ proto:
247ifdef GOLANGCI_LINT 248ifdef GOLANGCI_LINT
248$(GOLANGCI_LINT): 249$(GOLANGCI_LINT):
249 mkdir -p $(FIRST_GOPATH)/bin 250 mkdir -p $(FIRST_GOPATH)/bin
250 curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(FIRST_GOPATH)/bin $(GOLANGCI_LINT_VERSION) 251 curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/$(GOLANGCI_LINT_VERSION)/install.sh \
252 | sed -e '/install -d/d' \
253 | sh -s -- -b $(FIRST_GOPATH)/bin $(GOLANGCI_LINT_VERSION)
251endif 254endif
252 255
253ifdef GOVENDOR 256ifdef GOVENDOR
diff --git a/vendor/github.com/prometheus/procfs/fixtures.ttar b/vendor/github.com/prometheus/procfs/fixtures.ttar
index 951d909..6b42e7b 100644
--- a/vendor/github.com/prometheus/procfs/fixtures.ttar
+++ b/vendor/github.com/prometheus/procfs/fixtures.ttar
@@ -3,7 +3,7 @@ Directory: fixtures
3Mode: 775 3Mode: 775
4# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 4# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5Directory: fixtures/proc 5Directory: fixtures/proc
6Mode: 755 6Mode: 775
7# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 7# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
8Directory: fixtures/proc/26231 8Directory: fixtures/proc/26231
9Mode: 755 9Mode: 755
@@ -21,6 +21,11 @@ Mode: 644
21Path: fixtures/proc/26231/cwd 21Path: fixtures/proc/26231/cwd
22SymlinkTo: /usr/bin 22SymlinkTo: /usr/bin
23# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 23# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
24Path: fixtures/proc/26231/environ
25Lines: 1
26PATH=/go/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/binNULLBYTEHOSTNAME=cd24e11f73a5NULLBYTETERM=xtermNULLBYTEGOLANG_VERSION=1.12.5NULLBYTEGOPATH=/goNULLBYTEHOME=/rootNULLBYTEEOF
27Mode: 644
28# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
24Path: fixtures/proc/26231/exe 29Path: fixtures/proc/26231/exe
25SymlinkTo: /usr/bin/vim 30SymlinkTo: /usr/bin/vim
26# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 31# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -356,32 +361,62 @@ debug 0
356Mode: 644 361Mode: 644
357# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 362# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
358Path: fixtures/proc/mdstat 363Path: fixtures/proc/mdstat
359Lines: 26 364Lines: 56
360Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10] 365Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
361md3 : active raid6 sda1[8] sdh1[7] sdg1[6] sdf1[5] sde1[11] sdd1[3] sdc1[10] sdb1[9] 366
367md3 : active raid6 sda1[8] sdh1[7] sdg1[6] sdf1[5] sde1[11] sdd1[3] sdc1[10] sdb1[9] sdd1[10](S) sdd2[11](S)
362 5853468288 blocks super 1.2 level 6, 64k chunk, algorithm 2 [8/8] [UUUUUUUU] 368 5853468288 blocks super 1.2 level 6, 64k chunk, algorithm 2 [8/8] [UUUUUUUU]
363 369
364md127 : active raid1 sdi2[0] sdj2[1] 370md127 : active raid1 sdi2[0] sdj2[1]
365 312319552 blocks [2/2] [UU] 371 312319552 blocks [2/2] [UU]
366 372
367md0 : active raid1 sdk[2](S) sdi1[0] sdj1[1] 373md0 : active raid1 sdi1[0] sdj1[1]
368 248896 blocks [2/2] [UU] 374 248896 blocks [2/2] [UU]
369 375
370md4 : inactive raid1 sda3[0] sdb3[1] 376md4 : inactive raid1 sda3[0](F) sdb3[1](S)
371 4883648 blocks [2/2] [UU] 377 4883648 blocks [2/2] [UU]
372 378
373md6 : active raid1 sdb2[2] sda2[0] 379md6 : active raid1 sdb2[2](F) sdc[1](S) sda2[0]
374 195310144 blocks [2/1] [U_] 380 195310144 blocks [2/1] [U_]
375 [=>...................] recovery = 8.5% (16775552/195310144) finish=17.0min speed=259783K/sec 381 [=>...................] recovery = 8.5% (16775552/195310144) finish=17.0min speed=259783K/sec
376 382
377md8 : active raid1 sdb1[1] sda1[0] 383md8 : active raid1 sdb1[1] sda1[0] sdc[2](S) sde[3](S)
378 195310144 blocks [2/2] [UU] 384 195310144 blocks [2/2] [UU]
379 [=>...................] resync = 8.5% (16775552/195310144) finish=17.0min speed=259783K/sec 385 [=>...................] resync = 8.5% (16775552/195310144) finish=17.0min speed=259783K/sec
380 386
381md7 : active raid6 sdb1[0] sde1[3] sdd1[2] sdc1[1] 387md7 : active raid6 sdb1[0] sde1[3] sdd1[2] sdc1[1](F)
382 7813735424 blocks super 1.2 level 6, 512k chunk, algorithm 2 [4/3] [U_UU] 388 7813735424 blocks super 1.2 level 6, 512k chunk, algorithm 2 [4/3] [U_UU]
383 bitmap: 0/30 pages [0KB], 65536KB chunk 389 bitmap: 0/30 pages [0KB], 65536KB chunk
384 390
391md9 : active raid1 sdc2[2] sdd2[3] sdb2[1] sda2[0] sde[4](F) sdf[5](F) sdg[6](S)
392 523968 blocks super 1.2 [4/4] [UUUU]
393 resync=DELAYED
394
395md10 : active raid0 sda1[0] sdb1[1]
396 314159265 blocks 64k chunks
397
398md11 : active (auto-read-only) raid1 sdb2[0] sdc2[1] sdc3[2](F) hda[4](S) ssdc2[3](S)
399 4190208 blocks super 1.2 [2/2] [UU]
400 resync=PENDING
401
402md12 : active raid0 sdc2[0] sdd2[1]
403 3886394368 blocks super 1.2 512k chunks
404
405md126 : active raid0 sdb[1] sdc[0]
406 1855870976 blocks super external:/md127/0 128k chunks
407
408md219 : inactive sdb[2](S) sdc[1](S) sda[0](S)
409 7932 blocks super external:imsm
410
411md00 : active raid0 xvdb[0]
412 4186624 blocks super 1.2 256k chunks
413
414md120 : active linear sda1[1] sdb1[0]
415 2095104 blocks super 1.2 0k rounding
416
417md101 : active (read-only) raid0 sdb[2] sdd[1] sdc[0]
418 322560 blocks super 1.2 512k chunks
419
385unused devices: <none> 420unused devices: <none>
386Mode: 644 421Mode: 644
387# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 422# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -609,6 +644,232 @@ Mode: 664
609Directory: fixtures/sys/class 644Directory: fixtures/sys/class
610Mode: 775 645Mode: 775
611# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 646# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
647Directory: fixtures/sys/class/infiniband
648Mode: 755
649# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
650Directory: fixtures/sys/class/infiniband/mlx4_0
651Mode: 755
652# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
653Path: fixtures/sys/class/infiniband/mlx4_0/board_id
654Lines: 1
655SM_1141000001000
656Mode: 644
657# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
658Path: fixtures/sys/class/infiniband/mlx4_0/fw_ver
659Lines: 1
6602.31.5050
661Mode: 644
662# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
663Path: fixtures/sys/class/infiniband/mlx4_0/hca_type
664Lines: 1
665MT4099
666Mode: 644
667# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
668Directory: fixtures/sys/class/infiniband/mlx4_0/ports
669Mode: 755
670# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
671Directory: fixtures/sys/class/infiniband/mlx4_0/ports/1
672Mode: 755
673# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
674Directory: fixtures/sys/class/infiniband/mlx4_0/ports/1/counters
675Mode: 755
676# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
677Path: fixtures/sys/class/infiniband/mlx4_0/ports/1/counters/excessive_buffer_overrun_errors
678Lines: 1
6790
680Mode: 644
681# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
682Path: fixtures/sys/class/infiniband/mlx4_0/ports/1/counters/link_downed
683Lines: 1
6840
685Mode: 644
686# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
687Path: fixtures/sys/class/infiniband/mlx4_0/ports/1/counters/link_error_recovery
688Lines: 1
6890
690Mode: 644
691# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
692Path: fixtures/sys/class/infiniband/mlx4_0/ports/1/counters/local_link_integrity_errors
693Lines: 1
6940
695Mode: 644
696# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
697Path: fixtures/sys/class/infiniband/mlx4_0/ports/1/counters/port_rcv_constraint_errors
698Lines: 1
6990
700Mode: 644
701# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
702Path: fixtures/sys/class/infiniband/mlx4_0/ports/1/counters/port_rcv_data
703Lines: 1
7042221223609
705Mode: 644
706# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
707Path: fixtures/sys/class/infiniband/mlx4_0/ports/1/counters/port_rcv_errors
708Lines: 1
7090
710Mode: 644
711# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
712Path: fixtures/sys/class/infiniband/mlx4_0/ports/1/counters/port_rcv_packets
713Lines: 1
71487169372
715Mode: 644
716# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
717Path: fixtures/sys/class/infiniband/mlx4_0/ports/1/counters/port_rcv_remote_physical_errors
718Lines: 1
7190
720Mode: 644
721# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
722Path: fixtures/sys/class/infiniband/mlx4_0/ports/1/counters/port_rcv_switch_relay_errors
723Lines: 1
7240
725Mode: 644
726# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
727Path: fixtures/sys/class/infiniband/mlx4_0/ports/1/counters/port_xmit_constraint_errors
728Lines: 1
7290
730Mode: 644
731# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
732Path: fixtures/sys/class/infiniband/mlx4_0/ports/1/counters/port_xmit_data
733Lines: 1
73426509113295
735Mode: 644
736# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
737Path: fixtures/sys/class/infiniband/mlx4_0/ports/1/counters/port_xmit_discards
738Lines: 1
7390
740Mode: 644
741# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
742Path: fixtures/sys/class/infiniband/mlx4_0/ports/1/counters/port_xmit_packets
743Lines: 1
74485734114
745Mode: 644
746# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
747Path: fixtures/sys/class/infiniband/mlx4_0/ports/1/counters/port_xmit_wait
748Lines: 1
7493599
750Mode: 644
751# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
752Path: fixtures/sys/class/infiniband/mlx4_0/ports/1/counters/symbol_error
753Lines: 1
7540
755Mode: 644
756# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
757Path: fixtures/sys/class/infiniband/mlx4_0/ports/1/phys_state
758Lines: 1
7595: LinkUp
760Mode: 644
761# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
762Path: fixtures/sys/class/infiniband/mlx4_0/ports/1/rate
763Lines: 1
76440 Gb/sec (4X QDR)
765Mode: 644
766# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
767Path: fixtures/sys/class/infiniband/mlx4_0/ports/1/state
768Lines: 1
7694: ACTIVE
770Mode: 644
771# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
772Directory: fixtures/sys/class/infiniband/mlx4_0/ports/2
773Mode: 755
774# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
775Directory: fixtures/sys/class/infiniband/mlx4_0/ports/2/counters
776Mode: 755
777# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
778Path: fixtures/sys/class/infiniband/mlx4_0/ports/2/counters/excessive_buffer_overrun_errors
779Lines: 1
7800
781Mode: 644
782# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
783Path: fixtures/sys/class/infiniband/mlx4_0/ports/2/counters/link_downed
784Lines: 1
7850
786Mode: 644
787# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
788Path: fixtures/sys/class/infiniband/mlx4_0/ports/2/counters/link_error_recovery
789Lines: 1
7900
791Mode: 644
792# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
793Path: fixtures/sys/class/infiniband/mlx4_0/ports/2/counters/local_link_integrity_errors
794Lines: 1
7950
796Mode: 644
797# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
798Path: fixtures/sys/class/infiniband/mlx4_0/ports/2/counters/port_rcv_constraint_errors
799Lines: 1
8000
801Mode: 644
802# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
803Path: fixtures/sys/class/infiniband/mlx4_0/ports/2/counters/port_rcv_data
804Lines: 1
8052460436784
806Mode: 644
807# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
808Path: fixtures/sys/class/infiniband/mlx4_0/ports/2/counters/port_rcv_errors
809Lines: 1
8100
811Mode: 644
812# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
813Path: fixtures/sys/class/infiniband/mlx4_0/ports/2/counters/port_rcv_packets
814Lines: 1
81589332064
816Mode: 644
817# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
818Path: fixtures/sys/class/infiniband/mlx4_0/ports/2/counters/port_rcv_remote_physical_errors
819Lines: 1
8200
821Mode: 644
822# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
823Path: fixtures/sys/class/infiniband/mlx4_0/ports/2/counters/port_rcv_switch_relay_errors
824Lines: 1
8250
826Mode: 644
827# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
828Path: fixtures/sys/class/infiniband/mlx4_0/ports/2/counters/port_xmit_constraint_errors
829Lines: 1
8300
831Mode: 644
832# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
833Path: fixtures/sys/class/infiniband/mlx4_0/ports/2/counters/port_xmit_data
834Lines: 1
83526540356890
836Mode: 644
837# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
838Path: fixtures/sys/class/infiniband/mlx4_0/ports/2/counters/port_xmit_discards
839Lines: 1
8400
841Mode: 644
842# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
843Path: fixtures/sys/class/infiniband/mlx4_0/ports/2/counters/port_xmit_packets
844Lines: 1
84588622850
846Mode: 644
847# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
848Path: fixtures/sys/class/infiniband/mlx4_0/ports/2/counters/port_xmit_wait
849Lines: 1
8503846
851Mode: 644
852# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
853Path: fixtures/sys/class/infiniband/mlx4_0/ports/2/counters/symbol_error
854Lines: 1
8550
856Mode: 644
857# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
858Path: fixtures/sys/class/infiniband/mlx4_0/ports/2/phys_state
859Lines: 1
8605: LinkUp
861Mode: 644
862# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
863Path: fixtures/sys/class/infiniband/mlx4_0/ports/2/rate
864Lines: 1
86540 Gb/sec (4X QDR)
866Mode: 644
867# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
868Path: fixtures/sys/class/infiniband/mlx4_0/ports/2/state
869Lines: 1
8704: ACTIVE
871Mode: 644
872# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
612Directory: fixtures/sys/class/net 873Directory: fixtures/sys/class/net
613Mode: 775 874Mode: 775
614# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 875# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -1182,6 +1443,35 @@ Lines: 1
11820 14430
1183Mode: 644 1444Mode: 644
1184# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1445# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1446Directory: fixtures/sys/devices/rbd
1447Mode: 755
1448# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1449Directory: fixtures/sys/devices/rbd/0
1450Mode: 755
1451# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1452Path: fixtures/sys/devices/rbd/0/name
1453Lines: 1
1454demo
1455Mode: 644
1456# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1457Path: fixtures/sys/devices/rbd/0/pool
1458Lines: 1
1459iscsi-images
1460Mode: 644
1461# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1462Directory: fixtures/sys/devices/rbd/1
1463Mode: 755
1464# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1465Path: fixtures/sys/devices/rbd/1/name
1466Lines: 1
1467wrong
1468Mode: 644
1469# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1470Path: fixtures/sys/devices/rbd/1/pool
1471Lines: 1
1472wrong-images
1473Mode: 644
1474# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1185Directory: fixtures/sys/devices/system 1475Directory: fixtures/sys/devices/system
1186Mode: 775 1476Mode: 775
1187# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1477# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -1806,3 +2096,248 @@ Lines: 1
1806extent_alloc 2 0 0 0 2096extent_alloc 2 0 0 0
1807Mode: 644 2097Mode: 644
1808# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 2098# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2099Directory: fixtures/sys/kernel
2100Mode: 755
2101# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2102Directory: fixtures/sys/kernel/config
2103Mode: 755
2104# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2105Directory: fixtures/sys/kernel/config/target
2106Mode: 755
2107# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2108Directory: fixtures/sys/kernel/config/target/core
2109Mode: 755
2110# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2111Directory: fixtures/sys/kernel/config/target/core/fileio_0
2112Mode: 755
2113# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2114Directory: fixtures/sys/kernel/config/target/core/fileio_1
2115Mode: 755
2116# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2117Directory: fixtures/sys/kernel/config/target/core/fileio_1/file_lio_1G
2118Mode: 755
2119# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2120Path: fixtures/sys/kernel/config/target/core/fileio_1/file_lio_1G/enable
2121Lines: 1
21221
2123Mode: 644
2124# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2125Path: fixtures/sys/kernel/config/target/core/fileio_1/file_lio_1G/udev_path
2126Lines: 1
2127/home/iscsi/file_back_1G
2128Mode: 644
2129# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2130Directory: fixtures/sys/kernel/config/target/core/iblock_0
2131Mode: 755
2132# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2133Directory: fixtures/sys/kernel/config/target/core/iblock_0/block_lio_rbd1
2134Mode: 755
2135# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2136Path: fixtures/sys/kernel/config/target/core/iblock_0/block_lio_rbd1/enable
2137Lines: 1
21381
2139Mode: 644
2140# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2141Path: fixtures/sys/kernel/config/target/core/iblock_0/block_lio_rbd1/udev_path
2142Lines: 1
2143/dev/rbd1
2144Mode: 644
2145# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2146Directory: fixtures/sys/kernel/config/target/core/rbd_0
2147Mode: 755
2148# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2149Directory: fixtures/sys/kernel/config/target/core/rbd_0/iscsi-images-demo
2150Mode: 755
2151# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2152Path: fixtures/sys/kernel/config/target/core/rbd_0/iscsi-images-demo/enable
2153Lines: 1
21541
2155Mode: 644
2156# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2157Path: fixtures/sys/kernel/config/target/core/rbd_0/iscsi-images-demo/udev_path
2158Lines: 1
2159/dev/rbd/iscsi-images/demo
2160Mode: 644
2161# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2162Directory: fixtures/sys/kernel/config/target/core/rd_mcp_119
2163Mode: 755
2164# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2165Directory: fixtures/sys/kernel/config/target/core/rd_mcp_119/ramdisk_lio_1G
2166Mode: 755
2167# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2168Path: fixtures/sys/kernel/config/target/core/rd_mcp_119/ramdisk_lio_1G/enable
2169Lines: 1
21701
2171Mode: 644
2172# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2173Path: fixtures/sys/kernel/config/target/core/rd_mcp_119/ramdisk_lio_1G/udev_path
2174Lines: 0
2175Mode: 644
2176# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2177Directory: fixtures/sys/kernel/config/target/iscsi
2178Mode: 755
2179# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2180Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.osd1.x8664:sn.8888bbbbddd0
2181Mode: 755
2182# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2183Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.osd1.x8664:sn.8888bbbbddd0/tpgt_1
2184Mode: 755
2185# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2186Path: fixtures/sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.osd1.x8664:sn.8888bbbbddd0/tpgt_1/enable
2187Lines: 1
21881
2189Mode: 644
2190# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2191Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.osd1.x8664:sn.8888bbbbddd0/tpgt_1/lun
2192Mode: 755
2193# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2194Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.osd1.x8664:sn.8888bbbbddd0/tpgt_1/lun/lun_0
2195Mode: 755
2196# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2197Path: fixtures/sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.osd1.x8664:sn.8888bbbbddd0/tpgt_1/lun/lun_0/7f4a4eb56d
2198SymlinkTo: ../../../../../../target/core/rd_mcp_119/ramdisk_lio_1G
2199# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2200Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.osd1.x8664:sn.8888bbbbddd0/tpgt_1/lun/lun_0/statistics
2201Mode: 755
2202# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2203Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.osd1.x8664:sn.8888bbbbddd0/tpgt_1/lun/lun_0/statistics/scsi_tgt_port
2204Mode: 755
2205# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2206Path: fixtures/sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.osd1.x8664:sn.8888bbbbddd0/tpgt_1/lun/lun_0/statistics/scsi_tgt_port/in_cmds
2207Lines: 1
2208204950
2209Mode: 644
2210# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2211Path: fixtures/sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.osd1.x8664:sn.8888bbbbddd0/tpgt_1/lun/lun_0/statistics/scsi_tgt_port/read_mbytes
2212Lines: 1
221310325
2214Mode: 644
2215# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2216Path: fixtures/sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.osd1.x8664:sn.8888bbbbddd0/tpgt_1/lun/lun_0/statistics/scsi_tgt_port/write_mbytes
2217Lines: 1
221840325
2219Mode: 644
2220# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2221Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.osd1.x8664:sn.abcd1abcd2ab
2222Mode: 755
2223# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2224Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.osd1.x8664:sn.abcd1abcd2ab/tpgt_1
2225Mode: 755
2226# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2227Path: fixtures/sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.osd1.x8664:sn.abcd1abcd2ab/tpgt_1/enable
2228Lines: 1
22291
2230Mode: 644
2231# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2232Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.osd1.x8664:sn.abcd1abcd2ab/tpgt_1/lun
2233Mode: 755
2234# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2235Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.osd1.x8664:sn.abcd1abcd2ab/tpgt_1/lun/lun_0
2236Mode: 755
2237# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2238Path: fixtures/sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.osd1.x8664:sn.abcd1abcd2ab/tpgt_1/lun/lun_0/795b7c7026
2239SymlinkTo: ../../../../../../target/core/iblock_0/block_lio_rbd1
2240# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2241Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.osd1.x8664:sn.abcd1abcd2ab/tpgt_1/lun/lun_0/statistics
2242Mode: 755
2243# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2244Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.osd1.x8664:sn.abcd1abcd2ab/tpgt_1/lun/lun_0/statistics/scsi_tgt_port
2245Mode: 755
2246# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2247Path: fixtures/sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.osd1.x8664:sn.abcd1abcd2ab/tpgt_1/lun/lun_0/statistics/scsi_tgt_port/in_cmds
2248Lines: 1
2249104950
2250Mode: 644
2251# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2252Path: fixtures/sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.osd1.x8664:sn.abcd1abcd2ab/tpgt_1/lun/lun_0/statistics/scsi_tgt_port/read_mbytes
2253Lines: 1
225420095
2255Mode: 644
2256# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2257Path: fixtures/sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.osd1.x8664:sn.abcd1abcd2ab/tpgt_1/lun/lun_0/statistics/scsi_tgt_port/write_mbytes
2258Lines: 1
225971235
2260Mode: 644
2261# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2262Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2016-11.org.linux-iscsi.igw.x86:dev.rbd0
2263Mode: 755
2264# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2265Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2016-11.org.linux-iscsi.igw.x86:dev.rbd0/tpgt_1
2266Mode: 755
2267# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2268Path: fixtures/sys/kernel/config/target/iscsi/iqn.2016-11.org.linux-iscsi.igw.x86:dev.rbd0/tpgt_1/enable
2269Lines: 1
22701
2271Mode: 644
2272# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2273Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2016-11.org.linux-iscsi.igw.x86:dev.rbd0/tpgt_1/lun
2274Mode: 755
2275# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2276Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2016-11.org.linux-iscsi.igw.x86:dev.rbd0/tpgt_1/lun/lun_0
2277Mode: 755
2278# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2279Path: fixtures/sys/kernel/config/target/iscsi/iqn.2016-11.org.linux-iscsi.igw.x86:dev.rbd0/tpgt_1/lun/lun_0/fff5e16686
2280SymlinkTo: ../../../../../../target/core/fileio_1/file_lio_1G
2281# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2282Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2016-11.org.linux-iscsi.igw.x86:dev.rbd0/tpgt_1/lun/lun_0/statistics
2283Mode: 755
2284# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2285Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2016-11.org.linux-iscsi.igw.x86:dev.rbd0/tpgt_1/lun/lun_0/statistics/scsi_tgt_port
2286Mode: 755
2287# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2288Path: fixtures/sys/kernel/config/target/iscsi/iqn.2016-11.org.linux-iscsi.igw.x86:dev.rbd0/tpgt_1/lun/lun_0/statistics/scsi_tgt_port/in_cmds
2289Lines: 1
2290301950
2291Mode: 644
2292# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2293Path: fixtures/sys/kernel/config/target/iscsi/iqn.2016-11.org.linux-iscsi.igw.x86:dev.rbd0/tpgt_1/lun/lun_0/statistics/scsi_tgt_port/read_mbytes
2294Lines: 1
229510195
2296Mode: 644
2297# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2298Path: fixtures/sys/kernel/config/target/iscsi/iqn.2016-11.org.linux-iscsi.igw.x86:dev.rbd0/tpgt_1/lun/lun_0/statistics/scsi_tgt_port/write_mbytes
2299Lines: 1
230030195
2301Mode: 644
2302# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2303Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2016-11.org.linux-iscsi.igw.x86:sn.ramdemo
2304Mode: 755
2305# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2306Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2016-11.org.linux-iscsi.igw.x86:sn.ramdemo/tpgt_1
2307Mode: 755
2308# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2309Path: fixtures/sys/kernel/config/target/iscsi/iqn.2016-11.org.linux-iscsi.igw.x86:sn.ramdemo/tpgt_1/enable
2310Lines: 1
23111
2312Mode: 644
2313# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2314Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2016-11.org.linux-iscsi.igw.x86:sn.ramdemo/tpgt_1/lun
2315Mode: 755
2316# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2317Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2016-11.org.linux-iscsi.igw.x86:sn.ramdemo/tpgt_1/lun/lun_0
2318Mode: 755
2319# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2320Path: fixtures/sys/kernel/config/target/iscsi/iqn.2016-11.org.linux-iscsi.igw.x86:sn.ramdemo/tpgt_1/lun/lun_0/eba1edf893
2321SymlinkTo: ../../../../../../target/core/rbd_0/iscsi-images-demo
2322# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2323Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2016-11.org.linux-iscsi.igw.x86:sn.ramdemo/tpgt_1/lun/lun_0/statistics
2324Mode: 755
2325# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2326Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2016-11.org.linux-iscsi.igw.x86:sn.ramdemo/tpgt_1/lun/lun_0/statistics/scsi_tgt_port
2327Mode: 755
2328# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2329Path: fixtures/sys/kernel/config/target/iscsi/iqn.2016-11.org.linux-iscsi.igw.x86:sn.ramdemo/tpgt_1/lun/lun_0/statistics/scsi_tgt_port/in_cmds
2330Lines: 1
23311234
2332Mode: 644
2333# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2334Path: fixtures/sys/kernel/config/target/iscsi/iqn.2016-11.org.linux-iscsi.igw.x86:sn.ramdemo/tpgt_1/lun/lun_0/statistics/scsi_tgt_port/read_mbytes
2335Lines: 1
23361504
2337Mode: 644
2338# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2339Path: fixtures/sys/kernel/config/target/iscsi/iqn.2016-11.org.linux-iscsi.igw.x86:sn.ramdemo/tpgt_1/lun/lun_0/statistics/scsi_tgt_port/write_mbytes
2340Lines: 1
23414733
2342Mode: 644
2343# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/vendor/github.com/prometheus/procfs/go.mod b/vendor/github.com/prometheus/procfs/go.mod
index 8a1b839..b2f8cca 100644
--- a/vendor/github.com/prometheus/procfs/go.mod
+++ b/vendor/github.com/prometheus/procfs/go.mod
@@ -1,3 +1,6 @@
1module github.com/prometheus/procfs 1module github.com/prometheus/procfs
2 2
3require golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 3require (
4 github.com/google/go-cmp v0.3.0
5 golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4
6)
diff --git a/vendor/github.com/prometheus/procfs/go.sum b/vendor/github.com/prometheus/procfs/go.sum
index 7827dd3..db54133 100644
--- a/vendor/github.com/prometheus/procfs/go.sum
+++ b/vendor/github.com/prometheus/procfs/go.sum
@@ -1,2 +1,4 @@
1github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY=
2github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
1golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 h1:YUO/7uOKsKeq9UokNS62b8FYywz3ker1l1vDZRCRefw= 3golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 h1:YUO/7uOKsKeq9UokNS62b8FYywz3ker1l1vDZRCRefw=
2golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 4golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
diff --git a/vendor/github.com/prometheus/procfs/internal/fs/fs.go b/vendor/github.com/prometheus/procfs/internal/fs/fs.go
index c66a1cf..7ddfd6b 100644
--- a/vendor/github.com/prometheus/procfs/internal/fs/fs.go
+++ b/vendor/github.com/prometheus/procfs/internal/fs/fs.go
@@ -25,6 +25,9 @@ const (
25 25
26 // DefaultSysMountPoint is the common mount point of the sys filesystem. 26 // DefaultSysMountPoint is the common mount point of the sys filesystem.
27 DefaultSysMountPoint = "/sys" 27 DefaultSysMountPoint = "/sys"
28
29 // DefaultConfigfsMountPoint is the commont mount point of the configfs
30 DefaultConfigfsMountPoint = "/sys/kernel/config"
28) 31)
29 32
30// FS represents a pseudo-filesystem, normally /proc or /sys, which provides an 33// FS represents a pseudo-filesystem, normally /proc or /sys, which provides an
diff --git a/vendor/github.com/prometheus/procfs/internal/util/valueparser.go b/vendor/github.com/prometheus/procfs/internal/util/valueparser.go
new file mode 100644
index 0000000..ac93cb4
--- /dev/null
+++ b/vendor/github.com/prometheus/procfs/internal/util/valueparser.go
@@ -0,0 +1,77 @@
1// Copyright 2019 The Prometheus Authors
2// Licensed under the Apache License, Version 2.0 (the "License");
3// you may not use this file except in compliance with the License.
4// You may obtain a copy of the License at
5//
6// http://www.apache.org/licenses/LICENSE-2.0
7//
8// Unless required by applicable law or agreed to in writing, software
9// distributed under the License is distributed on an "AS IS" BASIS,
10// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11// See the License for the specific language governing permissions and
12// limitations under the License.
13
14package util
15
16import (
17 "strconv"
18)
19
20// TODO(mdlayher): util packages are an anti-pattern and this should be moved
21// somewhere else that is more focused in the future.
22
23// A ValueParser enables parsing a single string into a variety of data types
24// in a concise and safe way. The Err method must be invoked after invoking
25// any other methods to ensure a value was successfully parsed.
26type ValueParser struct {
27 v string
28 err error
29}
30
31// NewValueParser creates a ValueParser using the input string.
32func NewValueParser(v string) *ValueParser {
33 return &ValueParser{v: v}
34}
35
36// PInt64 interprets the underlying value as an int64 and returns a pointer to
37// that value.
38func (vp *ValueParser) PInt64() *int64 {
39 if vp.err != nil {
40 return nil
41 }
42
43 // A base value of zero makes ParseInt infer the correct base using the
44 // string's prefix, if any.
45 const base = 0
46 v, err := strconv.ParseInt(vp.v, base, 64)
47 if err != nil {
48 vp.err = err
49 return nil
50 }
51
52 return &v
53}
54
55// PUInt64 interprets the underlying value as an uint64 and returns a pointer to
56// that value.
57func (vp *ValueParser) PUInt64() *uint64 {
58 if vp.err != nil {
59 return nil
60 }
61
62 // A base value of zero makes ParseInt infer the correct base using the
63 // string's prefix, if any.
64 const base = 0
65 v, err := strconv.ParseUint(vp.v, base, 64)
66 if err != nil {
67 vp.err = err
68 return nil
69 }
70
71 return &v
72}
73
74// Err returns the last error, if any, encountered by the ValueParser.
75func (vp *ValueParser) Err() error {
76 return vp.err
77}
diff --git a/vendor/github.com/prometheus/procfs/mdstat.go b/vendor/github.com/prometheus/procfs/mdstat.go
index 71c1067..2af3ada 100644
--- a/vendor/github.com/prometheus/procfs/mdstat.go
+++ b/vendor/github.com/prometheus/procfs/mdstat.go
@@ -22,8 +22,8 @@ import (
22) 22)
23 23
24var ( 24var (
25 statuslineRE = regexp.MustCompile(`(\d+) blocks .*\[(\d+)/(\d+)\] \[[U_]+\]`) 25 statusLineRE = regexp.MustCompile(`(\d+) blocks .*\[(\d+)/(\d+)\] \[[U_]+\]`)
26 buildlineRE = regexp.MustCompile(`\((\d+)/\d+\)`) 26 recoveryLineRE = regexp.MustCompile(`\((\d+)/\d+\)`)
27) 27)
28 28
29// MDStat holds info parsed from /proc/mdstat. 29// MDStat holds info parsed from /proc/mdstat.
@@ -34,8 +34,12 @@ type MDStat struct {
34 ActivityState string 34 ActivityState string
35 // Number of active disks. 35 // Number of active disks.
36 DisksActive int64 36 DisksActive int64
37 // Total number of disks the device consists of. 37 // Total number of disks the device requires.
38 DisksTotal int64 38 DisksTotal int64
39 // Number of failed disks.
40 DisksFailed int64
41 // Spare disks in the device.
42 DisksSpare int64
39 // Number of blocks the device holds. 43 // Number of blocks the device holds.
40 BlocksTotal int64 44 BlocksTotal int64
41 // Number of blocks on the device that are in sync. 45 // Number of blocks on the device that are in sync.
@@ -59,29 +63,38 @@ func (fs FS) MDStat() ([]MDStat, error) {
59 63
60// parseMDStat parses data from mdstat file (/proc/mdstat) and returns a slice of 64// parseMDStat parses data from mdstat file (/proc/mdstat) and returns a slice of
61// structs containing the relevant info. 65// structs containing the relevant info.
62func parseMDStat(mdstatData []byte) ([]MDStat, error) { 66func parseMDStat(mdStatData []byte) ([]MDStat, error) {
63 mdStats := []MDStat{} 67 mdStats := []MDStat{}
64 lines := strings.Split(string(mdstatData), "\n") 68 lines := strings.Split(string(mdStatData), "\n")
65 for i, l := range lines { 69
66 if strings.TrimSpace(l) == "" || l[0] == ' ' || 70 for i, line := range lines {
67 strings.HasPrefix(l, "Personalities") || strings.HasPrefix(l, "unused") { 71 if strings.TrimSpace(line) == "" || line[0] == ' ' ||
72 strings.HasPrefix(line, "Personalities") ||
73 strings.HasPrefix(line, "unused") {
68 continue 74 continue
69 } 75 }
70 76
71 deviceFields := strings.Fields(l) 77 deviceFields := strings.Fields(line)
72 if len(deviceFields) < 3 { 78 if len(deviceFields) < 3 {
73 return nil, fmt.Errorf("not enough fields in mdline (expected at least 3): %s", l) 79 return nil, fmt.Errorf("not enough fields in mdline (expected at least 3): %s", line)
74 } 80 }
75 mdName := deviceFields[0] 81 mdName := deviceFields[0] // mdx
76 activityState := deviceFields[2] 82 state := deviceFields[2] // active or inactive
77 83
78 if len(lines) <= i+3 { 84 if len(lines) <= i+3 {
79 return mdStats, fmt.Errorf("missing lines for md device %s", mdName) 85 return nil, fmt.Errorf(
86 "error parsing %s: too few lines for md device",
87 mdName,
88 )
80 } 89 }
81 90
82 active, total, size, err := evalStatusLine(lines[i+1]) 91 // Failed disks have the suffix (F) & Spare disks have the suffix (S).
92 fail := int64(strings.Count(line, "(F)"))
93 spare := int64(strings.Count(line, "(S)"))
94 active, total, size, err := evalStatusLine(lines[i], lines[i+1])
95
83 if err != nil { 96 if err != nil {
84 return nil, err 97 return nil, fmt.Errorf("error parsing md device lines: %s", err)
85 } 98 }
86 99
87 syncLineIdx := i + 2 100 syncLineIdx := i + 2
@@ -89,20 +102,38 @@ func parseMDStat(mdstatData []byte) ([]MDStat, error) {
89 syncLineIdx++ 102 syncLineIdx++
90 } 103 }
91 104
92 // If device is recovering/syncing at the moment, get the number of currently 105 // If device is syncing at the moment, get the number of currently
93 // synced bytes, otherwise that number equals the size of the device. 106 // synced bytes, otherwise that number equals the size of the device.
94 syncedBlocks := size 107 syncedBlocks := size
95 if strings.Contains(lines[syncLineIdx], "recovery") || strings.Contains(lines[syncLineIdx], "resync") { 108 recovering := strings.Contains(lines[syncLineIdx], "recovery")
96 syncedBlocks, err = evalRecoveryLine(lines[syncLineIdx]) 109 resyncing := strings.Contains(lines[syncLineIdx], "resync")
97 if err != nil { 110
98 return nil, err 111 // Append recovery and resyncing state info.
112 if recovering || resyncing {
113 if recovering {
114 state = "recovering"
115 } else {
116 state = "resyncing"
117 }
118
119 // Handle case when resync=PENDING or resync=DELAYED.
120 if strings.Contains(lines[syncLineIdx], "PENDING") ||
121 strings.Contains(lines[syncLineIdx], "DELAYED") {
122 syncedBlocks = 0
123 } else {
124 syncedBlocks, err = evalRecoveryLine(lines[syncLineIdx])
125 if err != nil {
126 return nil, fmt.Errorf("error parsing sync line in md device %s: %s", mdName, err)
127 }
99 } 128 }
100 } 129 }
101 130
102 mdStats = append(mdStats, MDStat{ 131 mdStats = append(mdStats, MDStat{
103 Name: mdName, 132 Name: mdName,
104 ActivityState: activityState, 133 ActivityState: state,
105 DisksActive: active, 134 DisksActive: active,
135 DisksFailed: fail,
136 DisksSpare: spare,
106 DisksTotal: total, 137 DisksTotal: total,
107 BlocksTotal: size, 138 BlocksTotal: size,
108 BlocksSynced: syncedBlocks, 139 BlocksSynced: syncedBlocks,
@@ -112,39 +143,51 @@ func parseMDStat(mdstatData []byte) ([]MDStat, error) {
112 return mdStats, nil 143 return mdStats, nil
113} 144}
114 145
115func evalStatusLine(statusline string) (active, total, size int64, err error) { 146func evalStatusLine(deviceLine, statusLine string) (active, total, size int64, err error) {
116 matches := statuslineRE.FindStringSubmatch(statusline)
117 if len(matches) != 4 {
118 return 0, 0, 0, fmt.Errorf("unexpected statusline: %s", statusline)
119 }
120 147
121 size, err = strconv.ParseInt(matches[1], 10, 64) 148 sizeStr := strings.Fields(statusLine)[0]
149 size, err = strconv.ParseInt(sizeStr, 10, 64)
122 if err != nil { 150 if err != nil {
123 return 0, 0, 0, fmt.Errorf("unexpected statusline %s: %s", statusline, err) 151 return 0, 0, 0, fmt.Errorf("unexpected statusLine %s: %s", statusLine, err)
152 }
153
154 if strings.Contains(deviceLine, "raid0") || strings.Contains(deviceLine, "linear") {
155 // In the device deviceLine, only disks have a number associated with them in [].
156 total = int64(strings.Count(deviceLine, "["))
157 return total, total, size, nil
158 }
159
160 if strings.Contains(deviceLine, "inactive") {
161 return 0, 0, size, nil
162 }
163
164 matches := statusLineRE.FindStringSubmatch(statusLine)
165 if len(matches) != 4 {
166 return 0, 0, 0, fmt.Errorf("couldn't find all the substring matches: %s", statusLine)
124 } 167 }
125 168
126 total, err = strconv.ParseInt(matches[2], 10, 64) 169 total, err = strconv.ParseInt(matches[2], 10, 64)
127 if err != nil { 170 if err != nil {
128 return 0, 0, 0, fmt.Errorf("unexpected statusline %s: %s", statusline, err) 171 return 0, 0, 0, fmt.Errorf("unexpected statusLine %s: %s", statusLine, err)
129 } 172 }
130 173
131 active, err = strconv.ParseInt(matches[3], 10, 64) 174 active, err = strconv.ParseInt(matches[3], 10, 64)
132 if err != nil { 175 if err != nil {
133 return 0, 0, 0, fmt.Errorf("unexpected statusline %s: %s", statusline, err) 176 return 0, 0, 0, fmt.Errorf("unexpected statusLine %s: %s", statusLine, err)
134 } 177 }
135 178
136 return active, total, size, nil 179 return active, total, size, nil
137} 180}
138 181
139func evalRecoveryLine(buildline string) (syncedBlocks int64, err error) { 182func evalRecoveryLine(recoveryLine string) (syncedBlocks int64, err error) {
140 matches := buildlineRE.FindStringSubmatch(buildline) 183 matches := recoveryLineRE.FindStringSubmatch(recoveryLine)
141 if len(matches) != 2 { 184 if len(matches) != 2 {
142 return 0, fmt.Errorf("unexpected buildline: %s", buildline) 185 return 0, fmt.Errorf("unexpected recoveryLine: %s", recoveryLine)
143 } 186 }
144 187
145 syncedBlocks, err = strconv.ParseInt(matches[1], 10, 64) 188 syncedBlocks, err = strconv.ParseInt(matches[1], 10, 64)
146 if err != nil { 189 if err != nil {
147 return 0, fmt.Errorf("%s in buildline: %s", err, buildline) 190 return 0, fmt.Errorf("%s in recoveryLine: %s", err, recoveryLine)
148 } 191 }
149 192
150 return syncedBlocks, nil 193 return syncedBlocks, nil
diff --git a/vendor/github.com/prometheus/procfs/mountinfo.go b/vendor/github.com/prometheus/procfs/mountinfo.go
new file mode 100644
index 0000000..61fa618
--- /dev/null
+++ b/vendor/github.com/prometheus/procfs/mountinfo.go
@@ -0,0 +1,178 @@
1// Copyright 2019 The Prometheus Authors
2// Licensed under the Apache License, Version 2.0 (the "License");
3// you may not use this file except in compliance with the License.
4// You may obtain a copy of the License at
5//
6// http://www.apache.org/licenses/LICENSE-2.0
7//
8// Unless required by applicable law or agreed to in writing, software
9// distributed under the License is distributed on an "AS IS" BASIS,
10// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11// See the License for the specific language governing permissions and
12// limitations under the License.
13
14package procfs
15
16import (
17 "bufio"
18 "fmt"
19 "io"
20 "os"
21 "strconv"
22 "strings"
23)
24
25var validOptionalFields = map[string]bool{
26 "shared": true,
27 "master": true,
28 "propagate_from": true,
29 "unbindable": true,
30}
31
32// A MountInfo is a type that describes the details, options
33// for each mount, parsed from /proc/self/mountinfo.
34// The fields described in each entry of /proc/self/mountinfo
35// is described in the following man page.
36// http://man7.org/linux/man-pages/man5/proc.5.html
37type MountInfo struct {
38 // Unique Id for the mount
39 MountId int
40 // The Id of the parent mount
41 ParentId int
42 // The value of `st_dev` for the files on this FS
43 MajorMinorVer string
44 // The pathname of the directory in the FS that forms
45 // the root for this mount
46 Root string
47 // The pathname of the mount point relative to the root
48 MountPoint string
49 // Mount options
50 Options map[string]string
51 // Zero or more optional fields
52 OptionalFields map[string]string
53 // The Filesystem type
54 FSType string
55 // FS specific information or "none"
56 Source string
57 // Superblock options
58 SuperOptions map[string]string
59}
60
61// Returns part of the mountinfo line, if it exists, else an empty string.
62func getStringSliceElement(parts []string, idx int, defaultValue string) string {
63 if idx >= len(parts) {
64 return defaultValue
65 }
66 return parts[idx]
67}
68
69// Reads each line of the mountinfo file, and returns a list of formatted MountInfo structs.
70func parseMountInfo(r io.Reader) ([]*MountInfo, error) {
71 mounts := []*MountInfo{}
72 scanner := bufio.NewScanner(r)
73 for scanner.Scan() {
74 mountString := scanner.Text()
75 parsedMounts, err := parseMountInfoString(mountString)
76 if err != nil {
77 return nil, err
78 }
79 mounts = append(mounts, parsedMounts)
80 }
81
82 err := scanner.Err()
83 return mounts, err
84}
85
86// Parses a mountinfo file line, and converts it to a MountInfo struct.
87// An important check here is to see if the hyphen separator, as if it does not exist,
88// it means that the line is malformed.
89func parseMountInfoString(mountString string) (*MountInfo, error) {
90 var err error
91
92 // OptionalFields can be zero, hence these checks to ensure we do not populate the wrong values in the wrong spots
93 separatorIndex := strings.Index(mountString, "-")
94 if separatorIndex == -1 {
95 return nil, fmt.Errorf("no separator found in mountinfo string: %s", mountString)
96 }
97 beforeFields := strings.Fields(mountString[:separatorIndex])
98 afterFields := strings.Fields(mountString[separatorIndex+1:])
99 if (len(beforeFields) + len(afterFields)) < 7 {
100 return nil, fmt.Errorf("too few fields")
101 }
102
103 mount := &MountInfo{
104 MajorMinorVer: getStringSliceElement(beforeFields, 2, ""),
105 Root: getStringSliceElement(beforeFields, 3, ""),
106 MountPoint: getStringSliceElement(beforeFields, 4, ""),
107 Options: mountOptionsParser(getStringSliceElement(beforeFields, 5, "")),
108 OptionalFields: nil,
109 FSType: getStringSliceElement(afterFields, 0, ""),
110 Source: getStringSliceElement(afterFields, 1, ""),
111 SuperOptions: mountOptionsParser(getStringSliceElement(afterFields, 2, "")),
112 }
113
114 mount.MountId, err = strconv.Atoi(getStringSliceElement(beforeFields, 0, ""))
115 if err != nil {
116 return nil, fmt.Errorf("failed to parse mount ID")
117 }
118 mount.ParentId, err = strconv.Atoi(getStringSliceElement(beforeFields, 1, ""))
119 if err != nil {
120 return nil, fmt.Errorf("failed to parse parent ID")
121 }
122 // Has optional fields, which is a space separated list of values.
123 // Example: shared:2 master:7
124 if len(beforeFields) > 6 {
125 mount.OptionalFields = make(map[string]string)
126 optionalFields := beforeFields[6:]
127 for _, field := range optionalFields {
128 optionSplit := strings.Split(field, ":")
129 target, value := optionSplit[0], ""
130 if len(optionSplit) == 2 {
131 value = optionSplit[1]
132 }
133 // Checks if the 'keys' in the optional fields in the mountinfo line are acceptable.
134 // Allowed 'keys' are shared, master, propagate_from, unbindable.
135 if _, ok := validOptionalFields[target]; ok {
136 mount.OptionalFields[target] = value
137 }
138 }
139 }
140 return mount, nil
141}
142
143// Parses the mount options, superblock options.
144func mountOptionsParser(mountOptions string) map[string]string {
145 opts := make(map[string]string)
146 options := strings.Split(mountOptions, ",")
147 for _, opt := range options {
148 splitOption := strings.Split(opt, "=")
149 if len(splitOption) < 2 {
150 key := splitOption[0]
151 opts[key] = ""
152 } else {
153 key, value := splitOption[0], splitOption[1]
154 opts[key] = value
155 }
156 }
157 return opts
158}
159
160// Retrieves mountinfo information from `/proc/self/mountinfo`.
161func GetMounts() ([]*MountInfo, error) {
162 f, err := os.Open("/proc/self/mountinfo")
163 if err != nil {
164 return nil, err
165 }
166 defer f.Close()
167 return parseMountInfo(f)
168}
169
170// Retrieves mountinfo information from a processes' `/proc/<pid>/mountinfo`.
171func GetProcMounts(pid int) ([]*MountInfo, error) {
172 f, err := os.Open(fmt.Sprintf("/proc/%d/mountinfo", pid))
173 if err != nil {
174 return nil, err
175 }
176 defer f.Close()
177 return parseMountInfo(f)
178}
diff --git a/vendor/github.com/prometheus/procfs/proc.go b/vendor/github.com/prometheus/procfs/proc.go
index 8a84301..41c148d 100644
--- a/vendor/github.com/prometheus/procfs/proc.go
+++ b/vendor/github.com/prometheus/procfs/proc.go
@@ -247,6 +247,20 @@ func (p Proc) MountStats() ([]*Mount, error) {
247 return parseMountStats(f) 247 return parseMountStats(f)
248} 248}
249 249
250// MountInfo retrieves mount information for mount points in a
251// process's namespace.
252// It supplies information missing in `/proc/self/mounts` and
253// fixes various other problems with that file too.
254func (p Proc) MountInfo() ([]*MountInfo, error) {
255 f, err := os.Open(p.path("mountinfo"))
256 if err != nil {
257 return nil, err
258 }
259 defer f.Close()
260
261 return parseMountInfo(f)
262}
263
250func (p Proc) fileDescriptors() ([]string, error) { 264func (p Proc) fileDescriptors() ([]string, error) {
251 d, err := os.Open(p.path("fd")) 265 d, err := os.Open(p.path("fd"))
252 if err != nil { 266 if err != nil {
diff --git a/vendor/github.com/prometheus/procfs/proc_environ.go b/vendor/github.com/prometheus/procfs/proc_environ.go
new file mode 100644
index 0000000..7172bb5
--- /dev/null
+++ b/vendor/github.com/prometheus/procfs/proc_environ.go
@@ -0,0 +1,43 @@
1// Copyright 2019 The Prometheus Authors
2// Licensed under the Apache License, Version 2.0 (the "License");
3// you may not use this file except in compliance with the License.
4// You may obtain a copy of the License at
5//
6// http://www.apache.org/licenses/LICENSE-2.0
7//
8// Unless required by applicable law or agreed to in writing, software
9// distributed under the License is distributed on an "AS IS" BASIS,
10// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11// See the License for the specific language governing permissions and
12// limitations under the License.
13
14package procfs
15
16import (
17 "io/ioutil"
18 "os"
19 "strings"
20)
21
22// Environ reads process environments from /proc/<pid>/environ
23func (p Proc) Environ() ([]string, error) {
24 environments := make([]string, 0)
25
26 f, err := os.Open(p.path("environ"))
27 if err != nil {
28 return environments, err
29 }
30 defer f.Close()
31
32 data, err := ioutil.ReadAll(f)
33 if err != nil {
34 return environments, err
35 }
36
37 environments = strings.Split(string(data), "\000")
38 if len(environments) > 0 {
39 environments = environments[:len(environments)-1]
40 }
41
42 return environments, nil
43}
diff --git a/vendor/github.com/prometheus/procfs/proc_stat.go b/vendor/github.com/prometheus/procfs/proc_stat.go
index 6ed98a8..dbde1fa 100644
--- a/vendor/github.com/prometheus/procfs/proc_stat.go
+++ b/vendor/github.com/prometheus/procfs/proc_stat.go
@@ -106,7 +106,7 @@ type ProcStat struct {
106 106
107// NewStat returns the current status information of the process. 107// NewStat returns the current status information of the process.
108// 108//
109// Deprecated: use NewStat() instead 109// Deprecated: use p.Stat() instead
110func (p Proc) NewStat() (ProcStat, error) { 110func (p Proc) NewStat() (ProcStat, error) {
111 return p.Stat() 111 return p.Stat()
112} 112}
diff --git a/vendor/github.com/prometheus/procfs/sysfs/class_infiniband.go b/vendor/github.com/prometheus/procfs/sysfs/class_infiniband.go
new file mode 100644
index 0000000..2600083
--- /dev/null
+++ b/vendor/github.com/prometheus/procfs/sysfs/class_infiniband.go
@@ -0,0 +1,370 @@
1// Copyright 2019 The Prometheus Authors
2// Licensed under the Apache License, Version 2.0 (the "License");
3// you may not use this file except in compliance with the License.
4// You may obtain a copy of the License at
5//
6// http://www.apache.org/licenses/LICENSE-2.0
7//
8// Unless required by applicable law or agreed to in writing, software
9// distributed under the License is distributed on an "AS IS" BASIS,
10// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11// See the License for the specific language governing permissions and
12// limitations under the License.
13
14// +build !windows
15
16package sysfs
17
18import (
19 "fmt"
20 "io/ioutil"
21 "os"
22 "path/filepath"
23 "strconv"
24 "strings"
25
26 "github.com/prometheus/procfs/internal/util"
27)
28
29const infinibandClassPath = "class/infiniband"
30
31// InfiniBandCounters contains counter values from files in
32// /sys/class/infiniband/<Name>/ports/<Port>/counters or
33// /sys/class/infiniband/<Name>/ports/<Port>/counters_ext
34// for a single port of one InfiniBand device.
35type InfiniBandCounters struct {
36 LegacyPortMulticastRcvPackets *uint64 // counters_ext/port_multicast_rcv_packets
37 LegacyPortMulticastXmitPackets *uint64 // counters_ext/port_multicast_xmit_packets
38 LegacyPortRcvData64 *uint64 // counters_ext/port_rcv_data_64
39 LegacyPortRcvPackets64 *uint64 // counters_ext/port_rcv_packets_64
40 LegacyPortUnicastRcvPackets *uint64 // counters_ext/port_unicast_rcv_packets
41 LegacyPortUnicastXmitPackets *uint64 // counters_ext/port_unicast_xmit_packets
42 LegacyPortXmitData64 *uint64 // counters_ext/port_xmit_data_64
43 LegacyPortXmitPackets64 *uint64 // counters_ext/port_xmit_packets_64
44
45 LinkDowned *uint64 // counters/link_downed
46 LinkErrorRecovery *uint64 // counters/link_error_recovery
47 MulticastRcvPackets *uint64 // counters/multicast_rcv_packets
48 MulticastXmitPackets *uint64 // counters/multicast_xmit_packets
49 PortRcvConstraintErrors *uint64 // counters/port_rcv_constraint_errors
50 PortRcvData *uint64 // counters/port_rcv_data
51 PortRcvDiscards *uint64 // counters/port_rcv_discards
52 PortRcvErrors *uint64 // counters/port_rcv_errors
53 PortRcvPackets *uint64 // counters/port_rcv_packets
54 PortXmitConstraintErrors *uint64 // counters/port_xmit_constraint_errors
55 PortXmitData *uint64 // counters/port_xmit_data
56 PortXmitDiscards *uint64 // counters/port_xmit_discards
57 PortXmitPackets *uint64 // counters/port_xmit_packets
58 PortXmitWait *uint64 // counters/port_xmit_wait
59 UnicastRcvPackets *uint64 // counters/unicast_rcv_packets
60 UnicastXmitPackets *uint64 // counters/unicast_xmit_packets
61}
62
63// InfiniBandPort contains info from files in
64// /sys/class/infiniband/<Name>/ports/<Port>
65// for a single port of one InfiniBand device.
66type InfiniBandPort struct {
67 Name string
68 Port uint
69 State string // String representation from /sys/class/infiniband/<Name>/ports/<Port>/state
70 StateID uint // ID from /sys/class/infiniband/<Name>/ports/<Port>/state
71 PhysState string // String representation from /sys/class/infiniband/<Name>/ports/<Port>/phys_state
72 PhysStateID uint // String representation from /sys/class/infiniband/<Name>/ports/<Port>/phys_state
73 Rate uint64 // in bytes/second from /sys/class/infiniband/<Name>/ports/<Port>/rate
74 Counters InfiniBandCounters
75}
76
77// InfiniBandDevice contains info from files in /sys/class/infiniband for a
78// single InfiniBand device.
79type InfiniBandDevice struct {
80 Name string
81 BoardID string // /sys/class/infiniband/<Name>/board_id
82 FirmwareVersion string // /sys/class/infiniband/<Name>/fw_ver
83 HCAType string // /sys/class/infiniband/<Name>/hca_type
84 Ports map[uint]InfiniBandPort
85}
86
87// InfiniBandClass is a collection of every InfiniBand device in
88// /sys/class/infiniband.
89//
90// The map keys are the names of the InfiniBand devices.
91type InfiniBandClass map[string]InfiniBandDevice
92
93// InfiniBandClass returns info for all InfiniBand devices read from
94// /sys/class/infiniband.
95func (fs FS) InfiniBandClass() (InfiniBandClass, error) {
96 path := fs.sys.Path(infinibandClassPath)
97
98 dirs, err := ioutil.ReadDir(path)
99 if err != nil {
100 return nil, fmt.Errorf("failed to list InfiniBand devices at %q: %v", path, err)
101 }
102
103 ibc := make(InfiniBandClass, len(dirs))
104 for _, d := range dirs {
105 device, err := fs.parseInfiniBandDevice(d.Name())
106 if err != nil {
107 return nil, err
108 }
109
110 ibc[device.Name] = *device
111 }
112
113 return ibc, nil
114}
115
116// Parse one InfiniBand device.
117func (fs FS) parseInfiniBandDevice(name string) (*InfiniBandDevice, error) {
118 path := fs.sys.Path(infinibandClassPath, name)
119 device := InfiniBandDevice{Name: name}
120
121 for _, f := range [...]string{"board_id", "fw_ver", "hca_type"} {
122 name := filepath.Join(path, f)
123 value, err := util.SysReadFile(name)
124 if err != nil {
125 return nil, fmt.Errorf("failed to read file %q: %v", name, err)
126 }
127
128 switch f {
129 case "board_id":
130 device.BoardID = value
131 case "fw_ver":
132 device.FirmwareVersion = value
133 case "hca_type":
134 device.HCAType = value
135 }
136 }
137
138 portsPath := filepath.Join(path, "ports")
139 ports, err := ioutil.ReadDir(portsPath)
140 if err != nil {
141 return nil, fmt.Errorf("failed to list InfiniBand ports at %q: %v", portsPath, err)
142 }
143
144 device.Ports = make(map[uint]InfiniBandPort, len(ports))
145 for _, d := range ports {
146 port, err := fs.parseInfiniBandPort(name, d.Name())
147 if err != nil {
148 return nil, err
149 }
150
151 device.Ports[port.Port] = *port
152 }
153
154 return &device, nil
155}
156
157// Parse InfiniBand state. Expected format: "<id>: <string-representation>"
158func parseState(s string) (uint, string, error) {
159 parts := strings.Split(s, ":")
160 if len(parts) != 2 {
161 return 0, "", fmt.Errorf("failed to split %s into 'ID: NAME'", s)
162 }
163 name := strings.TrimSpace(parts[1])
164 value, err := strconv.ParseUint(strings.TrimSpace(parts[0]), 10, 32)
165 if err != nil {
166 return 0, name, fmt.Errorf("failed to convert %s into uint", strings.TrimSpace(parts[0]))
167 }
168 id := uint(value)
169 return id, name, nil
170}
171
172// Parse rate (example: "100 Gb/sec (4X EDR)") and return it as bytes/second
173func parseRate(s string) (uint64, error) {
174 parts := strings.Split(s, "Gb/sec")
175 if len(parts) != 2 {
176 return 0, fmt.Errorf("failed to split '%s' by 'Gb/sec'", s)
177 }
178 value, err := strconv.ParseFloat(strings.TrimSpace(parts[0]), 32)
179 if err != nil {
180 return 0, fmt.Errorf("failed to convert %s into uint", strings.TrimSpace(parts[0]))
181 }
182 // Convert Gb/s into bytes/s
183 rate := uint64(value * 125000000)
184 return rate, nil
185}
186
187// parseInfiniBandPort scans predefined files in /sys/class/infiniband/<device>/ports/<port>
188// directory and gets their contents.
189func (fs FS) parseInfiniBandPort(name string, port string) (*InfiniBandPort, error) {
190 portNumber, err := strconv.ParseUint(port, 10, 32)
191 if err != nil {
192 return nil, fmt.Errorf("failed to convert %s into uint", port)
193 }
194 ibp := InfiniBandPort{Name: name, Port: uint(portNumber)}
195
196 portPath := fs.sys.Path(infinibandClassPath, name, "ports", port)
197 content, err := ioutil.ReadFile(filepath.Join(portPath, "state"))
198 if err != nil {
199 return nil, err
200 }
201 id, name, err := parseState(string(content))
202 if err != nil {
203 return nil, fmt.Errorf("could not parse state file in %s: %s", portPath, err)
204 }
205 ibp.State = name
206 ibp.StateID = id
207
208 content, err = ioutil.ReadFile(filepath.Join(portPath, "phys_state"))
209 if err != nil {
210 return nil, err
211 }
212 id, name, err = parseState(string(content))
213 if err != nil {
214 return nil, fmt.Errorf("could not parse phys_state file in %s: %s", portPath, err)
215 }
216 ibp.PhysState = name
217 ibp.PhysStateID = id
218
219 content, err = ioutil.ReadFile(filepath.Join(portPath, "rate"))
220 if err != nil {
221 return nil, err
222 }
223 ibp.Rate, err = parseRate(string(content))
224 if err != nil {
225 return nil, fmt.Errorf("could not parse rate file in %s: %s", portPath, err)
226 }
227
228 counters, err := parseInfiniBandCounters(portPath)
229 if err != nil {
230 return nil, err
231 }
232 ibp.Counters = *counters
233
234 return &ibp, nil
235}
236
237func parseInfiniBandCounters(portPath string) (*InfiniBandCounters, error) {
238 var counters InfiniBandCounters
239
240 path := filepath.Join(portPath, "counters")
241 files, err := ioutil.ReadDir(path)
242 if err != nil {
243 return nil, err
244 }
245
246 for _, f := range files {
247 if f.IsDir() {
248 continue
249 }
250
251 name := filepath.Join(path, f.Name())
252 value, err := util.SysReadFile(name)
253 if err != nil {
254 return nil, fmt.Errorf("failed to read file %q: %v", name, err)
255 }
256
257 // According to Mellanox, the metrics port_rcv_data, port_xmit_data,
258 // port_rcv_data_64, and port_xmit_data_64 "are divided by 4 unconditionally"
259 // as they represent the amount of data being transmitted and received per lane.
260 // Mellanox cards have 4 lanes per port, so all values must be multiplied by 4
261 // to get the expected value.
262
263 vp := util.NewValueParser(value)
264
265 switch f.Name() {
266 case "link_downed":
267 counters.LinkDowned = vp.PUInt64()
268 case "link_error_recovery":
269 counters.LinkErrorRecovery = vp.PUInt64()
270 case "multicast_rcv_packets":
271 counters.MulticastRcvPackets = vp.PUInt64()
272 case "multicast_xmit_packets":
273 counters.MulticastXmitPackets = vp.PUInt64()
274 case "port_rcv_constraint_errors":
275 counters.PortRcvConstraintErrors = vp.PUInt64()
276 case "port_rcv_data":
277 counters.PortRcvData = vp.PUInt64()
278 *counters.PortRcvData *= 4
279 case "port_rcv_discards":
280 counters.PortRcvDiscards = vp.PUInt64()
281 case "port_rcv_errors":
282 counters.PortRcvErrors = vp.PUInt64()
283 case "port_rcv_packets":
284 counters.PortRcvPackets = vp.PUInt64()
285 case "port_xmit_constraint_errors":
286 counters.PortXmitConstraintErrors = vp.PUInt64()
287 case "port_xmit_data":
288 counters.PortXmitData = vp.PUInt64()
289 *counters.PortXmitData *= 4
290 case "port_xmit_discards":
291 counters.PortXmitDiscards = vp.PUInt64()
292 case "port_xmit_packets":
293 counters.PortXmitPackets = vp.PUInt64()
294 case "port_xmit_wait":
295 counters.PortXmitWait = vp.PUInt64()
296 case "unicast_rcv_packets":
297 counters.UnicastRcvPackets = vp.PUInt64()
298 case "unicast_xmit_packets":
299 counters.UnicastXmitPackets = vp.PUInt64()
300 }
301
302 if err := vp.Err(); err != nil {
303 // Ugly workaround for handling https://github.com/prometheus/node_exporter/issues/966
304 // when counters are `N/A (not available)`.
305 // This was already patched and submitted, see
306 // https://www.spinics.net/lists/linux-rdma/msg68596.html
307 // Remove this as soon as the fix lands in the enterprise distros.
308 if strings.Contains(value, "N/A (no PMA)") {
309 continue
310 }
311 return nil, err
312 }
313 }
314
315 // Parse legacy counters
316 path = filepath.Join(portPath, "counters_ext")
317 files, err = ioutil.ReadDir(path)
318 if err != nil && !os.IsNotExist(err) {
319 return nil, err
320 }
321
322 for _, f := range files {
323 if f.IsDir() {
324 continue
325 }
326
327 name := filepath.Join(path, f.Name())
328 value, err := util.SysReadFile(name)
329 if err != nil {
330 return nil, fmt.Errorf("failed to read file %q: %v", name, err)
331 }
332
333 vp := util.NewValueParser(value)
334
335 switch f.Name() {
336 case "port_multicast_rcv_packets":
337 counters.LegacyPortMulticastRcvPackets = vp.PUInt64()
338 case "port_multicast_xmit_packets":
339 counters.LegacyPortMulticastXmitPackets = vp.PUInt64()
340 case "port_rcv_data_64":
341 counters.LegacyPortRcvData64 = vp.PUInt64()
342 *counters.LegacyPortRcvData64 *= 4
343 case "port_rcv_packets_64":
344 counters.LegacyPortRcvPackets64 = vp.PUInt64()
345 case "port_unicast_rcv_packets":
346 counters.LegacyPortUnicastRcvPackets = vp.PUInt64()
347 case "port_unicast_xmit_packets":
348 counters.LegacyPortUnicastXmitPackets = vp.PUInt64()
349 case "port_xmit_data_64":
350 counters.LegacyPortXmitData64 = vp.PUInt64()
351 *counters.LegacyPortXmitData64 *= 4
352 case "port_xmit_packets_64":
353 counters.LegacyPortXmitPackets64 = vp.PUInt64()
354 }
355
356 if err := vp.Err(); err != nil {
357 // Ugly workaround for handling https://github.com/prometheus/node_exporter/issues/966
358 // when counters are `N/A (not available)`.
359 // This was already patched and submitted, see
360 // https://www.spinics.net/lists/linux-rdma/msg68596.html
361 // Remove this as soon as the fix lands in the enterprise distros.
362 if strings.Contains(value, "N/A (no PMA)") {
363 continue
364 }
365 return nil, err
366 }
367 }
368
369 return &counters, nil
370}
diff --git a/vendor/github.com/prometheus/procfs/sysfs/class_power_supply.go b/vendor/github.com/prometheus/procfs/sysfs/class_power_supply.go
index 90c32e5..3fe7dd4 100644
--- a/vendor/github.com/prometheus/procfs/sysfs/class_power_supply.go
+++ b/vendor/github.com/prometheus/procfs/sysfs/class_power_supply.go
@@ -18,161 +18,275 @@ package sysfs
18import ( 18import (
19 "fmt" 19 "fmt"
20 "io/ioutil" 20 "io/ioutil"
21 "os" 21 "path/filepath"
22 "reflect"
23 "strconv"
24 "strings"
25 22
26 "github.com/prometheus/procfs/internal/util" 23 "github.com/prometheus/procfs/internal/util"
27) 24)
28 25
29// PowerSupply contains info from files in /sys/class/power_supply for a single power supply. 26// PowerSupply contains info from files in /sys/class/power_supply for a
27// single power supply.
30type PowerSupply struct { 28type PowerSupply struct {
31 Name string // Power Supply Name 29 Name string // Power Supply Name
32 Authentic *int64 `fileName:"authentic"` // /sys/class/power_suppy/<Name>/authentic 30 Authentic *int64 // /sys/class/power_supply/<Name>/authentic
33 Calibrate *int64 `fileName:"calibrate"` // /sys/class/power_suppy/<Name>/calibrate 31 Calibrate *int64 // /sys/class/power_supply/<Name>/calibrate
34 Capacity *int64 `fileName:"capacity"` // /sys/class/power_suppy/<Name>/capacity 32 Capacity *int64 // /sys/class/power_supply/<Name>/capacity
35 CapacityAlertMax *int64 `fileName:"capacity_alert_max"` // /sys/class/power_suppy/<Name>/capacity_alert_max 33 CapacityAlertMax *int64 // /sys/class/power_supply/<Name>/capacity_alert_max
36 CapacityAlertMin *int64 `fileName:"capacity_alert_min"` // /sys/class/power_suppy/<Name>/capacity_alert_min 34 CapacityAlertMin *int64 // /sys/class/power_supply/<Name>/capacity_alert_min
37 CapacityLevel string `fileName:"capacity_level"` // /sys/class/power_suppy/<Name>/capacity_level 35 CapacityLevel string // /sys/class/power_supply/<Name>/capacity_level
38 ChargeAvg *int64 `fileName:"charge_avg"` // /sys/class/power_suppy/<Name>/charge_avg 36 ChargeAvg *int64 // /sys/class/power_supply/<Name>/charge_avg
39 ChargeControlLimit *int64 `fileName:"charge_control_limit"` // /sys/class/power_suppy/<Name>/charge_control_limit 37 ChargeControlLimit *int64 // /sys/class/power_supply/<Name>/charge_control_limit
40 ChargeControlLimitMax *int64 `fileName:"charge_control_limit_max"` // /sys/class/power_suppy/<Name>/charge_control_limit_max 38 ChargeControlLimitMax *int64 // /sys/class/power_supply/<Name>/charge_control_limit_max
41 ChargeCounter *int64 `fileName:"charge_counter"` // /sys/class/power_suppy/<Name>/charge_counter 39 ChargeCounter *int64 // /sys/class/power_supply/<Name>/charge_counter
42 ChargeEmpty *int64 `fileName:"charge_empty"` // /sys/class/power_suppy/<Name>/charge_empty 40 ChargeEmpty *int64 // /sys/class/power_supply/<Name>/charge_empty
43 ChargeEmptyDesign *int64 `fileName:"charge_empty_design"` // /sys/class/power_suppy/<Name>/charge_empty_design 41 ChargeEmptyDesign *int64 // /sys/class/power_supply/<Name>/charge_empty_design
44 ChargeFull *int64 `fileName:"charge_full"` // /sys/class/power_suppy/<Name>/charge_full 42 ChargeFull *int64 // /sys/class/power_supply/<Name>/charge_full
45 ChargeFullDesign *int64 `fileName:"charge_full_design"` // /sys/class/power_suppy/<Name>/charge_full_design 43 ChargeFullDesign *int64 // /sys/class/power_supply/<Name>/charge_full_design
46 ChargeNow *int64 `fileName:"charge_now"` // /sys/class/power_suppy/<Name>/charge_now 44 ChargeNow *int64 // /sys/class/power_supply/<Name>/charge_now
47 ChargeTermCurrent *int64 `fileName:"charge_term_current"` // /sys/class/power_suppy/<Name>/charge_term_current 45 ChargeTermCurrent *int64 // /sys/class/power_supply/<Name>/charge_term_current
48 ChargeType string `fileName:"charge_type"` // /sys/class/power_supply/<Name>/charge_type 46 ChargeType string // /sys/class/power_supply/<Name>/charge_type
49 ConstantChargeCurrent *int64 `fileName:"constant_charge_current"` // /sys/class/power_suppy/<Name>/constant_charge_current 47 ConstantChargeCurrent *int64 // /sys/class/power_supply/<Name>/constant_charge_current
50 ConstantChargeCurrentMax *int64 `fileName:"constant_charge_current_max"` // /sys/class/power_suppy/<Name>/constant_charge_current_max 48 ConstantChargeCurrentMax *int64 // /sys/class/power_supply/<Name>/constant_charge_current_max
51 ConstantChargeVoltage *int64 `fileName:"constant_charge_voltage"` // /sys/class/power_suppy/<Name>/constant_charge_voltage 49 ConstantChargeVoltage *int64 // /sys/class/power_supply/<Name>/constant_charge_voltage
52 ConstantChargeVoltageMax *int64 `fileName:"constant_charge_voltage_max"` // /sys/class/power_suppy/<Name>/constant_charge_voltage_max 50 ConstantChargeVoltageMax *int64 // /sys/class/power_supply/<Name>/constant_charge_voltage_max
53 CurrentAvg *int64 `fileName:"current_avg"` // /sys/class/power_suppy/<Name>/current_avg 51 CurrentAvg *int64 // /sys/class/power_supply/<Name>/current_avg
54 CurrentBoot *int64 `fileName:"current_boot"` // /sys/class/power_suppy/<Name>/current_boot 52 CurrentBoot *int64 // /sys/class/power_supply/<Name>/current_boot
55 CurrentMax *int64 `fileName:"current_max"` // /sys/class/power_suppy/<Name>/current_max 53 CurrentMax *int64 // /sys/class/power_supply/<Name>/current_max
56 CurrentNow *int64 `fileName:"current_now"` // /sys/class/power_suppy/<Name>/current_now 54 CurrentNow *int64 // /sys/class/power_supply/<Name>/current_now
57 CycleCount *int64 `fileName:"cycle_count"` // /sys/class/power_suppy/<Name>/cycle_count 55 CycleCount *int64 // /sys/class/power_supply/<Name>/cycle_count
58 EnergyAvg *int64 `fileName:"energy_avg"` // /sys/class/power_supply/<Name>/energy_avg 56 EnergyAvg *int64 // /sys/class/power_supply/<Name>/energy_avg
59 EnergyEmpty *int64 `fileName:"energy_empty"` // /sys/class/power_suppy/<Name>/energy_empty 57 EnergyEmpty *int64 // /sys/class/power_supply/<Name>/energy_empty
60 EnergyEmptyDesign *int64 `fileName:"energy_empty_design"` // /sys/class/power_suppy/<Name>/energy_empty_design 58 EnergyEmptyDesign *int64 // /sys/class/power_supply/<Name>/energy_empty_design
61 EnergyFull *int64 `fileName:"energy_full"` // /sys/class/power_suppy/<Name>/energy_full 59 EnergyFull *int64 // /sys/class/power_supply/<Name>/energy_full
62 EnergyFullDesign *int64 `fileName:"energy_full_design"` // /sys/class/power_suppy/<Name>/energy_full_design 60 EnergyFullDesign *int64 // /sys/class/power_supply/<Name>/energy_full_design
63 EnergyNow *int64 `fileName:"energy_now"` // /sys/class/power_supply/<Name>/energy_now 61 EnergyNow *int64 // /sys/class/power_supply/<Name>/energy_now
64 Health string `fileName:"health"` // /sys/class/power_suppy/<Name>/health 62 Health string // /sys/class/power_supply/<Name>/health
65 InputCurrentLimit *int64 `fileName:"input_current_limit"` // /sys/class/power_suppy/<Name>/input_current_limit 63 InputCurrentLimit *int64 // /sys/class/power_supply/<Name>/input_current_limit
66 Manufacturer string `fileName:"manufacturer"` // /sys/class/power_suppy/<Name>/manufacturer 64 Manufacturer string // /sys/class/power_supply/<Name>/manufacturer
67 ModelName string `fileName:"model_name"` // /sys/class/power_suppy/<Name>/model_name 65 ModelName string // /sys/class/power_supply/<Name>/model_name
68 Online *int64 `fileName:"online"` // /sys/class/power_suppy/<Name>/online 66 Online *int64 // /sys/class/power_supply/<Name>/online
69 PowerAvg *int64 `fileName:"power_avg"` // /sys/class/power_suppy/<Name>/power_avg 67 PowerAvg *int64 // /sys/class/power_supply/<Name>/power_avg
70 PowerNow *int64 `fileName:"power_now"` // /sys/class/power_suppy/<Name>/power_now 68 PowerNow *int64 // /sys/class/power_supply/<Name>/power_now
71 PrechargeCurrent *int64 `fileName:"precharge_current"` // /sys/class/power_suppy/<Name>/precharge_current 69 PrechargeCurrent *int64 // /sys/class/power_supply/<Name>/precharge_current
72 Present *int64 `fileName:"present"` // /sys/class/power_suppy/<Name>/present 70 Present *int64 // /sys/class/power_supply/<Name>/present
73 Scope string `fileName:"scope"` // /sys/class/power_suppy/<Name>/scope 71 Scope string // /sys/class/power_supply/<Name>/scope
74 SerialNumber string `fileName:"serial_number"` // /sys/class/power_suppy/<Name>/serial_number 72 SerialNumber string // /sys/class/power_supply/<Name>/serial_number
75 Status string `fileName:"status"` // /sys/class/power_supply/<Name>/status 73 Status string // /sys/class/power_supply/<Name>/status
76 Technology string `fileName:"technology"` // /sys/class/power_suppy/<Name>/technology 74 Technology string // /sys/class/power_supply/<Name>/technology
77 Temp *int64 `fileName:"temp"` // /sys/class/power_suppy/<Name>/temp 75 Temp *int64 // /sys/class/power_supply/<Name>/temp
78 TempAlertMax *int64 `fileName:"temp_alert_max"` // /sys/class/power_suppy/<Name>/temp_alert_max 76 TempAlertMax *int64 // /sys/class/power_supply/<Name>/temp_alert_max
79 TempAlertMin *int64 `fileName:"temp_alert_min"` // /sys/class/power_suppy/<Name>/temp_alert_min 77 TempAlertMin *int64 // /sys/class/power_supply/<Name>/temp_alert_min
80 TempAmbient *int64 `fileName:"temp_ambient"` // /sys/class/power_suppy/<Name>/temp_ambient 78 TempAmbient *int64 // /sys/class/power_supply/<Name>/temp_ambient
81 TempAmbientMax *int64 `fileName:"temp_ambient_max"` // /sys/class/power_suppy/<Name>/temp_ambient_max 79 TempAmbientMax *int64 // /sys/class/power_supply/<Name>/temp_ambient_max
82 TempAmbientMin *int64 `fileName:"temp_ambient_min"` // /sys/class/power_suppy/<Name>/temp_ambient_min 80 TempAmbientMin *int64 // /sys/class/power_supply/<Name>/temp_ambient_min
83 TempMax *int64 `fileName:"temp_max"` // /sys/class/power_suppy/<Name>/temp_max 81 TempMax *int64 // /sys/class/power_supply/<Name>/temp_max
84 TempMin *int64 `fileName:"temp_min"` // /sys/class/power_suppy/<Name>/temp_min 82 TempMin *int64 // /sys/class/power_supply/<Name>/temp_min
85 TimeToEmptyAvg *int64 `fileName:"time_to_empty_avg"` // /sys/class/power_suppy/<Name>/time_to_empty_avg 83 TimeToEmptyAvg *int64 // /sys/class/power_supply/<Name>/time_to_empty_avg
86 TimeToEmptyNow *int64 `fileName:"time_to_empty_now"` // /sys/class/power_suppy/<Name>/time_to_empty_now 84 TimeToEmptyNow *int64 // /sys/class/power_supply/<Name>/time_to_empty_now
87 TimeToFullAvg *int64 `fileName:"time_to_full_avg"` // /sys/class/power_suppy/<Name>/time_to_full_avg 85 TimeToFullAvg *int64 // /sys/class/power_supply/<Name>/time_to_full_avg
88 TimeToFullNow *int64 `fileName:"time_to_full_now"` // /sys/class/power_suppy/<Name>/time_to_full_now 86 TimeToFullNow *int64 // /sys/class/power_supply/<Name>/time_to_full_now
89 Type string `fileName:"type"` // /sys/class/power_supply/<Name>/type 87 Type string // /sys/class/power_supply/<Name>/type
90 UsbType string `fileName:"usb_type"` // /sys/class/power_supply/<Name>/usb_type 88 UsbType string // /sys/class/power_supply/<Name>/usb_type
91 VoltageAvg *int64 `fileName:"voltage_avg"` // /sys/class/power_supply/<Name>/voltage_avg 89 VoltageAvg *int64 // /sys/class/power_supply/<Name>/voltage_avg
92 VoltageBoot *int64 `fileName:"voltage_boot"` // /sys/class/power_suppy/<Name>/voltage_boot 90 VoltageBoot *int64 // /sys/class/power_supply/<Name>/voltage_boot
93 VoltageMax *int64 `fileName:"voltage_max"` // /sys/class/power_suppy/<Name>/voltage_max 91 VoltageMax *int64 // /sys/class/power_supply/<Name>/voltage_max
94 VoltageMaxDesign *int64 `fileName:"voltage_max_design"` // /sys/class/power_suppy/<Name>/voltage_max_design 92 VoltageMaxDesign *int64 // /sys/class/power_supply/<Name>/voltage_max_design
95 VoltageMin *int64 `fileName:"voltage_min"` // /sys/class/power_suppy/<Name>/voltage_min 93 VoltageMin *int64 // /sys/class/power_supply/<Name>/voltage_min
96 VoltageMinDesign *int64 `fileName:"voltage_min_design"` // /sys/class/power_suppy/<Name>/voltage_min_design 94 VoltageMinDesign *int64 // /sys/class/power_supply/<Name>/voltage_min_design
97 VoltageNow *int64 `fileName:"voltage_now"` // /sys/class/power_supply/<Name>/voltage_now 95 VoltageNow *int64 // /sys/class/power_supply/<Name>/voltage_now
98 VoltageOCV *int64 `fileName:"voltage_ocv"` // /sys/class/power_suppy/<Name>/voltage_ocv 96 VoltageOCV *int64 // /sys/class/power_supply/<Name>/voltage_ocv
99} 97}
100 98
101// PowerSupplyClass is a collection of every power supply in /sys/class/power_supply/. 99// PowerSupplyClass is a collection of every power supply in
100// /sys/class/power_supply.
101//
102// The map keys are the names of the power supplies. 102// The map keys are the names of the power supplies.
103type PowerSupplyClass map[string]PowerSupply 103type PowerSupplyClass map[string]PowerSupply
104 104
105// PowerSupplyClass returns info for all power supplies read from /sys/class/power_supply/. 105// PowerSupplyClass returns info for all power supplies read from
106// /sys/class/power_supply.
106func (fs FS) PowerSupplyClass() (PowerSupplyClass, error) { 107func (fs FS) PowerSupplyClass() (PowerSupplyClass, error) {
107 path := fs.sys.Path("class/power_supply") 108 path := fs.sys.Path("class/power_supply")
108 109
109 powerSupplyDirs, err := ioutil.ReadDir(path) 110 dirs, err := ioutil.ReadDir(path)
110 if err != nil { 111 if err != nil {
111 return PowerSupplyClass{}, fmt.Errorf("cannot access %s dir %s", path, err) 112 return nil, fmt.Errorf("failed to list power supplies at %q: %v", path, err)
112 } 113 }
113 114
114 powerSupplyClass := PowerSupplyClass{} 115 psc := make(PowerSupplyClass, len(dirs))
115 for _, powerSupplyDir := range powerSupplyDirs { 116 for _, d := range dirs {
116 powerSupply, err := powerSupplyClass.parsePowerSupply(path + "/" + powerSupplyDir.Name()) 117 ps, err := parsePowerSupply(filepath.Join(path, d.Name()))
117 if err != nil { 118 if err != nil {
118 return nil, err 119 return nil, err
119 } 120 }
120 powerSupply.Name = powerSupplyDir.Name() 121
121 powerSupplyClass[powerSupplyDir.Name()] = *powerSupply 122 ps.Name = d.Name()
123 psc[d.Name()] = *ps
122 } 124 }
123 return powerSupplyClass, nil 125
126 return psc, nil
124} 127}
125 128
126func (psc PowerSupplyClass) parsePowerSupply(powerSupplyPath string) (*PowerSupply, error) { 129func parsePowerSupply(path string) (*PowerSupply, error) {
127 powerSupply := PowerSupply{} 130 files, err := ioutil.ReadDir(path)
128 powerSupplyElem := reflect.ValueOf(&powerSupply).Elem() 131 if err != nil {
129 powerSupplyType := reflect.TypeOf(powerSupply) 132 return nil, err
133 }
130 134
131 //start from 1 - skip the Name field 135 var ps PowerSupply
132 for i := 1; i < powerSupplyElem.NumField(); i++ { 136 for _, f := range files {
133 fieldType := powerSupplyType.Field(i) 137 if f.IsDir() {
134 fieldValue := powerSupplyElem.Field(i) 138 continue
139 }
135 140
136 if fieldType.Tag.Get("fileName") == "" { 141 name := filepath.Join(path, f.Name())
137 panic(fmt.Errorf("field %s does not have a filename tag", fieldType.Name)) 142 value, err := util.SysReadFile(name)
143 if err != nil {
144 return nil, fmt.Errorf("failed to read file %q: %v", name, err)
138 } 145 }
139 146
140 value, err := util.SysReadFile(powerSupplyPath + "/" + fieldType.Tag.Get("fileName")) 147 vp := util.NewValueParser(value)
141 148
142 if err != nil { 149 switch f.Name() {
143 if os.IsNotExist(err) || err.Error() == "operation not supported" || err.Error() == "invalid argument" { 150 case "authentic":
144 continue 151 ps.Authentic = vp.PInt64()
145 } 152 case "calibrate":
146 return nil, fmt.Errorf("could not access file %s: %s", fieldType.Tag.Get("fileName"), err) 153 ps.Calibrate = vp.PInt64()
154 case "capacity":
155 ps.Capacity = vp.PInt64()
156 case "capacity_alert_max":
157 ps.CapacityAlertMax = vp.PInt64()
158 case "capacity_alert_min":
159 ps.CapacityAlertMin = vp.PInt64()
160 case "capacity_level":
161 ps.CapacityLevel = value
162 case "charge_avg":
163 ps.ChargeAvg = vp.PInt64()
164 case "charge_control_limit":
165 ps.ChargeControlLimit = vp.PInt64()
166 case "charge_control_limit_max":
167 ps.ChargeControlLimitMax = vp.PInt64()
168 case "charge_counter":
169 ps.ChargeCounter = vp.PInt64()
170 case "charge_empty":
171 ps.ChargeEmpty = vp.PInt64()
172 case "charge_empty_design":
173 ps.ChargeEmptyDesign = vp.PInt64()
174 case "charge_full":
175 ps.ChargeFull = vp.PInt64()
176 case "charge_full_design":
177 ps.ChargeFullDesign = vp.PInt64()
178 case "charge_now":
179 ps.ChargeNow = vp.PInt64()
180 case "charge_term_current":
181 ps.ChargeTermCurrent = vp.PInt64()
182 case "charge_type":
183 ps.ChargeType = value
184 case "constant_charge_current":
185 ps.ConstantChargeCurrent = vp.PInt64()
186 case "constant_charge_current_max":
187 ps.ConstantChargeCurrentMax = vp.PInt64()
188 case "constant_charge_voltage":
189 ps.ConstantChargeVoltage = vp.PInt64()
190 case "constant_charge_voltage_max":
191 ps.ConstantChargeVoltageMax = vp.PInt64()
192 case "current_avg":
193 ps.CurrentAvg = vp.PInt64()
194 case "current_boot":
195 ps.CurrentBoot = vp.PInt64()
196 case "current_max":
197 ps.CurrentMax = vp.PInt64()
198 case "current_now":
199 ps.CurrentNow = vp.PInt64()
200 case "cycle_count":
201 ps.CycleCount = vp.PInt64()
202 case "energy_avg":
203 ps.EnergyAvg = vp.PInt64()
204 case "energy_empty":
205 ps.EnergyEmpty = vp.PInt64()
206 case "energy_empty_design":
207 ps.EnergyEmptyDesign = vp.PInt64()
208 case "energy_full":
209 ps.EnergyFull = vp.PInt64()
210 case "energy_full_design":
211 ps.EnergyFullDesign = vp.PInt64()
212 case "energy_now":
213 ps.EnergyNow = vp.PInt64()
214 case "health":
215 ps.Health = value
216 case "input_current_limit":
217 ps.InputCurrentLimit = vp.PInt64()
218 case "manufacturer":
219 ps.Manufacturer = value
220 case "model_name":
221 ps.ModelName = value
222 case "online":
223 ps.Online = vp.PInt64()
224 case "power_avg":
225 ps.PowerAvg = vp.PInt64()
226 case "power_now":
227 ps.PowerNow = vp.PInt64()
228 case "precharge_current":
229 ps.PrechargeCurrent = vp.PInt64()
230 case "present":
231 ps.Present = vp.PInt64()
232 case "scope":
233 ps.Scope = value
234 case "serial_number":
235 ps.SerialNumber = value
236 case "status":
237 ps.Status = value
238 case "technology":
239 ps.Technology = value
240 case "temp":
241 ps.Temp = vp.PInt64()
242 case "temp_alert_max":
243 ps.TempAlertMax = vp.PInt64()
244 case "temp_alert_min":
245 ps.TempAlertMin = vp.PInt64()
246 case "temp_ambient":
247 ps.TempAmbient = vp.PInt64()
248 case "temp_ambient_max":
249 ps.TempAmbientMax = vp.PInt64()
250 case "temp_ambient_min":
251 ps.TempAmbientMin = vp.PInt64()
252 case "temp_max":
253 ps.TempMax = vp.PInt64()
254 case "temp_min":
255 ps.TempMin = vp.PInt64()
256 case "time_to_empty_avg":
257 ps.TimeToEmptyAvg = vp.PInt64()
258 case "time_to_empty_now":
259 ps.TimeToEmptyNow = vp.PInt64()
260 case "time_to_full_avg":
261 ps.TimeToFullAvg = vp.PInt64()
262 case "time_to_full_now":
263 ps.TimeToFullNow = vp.PInt64()
264 case "type":
265 ps.Type = value
266 case "usb_type":
267 ps.UsbType = value
268 case "voltage_avg":
269 ps.VoltageAvg = vp.PInt64()
270 case "voltage_boot":
271 ps.VoltageBoot = vp.PInt64()
272 case "voltage_max":
273 ps.VoltageMax = vp.PInt64()
274 case "voltage_max_design":
275 ps.VoltageMaxDesign = vp.PInt64()
276 case "voltage_min":
277 ps.VoltageMin = vp.PInt64()
278 case "voltage_min_design":
279 ps.VoltageMinDesign = vp.PInt64()
280 case "voltage_now":
281 ps.VoltageNow = vp.PInt64()
282 case "voltage_ocv":
283 ps.VoltageOCV = vp.PInt64()
147 } 284 }
148 285
149 switch fieldValue.Kind() { 286 if err := vp.Err(); err != nil {
150 case reflect.String: 287 return nil, err
151 fieldValue.SetString(value)
152 case reflect.Ptr:
153 var int64ptr *int64
154 switch fieldValue.Type() {
155 case reflect.TypeOf(int64ptr):
156 var intValue int64
157 if strings.HasPrefix(value, "0x") {
158 intValue, err = strconv.ParseInt(value[2:], 16, 64)
159 if err != nil {
160 return nil, fmt.Errorf("expected hex value for %s, got: %s", fieldType.Name, value)
161 }
162 } else {
163 intValue, err = strconv.ParseInt(value, 10, 64)
164 if err != nil {
165 return nil, fmt.Errorf("expected Uint64 value for %s, got: %s", fieldType.Name, value)
166 }
167 }
168 fieldValue.Set(reflect.ValueOf(&intValue))
169 default:
170 return nil, fmt.Errorf("unhandled pointer type %q", fieldValue.Type())
171 }
172 default:
173 return nil, fmt.Errorf("unhandled type %q", fieldValue.Kind())
174 } 288 }
175 } 289 }
176 290
177 return &powerSupply, nil 291 return &ps, nil
178} 292}
diff --git a/vendor/modules.txt b/vendor/modules.txt
index 4204734..aeff668 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -45,7 +45,7 @@ github.com/prometheus/common/version
45github.com/prometheus/common/expfmt 45github.com/prometheus/common/expfmt
46github.com/prometheus/common/model 46github.com/prometheus/common/model
47github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg 47github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg
48# github.com/prometheus/procfs v0.0.2 48# github.com/prometheus/procfs v0.0.3
49github.com/prometheus/procfs 49github.com/prometheus/procfs
50github.com/prometheus/procfs/bcache 50github.com/prometheus/procfs/bcache
51github.com/prometheus/procfs/nfs 51github.com/prometheus/procfs/nfs