aboutsummaryrefslogtreecommitdiff
path: root/collector/diskstats_linux_test.go
diff options
context:
space:
mode:
authorPeter Fern <github@obfusc8.org>2015-12-27 12:59:02 +1100
committerPeter Fern <github@obfusc8.org>2015-12-27 22:00:02 +1100
commit09e610ad376b70901ad6bdbabf0b262ffdad2eec (patch)
treeb4b060b1bc271a035e5dae933c82040807731315 /collector/diskstats_linux_test.go
parent6af5273937268054ce688842c88fff3b6113f092 (diff)
downloadprometheus_node_collector-09e610ad376b70901ad6bdbabf0b262ffdad2eec.tar.bz2
prometheus_node_collector-09e610ad376b70901ad6bdbabf0b262ffdad2eec.tar.xz
prometheus_node_collector-09e610ad376b70901ad6bdbabf0b262ffdad2eec.zip
Calculate Linux disk bytes read/written based on sector size (512B)
Logical sector size appears to be fixed at 512B for the foreseeable future in the kernel, so for now we just hard-code it.
Diffstat (limited to 'collector/diskstats_linux_test.go')
-rw-r--r--collector/diskstats_linux_test.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/collector/diskstats_linux_test.go b/collector/diskstats_linux_test.go
index 405bf28..21e5378 100644
--- a/collector/diskstats_linux_test.go
+++ b/collector/diskstats_linux_test.go
@@ -37,4 +37,12 @@ func TestDiskStats(t *testing.T) {
37 if want, got := "68", diskStats["mmcblk0p2"][10]; want != got { 37 if want, got := "68", diskStats["mmcblk0p2"][10]; want != got {
38 t.Errorf("want diskstats mmcblk0p2 %s, got %s", want, got) 38 t.Errorf("want diskstats mmcblk0p2 %s, got %s", want, got)
39 } 39 }
40
41 if want, got := "513713216512", diskStats["sda"][11]; want != got {
42 t.Errorf("want diskstats sda read bytes %s, got %s", want, got)
43 }
44
45 if want, got := "258916880384", diskStats["sda"][12]; want != got {
46 t.Errorf("want diskstats sda write bytes %s, got %s", want, got)
47 }
40} 48}