aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHannes Körber <hannes.koerber@haktec.de>2018-07-24 00:47:12 +0200
committerJohannes 'fish' Ziemke <github@freigeist.org>2018-07-24 00:47:12 +0200
commit14a4f0028e02ba1c21d6833482bd8f7529035b07 (patch)
treefad77a3e84976ee3e9051677eea2eceaf4a9f3ee
parent5c780d132c963acadf82846840864b700b095136 (diff)
downloadprometheus_node_collector-14a4f0028e02ba1c21d6833482bd8f7529035b07.tar.bz2
prometheus_node_collector-14a4f0028e02ba1c21d6833482bd8f7529035b07.tar.xz
prometheus_node_collector-14a4f0028e02ba1c21d6833482bd8f7529035b07.zip
Enable nfs protocol (#998)
* vendor: Update prometheus/procfs Signed-off-by: Hannes Körber <hannes.koerber@haktec.de> * mountstats: Use new NFS protocol field In https://github.com/prometheus/procfs/pull/100, the NFSTransportStats struct was expanded by a field called protocol that specifies the NFS protocol in use, either "tcp" or "udp". This commit adds the protocol as a label to all NFS metrics exported via the mountstats collector. Signed-off-by: Hannes Körber <hannes.koerber@haktec.de> * Update fixtures for UDP mount Signed-off-by: Hannes Körber <hannes.koerber@haktec.de>
-rw-r--r--collector/fixtures/e2e-64k-page-output.txt207
-rw-r--r--collector/fixtures/e2e-output.txt207
-rw-r--r--collector/fixtures/proc/10/mountstats14
-rw-r--r--collector/mountstats_linux.go85
-rw-r--r--vendor/github.com/prometheus/procfs/.gitignore1
-rw-r--r--vendor/github.com/prometheus/procfs/.travis.yml15
-rw-r--r--vendor/github.com/prometheus/procfs/Makefile6
-rw-r--r--vendor/github.com/prometheus/procfs/bcache/get_test.go114
-rw-r--r--vendor/github.com/prometheus/procfs/buddyinfo_test.go64
-rw-r--r--vendor/github.com/prometheus/procfs/fs_test.go39
-rw-r--r--vendor/github.com/prometheus/procfs/ipvs_test.go250
-rw-r--r--vendor/github.com/prometheus/procfs/mdstat_test.go44
-rw-r--r--vendor/github.com/prometheus/procfs/mountstats.go51
-rw-r--r--vendor/github.com/prometheus/procfs/mountstats_test.go380
-rw-r--r--vendor/github.com/prometheus/procfs/net_dev_test.go86
-rw-r--r--vendor/github.com/prometheus/procfs/nfs/parse_nfs_test.go305
-rw-r--r--vendor/github.com/prometheus/procfs/nfs/parse_nfsd_test.go196
-rw-r--r--vendor/github.com/prometheus/procfs/proc_io_test.go46
-rw-r--r--vendor/github.com/prometheus/procfs/proc_limits_test.go44
-rw-r--r--vendor/github.com/prometheus/procfs/proc_ns_test.go44
-rw-r--r--vendor/github.com/prometheus/procfs/proc_stat_test.go123
-rw-r--r--vendor/github.com/prometheus/procfs/proc_test.go174
-rwxr-xr-xvendor/github.com/prometheus/procfs/scripts/check_license.sh29
-rw-r--r--vendor/github.com/prometheus/procfs/stat_test.go74
-rw-r--r--vendor/github.com/prometheus/procfs/sysfs/.gitignore1
-rw-r--r--vendor/github.com/prometheus/procfs/sysfs/fixtures.ttar266
-rw-r--r--vendor/github.com/prometheus/procfs/sysfs/fs_test.go108
-rw-r--r--vendor/github.com/prometheus/procfs/sysfs/net_class_test.go88
-rw-r--r--vendor/github.com/prometheus/procfs/xfrm.go2
-rw-r--r--vendor/github.com/prometheus/procfs/xfrm_test.go66
-rw-r--r--vendor/github.com/prometheus/procfs/xfs/parse_test.go442
31 files changed, 3283 insertions, 288 deletions
diff --git a/collector/fixtures/e2e-64k-page-output.txt b/collector/fixtures/e2e-64k-page-output.txt
index c0f5acb..f1fa240 100644
--- a/collector/fixtures/e2e-64k-page-output.txt
+++ b/collector/fixtures/e2e-64k-page-output.txt
@@ -1403,179 +1403,248 @@ node_memory_numa_other_node_total{node="1"} 5.986052692e+10
1403node_memory_numa_other_node_total{node="2"} 9.86052692e+09 1403node_memory_numa_other_node_total{node="2"} 9.86052692e+09
1404# HELP node_mountstats_nfs_age_seconds_total The age of the NFS mount in seconds. 1404# HELP node_mountstats_nfs_age_seconds_total The age of the NFS mount in seconds.
1405# TYPE node_mountstats_nfs_age_seconds_total counter 1405# TYPE node_mountstats_nfs_age_seconds_total counter
1406node_mountstats_nfs_age_seconds_total{export="192.168.1.1:/srv/test"} 13968 1406node_mountstats_nfs_age_seconds_total{export="192.168.1.1:/srv/test",protocol="tcp"} 13968
1407node_mountstats_nfs_age_seconds_total{export="192.168.1.1:/srv/test",protocol="udp"} 13968
1407# HELP node_mountstats_nfs_direct_read_bytes_total Number of bytes read using the read() syscall in O_DIRECT mode. 1408# HELP node_mountstats_nfs_direct_read_bytes_total Number of bytes read using the read() syscall in O_DIRECT mode.
1408# TYPE node_mountstats_nfs_direct_read_bytes_total counter 1409# TYPE node_mountstats_nfs_direct_read_bytes_total counter
1409node_mountstats_nfs_direct_read_bytes_total{export="192.168.1.1:/srv/test"} 0 1410node_mountstats_nfs_direct_read_bytes_total{export="192.168.1.1:/srv/test",protocol="tcp"} 0
1411node_mountstats_nfs_direct_read_bytes_total{export="192.168.1.1:/srv/test",protocol="udp"} 0
1410# HELP node_mountstats_nfs_direct_write_bytes_total Number of bytes written using the write() syscall in O_DIRECT mode. 1412# HELP node_mountstats_nfs_direct_write_bytes_total Number of bytes written using the write() syscall in O_DIRECT mode.
1411# TYPE node_mountstats_nfs_direct_write_bytes_total counter 1413# TYPE node_mountstats_nfs_direct_write_bytes_total counter
1412node_mountstats_nfs_direct_write_bytes_total{export="192.168.1.1:/srv/test"} 0 1414node_mountstats_nfs_direct_write_bytes_total{export="192.168.1.1:/srv/test",protocol="tcp"} 0
1415node_mountstats_nfs_direct_write_bytes_total{export="192.168.1.1:/srv/test",protocol="udp"} 0
1413# HELP node_mountstats_nfs_event_attribute_invalidate_total Number of times cached inode attributes are invalidated. 1416# HELP node_mountstats_nfs_event_attribute_invalidate_total Number of times cached inode attributes are invalidated.
1414# TYPE node_mountstats_nfs_event_attribute_invalidate_total counter 1417# TYPE node_mountstats_nfs_event_attribute_invalidate_total counter
1415node_mountstats_nfs_event_attribute_invalidate_total{export="192.168.1.1:/srv/test"} 0 1418node_mountstats_nfs_event_attribute_invalidate_total{export="192.168.1.1:/srv/test",protocol="tcp"} 0
1419node_mountstats_nfs_event_attribute_invalidate_total{export="192.168.1.1:/srv/test",protocol="udp"} 0
1416# HELP node_mountstats_nfs_event_data_invalidate_total Number of times an inode cache is cleared. 1420# HELP node_mountstats_nfs_event_data_invalidate_total Number of times an inode cache is cleared.
1417# TYPE node_mountstats_nfs_event_data_invalidate_total counter 1421# TYPE node_mountstats_nfs_event_data_invalidate_total counter
1418node_mountstats_nfs_event_data_invalidate_total{export="192.168.1.1:/srv/test"} 0 1422node_mountstats_nfs_event_data_invalidate_total{export="192.168.1.1:/srv/test",protocol="tcp"} 0
1423node_mountstats_nfs_event_data_invalidate_total{export="192.168.1.1:/srv/test",protocol="udp"} 0
1419# HELP node_mountstats_nfs_event_dnode_revalidate_total Number of times cached dentry nodes are re-validated from the server. 1424# HELP node_mountstats_nfs_event_dnode_revalidate_total Number of times cached dentry nodes are re-validated from the server.
1420# TYPE node_mountstats_nfs_event_dnode_revalidate_total counter 1425# TYPE node_mountstats_nfs_event_dnode_revalidate_total counter
1421node_mountstats_nfs_event_dnode_revalidate_total{export="192.168.1.1:/srv/test"} 226 1426node_mountstats_nfs_event_dnode_revalidate_total{export="192.168.1.1:/srv/test",protocol="tcp"} 226
1427node_mountstats_nfs_event_dnode_revalidate_total{export="192.168.1.1:/srv/test",protocol="udp"} 226
1422# HELP node_mountstats_nfs_event_inode_revalidate_total Number of times cached inode attributes are re-validated from the server. 1428# HELP node_mountstats_nfs_event_inode_revalidate_total Number of times cached inode attributes are re-validated from the server.
1423# TYPE node_mountstats_nfs_event_inode_revalidate_total counter 1429# TYPE node_mountstats_nfs_event_inode_revalidate_total counter
1424node_mountstats_nfs_event_inode_revalidate_total{export="192.168.1.1:/srv/test"} 52 1430node_mountstats_nfs_event_inode_revalidate_total{export="192.168.1.1:/srv/test",protocol="tcp"} 52
1431node_mountstats_nfs_event_inode_revalidate_total{export="192.168.1.1:/srv/test",protocol="udp"} 52
1425# HELP node_mountstats_nfs_event_jukebox_delay_total Number of times the NFS server indicated EJUKEBOX; retrieving data from offline storage. 1432# HELP node_mountstats_nfs_event_jukebox_delay_total Number of times the NFS server indicated EJUKEBOX; retrieving data from offline storage.
1426# TYPE node_mountstats_nfs_event_jukebox_delay_total counter 1433# TYPE node_mountstats_nfs_event_jukebox_delay_total counter
1427node_mountstats_nfs_event_jukebox_delay_total{export="192.168.1.1:/srv/test"} 0 1434node_mountstats_nfs_event_jukebox_delay_total{export="192.168.1.1:/srv/test",protocol="tcp"} 0
1435node_mountstats_nfs_event_jukebox_delay_total{export="192.168.1.1:/srv/test",protocol="udp"} 0
1428# HELP node_mountstats_nfs_event_pnfs_read_total Number of NFS v4.1+ pNFS reads. 1436# HELP node_mountstats_nfs_event_pnfs_read_total Number of NFS v4.1+ pNFS reads.
1429# TYPE node_mountstats_nfs_event_pnfs_read_total counter 1437# TYPE node_mountstats_nfs_event_pnfs_read_total counter
1430node_mountstats_nfs_event_pnfs_read_total{export="192.168.1.1:/srv/test"} 0 1438node_mountstats_nfs_event_pnfs_read_total{export="192.168.1.1:/srv/test",protocol="tcp"} 0
1439node_mountstats_nfs_event_pnfs_read_total{export="192.168.1.1:/srv/test",protocol="udp"} 0
1431# HELP node_mountstats_nfs_event_pnfs_write_total Number of NFS v4.1+ pNFS writes. 1440# HELP node_mountstats_nfs_event_pnfs_write_total Number of NFS v4.1+ pNFS writes.
1432# TYPE node_mountstats_nfs_event_pnfs_write_total counter 1441# TYPE node_mountstats_nfs_event_pnfs_write_total counter
1433node_mountstats_nfs_event_pnfs_write_total{export="192.168.1.1:/srv/test"} 0 1442node_mountstats_nfs_event_pnfs_write_total{export="192.168.1.1:/srv/test",protocol="tcp"} 0
1443node_mountstats_nfs_event_pnfs_write_total{export="192.168.1.1:/srv/test",protocol="udp"} 0
1434# HELP node_mountstats_nfs_event_short_read_total Number of times the NFS server gave less data than expected while reading. 1444# HELP node_mountstats_nfs_event_short_read_total Number of times the NFS server gave less data than expected while reading.
1435# TYPE node_mountstats_nfs_event_short_read_total counter 1445# TYPE node_mountstats_nfs_event_short_read_total counter
1436node_mountstats_nfs_event_short_read_total{export="192.168.1.1:/srv/test"} 0 1446node_mountstats_nfs_event_short_read_total{export="192.168.1.1:/srv/test",protocol="tcp"} 0
1447node_mountstats_nfs_event_short_read_total{export="192.168.1.1:/srv/test",protocol="udp"} 0
1437# HELP node_mountstats_nfs_event_short_write_total Number of times the NFS server wrote less data than expected while writing. 1448# HELP node_mountstats_nfs_event_short_write_total Number of times the NFS server wrote less data than expected while writing.
1438# TYPE node_mountstats_nfs_event_short_write_total counter 1449# TYPE node_mountstats_nfs_event_short_write_total counter
1439node_mountstats_nfs_event_short_write_total{export="192.168.1.1:/srv/test"} 0 1450node_mountstats_nfs_event_short_write_total{export="192.168.1.1:/srv/test",protocol="tcp"} 0
1451node_mountstats_nfs_event_short_write_total{export="192.168.1.1:/srv/test",protocol="udp"} 0
1440# HELP node_mountstats_nfs_event_silly_rename_total Number of times a file was removed while still open by another process. 1452# HELP node_mountstats_nfs_event_silly_rename_total Number of times a file was removed while still open by another process.
1441# TYPE node_mountstats_nfs_event_silly_rename_total counter 1453# TYPE node_mountstats_nfs_event_silly_rename_total counter
1442node_mountstats_nfs_event_silly_rename_total{export="192.168.1.1:/srv/test"} 0 1454node_mountstats_nfs_event_silly_rename_total{export="192.168.1.1:/srv/test",protocol="tcp"} 0
1455node_mountstats_nfs_event_silly_rename_total{export="192.168.1.1:/srv/test",protocol="udp"} 0
1443# HELP node_mountstats_nfs_event_truncation_total Number of times files have been truncated. 1456# HELP node_mountstats_nfs_event_truncation_total Number of times files have been truncated.
1444# TYPE node_mountstats_nfs_event_truncation_total counter 1457# TYPE node_mountstats_nfs_event_truncation_total counter
1445node_mountstats_nfs_event_truncation_total{export="192.168.1.1:/srv/test"} 0 1458node_mountstats_nfs_event_truncation_total{export="192.168.1.1:/srv/test",protocol="tcp"} 0
1459node_mountstats_nfs_event_truncation_total{export="192.168.1.1:/srv/test",protocol="udp"} 0
1446# HELP node_mountstats_nfs_event_vfs_access_total Number of times permissions have been checked. 1460# HELP node_mountstats_nfs_event_vfs_access_total Number of times permissions have been checked.
1447# TYPE node_mountstats_nfs_event_vfs_access_total counter 1461# TYPE node_mountstats_nfs_event_vfs_access_total counter
1448node_mountstats_nfs_event_vfs_access_total{export="192.168.1.1:/srv/test"} 398 1462node_mountstats_nfs_event_vfs_access_total{export="192.168.1.1:/srv/test",protocol="tcp"} 398
1463node_mountstats_nfs_event_vfs_access_total{export="192.168.1.1:/srv/test",protocol="udp"} 398
1449# HELP node_mountstats_nfs_event_vfs_file_release_total Number of times files have been closed and released. 1464# HELP node_mountstats_nfs_event_vfs_file_release_total Number of times files have been closed and released.
1450# TYPE node_mountstats_nfs_event_vfs_file_release_total counter 1465# TYPE node_mountstats_nfs_event_vfs_file_release_total counter
1451node_mountstats_nfs_event_vfs_file_release_total{export="192.168.1.1:/srv/test"} 77 1466node_mountstats_nfs_event_vfs_file_release_total{export="192.168.1.1:/srv/test",protocol="tcp"} 77
1467node_mountstats_nfs_event_vfs_file_release_total{export="192.168.1.1:/srv/test",protocol="udp"} 77
1452# HELP node_mountstats_nfs_event_vfs_flush_total Number of pending writes that have been forcefully flushed to the server. 1468# HELP node_mountstats_nfs_event_vfs_flush_total Number of pending writes that have been forcefully flushed to the server.
1453# TYPE node_mountstats_nfs_event_vfs_flush_total counter 1469# TYPE node_mountstats_nfs_event_vfs_flush_total counter
1454node_mountstats_nfs_event_vfs_flush_total{export="192.168.1.1:/srv/test"} 77 1470node_mountstats_nfs_event_vfs_flush_total{export="192.168.1.1:/srv/test",protocol="tcp"} 77
1471node_mountstats_nfs_event_vfs_flush_total{export="192.168.1.1:/srv/test",protocol="udp"} 77
1455# HELP node_mountstats_nfs_event_vfs_fsync_total Number of times fsync() has been called on directories and files. 1472# HELP node_mountstats_nfs_event_vfs_fsync_total Number of times fsync() has been called on directories and files.
1456# TYPE node_mountstats_nfs_event_vfs_fsync_total counter 1473# TYPE node_mountstats_nfs_event_vfs_fsync_total counter
1457node_mountstats_nfs_event_vfs_fsync_total{export="192.168.1.1:/srv/test"} 0 1474node_mountstats_nfs_event_vfs_fsync_total{export="192.168.1.1:/srv/test",protocol="tcp"} 0
1475node_mountstats_nfs_event_vfs_fsync_total{export="192.168.1.1:/srv/test",protocol="udp"} 0
1458# HELP node_mountstats_nfs_event_vfs_getdents_total Number of times directory entries have been read with getdents(). 1476# HELP node_mountstats_nfs_event_vfs_getdents_total Number of times directory entries have been read with getdents().
1459# TYPE node_mountstats_nfs_event_vfs_getdents_total counter 1477# TYPE node_mountstats_nfs_event_vfs_getdents_total counter
1460node_mountstats_nfs_event_vfs_getdents_total{export="192.168.1.1:/srv/test"} 0 1478node_mountstats_nfs_event_vfs_getdents_total{export="192.168.1.1:/srv/test",protocol="tcp"} 0
1479node_mountstats_nfs_event_vfs_getdents_total{export="192.168.1.1:/srv/test",protocol="udp"} 0
1461# HELP node_mountstats_nfs_event_vfs_lock_total Number of times locking has been attempted on a file. 1480# HELP node_mountstats_nfs_event_vfs_lock_total Number of times locking has been attempted on a file.
1462# TYPE node_mountstats_nfs_event_vfs_lock_total counter 1481# TYPE node_mountstats_nfs_event_vfs_lock_total counter
1463node_mountstats_nfs_event_vfs_lock_total{export="192.168.1.1:/srv/test"} 0 1482node_mountstats_nfs_event_vfs_lock_total{export="192.168.1.1:/srv/test",protocol="tcp"} 0
1483node_mountstats_nfs_event_vfs_lock_total{export="192.168.1.1:/srv/test",protocol="udp"} 0
1464# HELP node_mountstats_nfs_event_vfs_lookup_total Number of times a directory lookup has occurred. 1484# HELP node_mountstats_nfs_event_vfs_lookup_total Number of times a directory lookup has occurred.
1465# TYPE node_mountstats_nfs_event_vfs_lookup_total counter 1485# TYPE node_mountstats_nfs_event_vfs_lookup_total counter
1466node_mountstats_nfs_event_vfs_lookup_total{export="192.168.1.1:/srv/test"} 13 1486node_mountstats_nfs_event_vfs_lookup_total{export="192.168.1.1:/srv/test",protocol="tcp"} 13
1487node_mountstats_nfs_event_vfs_lookup_total{export="192.168.1.1:/srv/test",protocol="udp"} 13
1467# HELP node_mountstats_nfs_event_vfs_open_total Number of times cached inode attributes are invalidated. 1488# HELP node_mountstats_nfs_event_vfs_open_total Number of times cached inode attributes are invalidated.
1468# TYPE node_mountstats_nfs_event_vfs_open_total counter 1489# TYPE node_mountstats_nfs_event_vfs_open_total counter
1469node_mountstats_nfs_event_vfs_open_total{export="192.168.1.1:/srv/test"} 1 1490node_mountstats_nfs_event_vfs_open_total{export="192.168.1.1:/srv/test",protocol="tcp"} 1
1491node_mountstats_nfs_event_vfs_open_total{export="192.168.1.1:/srv/test",protocol="udp"} 1
1470# HELP node_mountstats_nfs_event_vfs_read_page_total Number of pages read directly via mmap()'d files. 1492# HELP node_mountstats_nfs_event_vfs_read_page_total Number of pages read directly via mmap()'d files.
1471# TYPE node_mountstats_nfs_event_vfs_read_page_total counter 1493# TYPE node_mountstats_nfs_event_vfs_read_page_total counter
1472node_mountstats_nfs_event_vfs_read_page_total{export="192.168.1.1:/srv/test"} 0 1494node_mountstats_nfs_event_vfs_read_page_total{export="192.168.1.1:/srv/test",protocol="tcp"} 0
1495node_mountstats_nfs_event_vfs_read_page_total{export="192.168.1.1:/srv/test",protocol="udp"} 0
1473# HELP node_mountstats_nfs_event_vfs_read_pages_total Number of times a group of pages have been read. 1496# HELP node_mountstats_nfs_event_vfs_read_pages_total Number of times a group of pages have been read.
1474# TYPE node_mountstats_nfs_event_vfs_read_pages_total counter 1497# TYPE node_mountstats_nfs_event_vfs_read_pages_total counter
1475node_mountstats_nfs_event_vfs_read_pages_total{export="192.168.1.1:/srv/test"} 331 1498node_mountstats_nfs_event_vfs_read_pages_total{export="192.168.1.1:/srv/test",protocol="tcp"} 331
1499node_mountstats_nfs_event_vfs_read_pages_total{export="192.168.1.1:/srv/test",protocol="udp"} 331
1476# HELP node_mountstats_nfs_event_vfs_setattr_total Number of times directory entries have been read with getdents(). 1500# HELP node_mountstats_nfs_event_vfs_setattr_total Number of times directory entries have been read with getdents().
1477# TYPE node_mountstats_nfs_event_vfs_setattr_total counter 1501# TYPE node_mountstats_nfs_event_vfs_setattr_total counter
1478node_mountstats_nfs_event_vfs_setattr_total{export="192.168.1.1:/srv/test"} 0 1502node_mountstats_nfs_event_vfs_setattr_total{export="192.168.1.1:/srv/test",protocol="tcp"} 0
1503node_mountstats_nfs_event_vfs_setattr_total{export="192.168.1.1:/srv/test",protocol="udp"} 0
1479# HELP node_mountstats_nfs_event_vfs_update_page_total Number of updates (and potential writes) to pages. 1504# HELP node_mountstats_nfs_event_vfs_update_page_total Number of updates (and potential writes) to pages.
1480# TYPE node_mountstats_nfs_event_vfs_update_page_total counter 1505# TYPE node_mountstats_nfs_event_vfs_update_page_total counter
1481node_mountstats_nfs_event_vfs_update_page_total{export="192.168.1.1:/srv/test"} 0 1506node_mountstats_nfs_event_vfs_update_page_total{export="192.168.1.1:/srv/test",protocol="tcp"} 0
1507node_mountstats_nfs_event_vfs_update_page_total{export="192.168.1.1:/srv/test",protocol="udp"} 0
1482# HELP node_mountstats_nfs_event_vfs_write_page_total Number of pages written directly via mmap()'d files. 1508# HELP node_mountstats_nfs_event_vfs_write_page_total Number of pages written directly via mmap()'d files.
1483# TYPE node_mountstats_nfs_event_vfs_write_page_total counter 1509# TYPE node_mountstats_nfs_event_vfs_write_page_total counter
1484node_mountstats_nfs_event_vfs_write_page_total{export="192.168.1.1:/srv/test"} 0 1510node_mountstats_nfs_event_vfs_write_page_total{export="192.168.1.1:/srv/test",protocol="tcp"} 0
1511node_mountstats_nfs_event_vfs_write_page_total{export="192.168.1.1:/srv/test",protocol="udp"} 0
1485# HELP node_mountstats_nfs_event_vfs_write_pages_total Number of times a group of pages have been written. 1512# HELP node_mountstats_nfs_event_vfs_write_pages_total Number of times a group of pages have been written.
1486# TYPE node_mountstats_nfs_event_vfs_write_pages_total counter 1513# TYPE node_mountstats_nfs_event_vfs_write_pages_total counter
1487node_mountstats_nfs_event_vfs_write_pages_total{export="192.168.1.1:/srv/test"} 47 1514node_mountstats_nfs_event_vfs_write_pages_total{export="192.168.1.1:/srv/test",protocol="tcp"} 47
1515node_mountstats_nfs_event_vfs_write_pages_total{export="192.168.1.1:/srv/test",protocol="udp"} 47
1488# HELP node_mountstats_nfs_event_write_extension_total Number of times a file has been grown due to writes beyond its existing end. 1516# HELP node_mountstats_nfs_event_write_extension_total Number of times a file has been grown due to writes beyond its existing end.
1489# TYPE node_mountstats_nfs_event_write_extension_total counter 1517# TYPE node_mountstats_nfs_event_write_extension_total counter
1490node_mountstats_nfs_event_write_extension_total{export="192.168.1.1:/srv/test"} 0 1518node_mountstats_nfs_event_write_extension_total{export="192.168.1.1:/srv/test",protocol="tcp"} 0
1519node_mountstats_nfs_event_write_extension_total{export="192.168.1.1:/srv/test",protocol="udp"} 0
1491# HELP node_mountstats_nfs_operations_major_timeouts_total Number of times a request has had a major timeout for a given operation. 1520# HELP node_mountstats_nfs_operations_major_timeouts_total Number of times a request has had a major timeout for a given operation.
1492# TYPE node_mountstats_nfs_operations_major_timeouts_total counter 1521# TYPE node_mountstats_nfs_operations_major_timeouts_total counter
1493node_mountstats_nfs_operations_major_timeouts_total{export="192.168.1.1:/srv/test",operation="NULL"} 0 1522node_mountstats_nfs_operations_major_timeouts_total{export="192.168.1.1:/srv/test",operation="NULL",protocol="tcp"} 0
1494node_mountstats_nfs_operations_major_timeouts_total{export="192.168.1.1:/srv/test",operation="READ"} 0 1523node_mountstats_nfs_operations_major_timeouts_total{export="192.168.1.1:/srv/test",operation="NULL",protocol="udp"} 0
1495node_mountstats_nfs_operations_major_timeouts_total{export="192.168.1.1:/srv/test",operation="WRITE"} 0 1524node_mountstats_nfs_operations_major_timeouts_total{export="192.168.1.1:/srv/test",operation="READ",protocol="tcp"} 0
1525node_mountstats_nfs_operations_major_timeouts_total{export="192.168.1.1:/srv/test",operation="READ",protocol="udp"} 0
1526node_mountstats_nfs_operations_major_timeouts_total{export="192.168.1.1:/srv/test",operation="WRITE",protocol="tcp"} 0
1527node_mountstats_nfs_operations_major_timeouts_total{export="192.168.1.1:/srv/test",operation="WRITE",protocol="udp"} 0
1496# HELP node_mountstats_nfs_operations_queue_time_seconds_total Duration all requests spent queued for transmission for a given operation before they were sent, in seconds. 1528# HELP node_mountstats_nfs_operations_queue_time_seconds_total Duration all requests spent queued for transmission for a given operation before they were sent, in seconds.
1497# TYPE node_mountstats_nfs_operations_queue_time_seconds_total counter 1529# TYPE node_mountstats_nfs_operations_queue_time_seconds_total counter
1498node_mountstats_nfs_operations_queue_time_seconds_total{export="192.168.1.1:/srv/test",operation="NULL"} 0 1530node_mountstats_nfs_operations_queue_time_seconds_total{export="192.168.1.1:/srv/test",operation="NULL",protocol="tcp"} 0
1499node_mountstats_nfs_operations_queue_time_seconds_total{export="192.168.1.1:/srv/test",operation="READ"} 0.006 1531node_mountstats_nfs_operations_queue_time_seconds_total{export="192.168.1.1:/srv/test",operation="NULL",protocol="udp"} 0
1500node_mountstats_nfs_operations_queue_time_seconds_total{export="192.168.1.1:/srv/test",operation="WRITE"} 0 1532node_mountstats_nfs_operations_queue_time_seconds_total{export="192.168.1.1:/srv/test",operation="READ",protocol="tcp"} 0.006
1533node_mountstats_nfs_operations_queue_time_seconds_total{export="192.168.1.1:/srv/test",operation="READ",protocol="udp"} 0.006
1534node_mountstats_nfs_operations_queue_time_seconds_total{export="192.168.1.1:/srv/test",operation="WRITE",protocol="tcp"} 0
1535node_mountstats_nfs_operations_queue_time_seconds_total{export="192.168.1.1:/srv/test",operation="WRITE",protocol="udp"} 0
1501# HELP node_mountstats_nfs_operations_received_bytes_total Number of bytes received for a given operation, including RPC headers and payload. 1536# HELP node_mountstats_nfs_operations_received_bytes_total Number of bytes received for a given operation, including RPC headers and payload.
1502# TYPE node_mountstats_nfs_operations_received_bytes_total counter 1537# TYPE node_mountstats_nfs_operations_received_bytes_total counter
1503node_mountstats_nfs_operations_received_bytes_total{export="192.168.1.1:/srv/test",operation="NULL"} 0 1538node_mountstats_nfs_operations_received_bytes_total{export="192.168.1.1:/srv/test",operation="NULL",protocol="tcp"} 0
1504node_mountstats_nfs_operations_received_bytes_total{export="192.168.1.1:/srv/test",operation="READ"} 1.210292152e+09 1539node_mountstats_nfs_operations_received_bytes_total{export="192.168.1.1:/srv/test",operation="NULL",protocol="udp"} 0
1505node_mountstats_nfs_operations_received_bytes_total{export="192.168.1.1:/srv/test",operation="WRITE"} 0 1540node_mountstats_nfs_operations_received_bytes_total{export="192.168.1.1:/srv/test",operation="READ",protocol="tcp"} 1.210292152e+09
1541node_mountstats_nfs_operations_received_bytes_total{export="192.168.1.1:/srv/test",operation="READ",protocol="udp"} 1.210292152e+09
1542node_mountstats_nfs_operations_received_bytes_total{export="192.168.1.1:/srv/test",operation="WRITE",protocol="tcp"} 0
1543node_mountstats_nfs_operations_received_bytes_total{export="192.168.1.1:/srv/test",operation="WRITE",protocol="udp"} 0
1506# HELP node_mountstats_nfs_operations_request_time_seconds_total Duration all requests took from when a request was enqueued to when it was completely handled for a given operation, in seconds. 1544# HELP node_mountstats_nfs_operations_request_time_seconds_total Duration all requests took from when a request was enqueued to when it was completely handled for a given operation, in seconds.
1507# TYPE node_mountstats_nfs_operations_request_time_seconds_total counter 1545# TYPE node_mountstats_nfs_operations_request_time_seconds_total counter
1508node_mountstats_nfs_operations_request_time_seconds_total{export="192.168.1.1:/srv/test",operation="NULL"} 0 1546node_mountstats_nfs_operations_request_time_seconds_total{export="192.168.1.1:/srv/test",operation="NULL",protocol="tcp"} 0
1509node_mountstats_nfs_operations_request_time_seconds_total{export="192.168.1.1:/srv/test",operation="READ"} 79.407 1547node_mountstats_nfs_operations_request_time_seconds_total{export="192.168.1.1:/srv/test",operation="NULL",protocol="udp"} 0
1510node_mountstats_nfs_operations_request_time_seconds_total{export="192.168.1.1:/srv/test",operation="WRITE"} 0 1548node_mountstats_nfs_operations_request_time_seconds_total{export="192.168.1.1:/srv/test",operation="READ",protocol="tcp"} 79.407
1549node_mountstats_nfs_operations_request_time_seconds_total{export="192.168.1.1:/srv/test",operation="READ",protocol="udp"} 79.407
1550node_mountstats_nfs_operations_request_time_seconds_total{export="192.168.1.1:/srv/test",operation="WRITE",protocol="tcp"} 0
1551node_mountstats_nfs_operations_request_time_seconds_total{export="192.168.1.1:/srv/test",operation="WRITE",protocol="udp"} 0
1511# HELP node_mountstats_nfs_operations_requests_total Number of requests performed for a given operation. 1552# HELP node_mountstats_nfs_operations_requests_total Number of requests performed for a given operation.
1512# TYPE node_mountstats_nfs_operations_requests_total counter 1553# TYPE node_mountstats_nfs_operations_requests_total counter
1513node_mountstats_nfs_operations_requests_total{export="192.168.1.1:/srv/test",operation="NULL"} 0 1554node_mountstats_nfs_operations_requests_total{export="192.168.1.1:/srv/test",operation="NULL",protocol="tcp"} 0
1514node_mountstats_nfs_operations_requests_total{export="192.168.1.1:/srv/test",operation="READ"} 1298 1555node_mountstats_nfs_operations_requests_total{export="192.168.1.1:/srv/test",operation="NULL",protocol="udp"} 0
1515node_mountstats_nfs_operations_requests_total{export="192.168.1.1:/srv/test",operation="WRITE"} 0 1556node_mountstats_nfs_operations_requests_total{export="192.168.1.1:/srv/test",operation="READ",protocol="tcp"} 1298
1557node_mountstats_nfs_operations_requests_total{export="192.168.1.1:/srv/test",operation="READ",protocol="udp"} 1298
1558node_mountstats_nfs_operations_requests_total{export="192.168.1.1:/srv/test",operation="WRITE",protocol="tcp"} 0
1559node_mountstats_nfs_operations_requests_total{export="192.168.1.1:/srv/test",operation="WRITE",protocol="udp"} 0
1516# HELP node_mountstats_nfs_operations_response_time_seconds_total Duration all requests took to get a reply back after a request for a given operation was transmitted, in seconds. 1560# HELP node_mountstats_nfs_operations_response_time_seconds_total Duration all requests took to get a reply back after a request for a given operation was transmitted, in seconds.
1517# TYPE node_mountstats_nfs_operations_response_time_seconds_total counter 1561# TYPE node_mountstats_nfs_operations_response_time_seconds_total counter
1518node_mountstats_nfs_operations_response_time_seconds_total{export="192.168.1.1:/srv/test",operation="NULL"} 0 1562node_mountstats_nfs_operations_response_time_seconds_total{export="192.168.1.1:/srv/test",operation="NULL",protocol="tcp"} 0
1519node_mountstats_nfs_operations_response_time_seconds_total{export="192.168.1.1:/srv/test",operation="READ"} 79.386 1563node_mountstats_nfs_operations_response_time_seconds_total{export="192.168.1.1:/srv/test",operation="NULL",protocol="udp"} 0
1520node_mountstats_nfs_operations_response_time_seconds_total{export="192.168.1.1:/srv/test",operation="WRITE"} 0 1564node_mountstats_nfs_operations_response_time_seconds_total{export="192.168.1.1:/srv/test",operation="READ",protocol="tcp"} 79.386
1565node_mountstats_nfs_operations_response_time_seconds_total{export="192.168.1.1:/srv/test",operation="READ",protocol="udp"} 79.386
1566node_mountstats_nfs_operations_response_time_seconds_total{export="192.168.1.1:/srv/test",operation="WRITE",protocol="tcp"} 0
1567node_mountstats_nfs_operations_response_time_seconds_total{export="192.168.1.1:/srv/test",operation="WRITE",protocol="udp"} 0
1521# HELP node_mountstats_nfs_operations_sent_bytes_total Number of bytes sent for a given operation, including RPC headers and payload. 1568# HELP node_mountstats_nfs_operations_sent_bytes_total Number of bytes sent for a given operation, including RPC headers and payload.
1522# TYPE node_mountstats_nfs_operations_sent_bytes_total counter 1569# TYPE node_mountstats_nfs_operations_sent_bytes_total counter
1523node_mountstats_nfs_operations_sent_bytes_total{export="192.168.1.1:/srv/test",operation="NULL"} 0 1570node_mountstats_nfs_operations_sent_bytes_total{export="192.168.1.1:/srv/test",operation="NULL",protocol="tcp"} 0
1524node_mountstats_nfs_operations_sent_bytes_total{export="192.168.1.1:/srv/test",operation="READ"} 207680 1571node_mountstats_nfs_operations_sent_bytes_total{export="192.168.1.1:/srv/test",operation="NULL",protocol="udp"} 0
1525node_mountstats_nfs_operations_sent_bytes_total{export="192.168.1.1:/srv/test",operation="WRITE"} 0 1572node_mountstats_nfs_operations_sent_bytes_total{export="192.168.1.1:/srv/test",operation="READ",protocol="tcp"} 207680
1573node_mountstats_nfs_operations_sent_bytes_total{export="192.168.1.1:/srv/test",operation="READ",protocol="udp"} 207680
1574node_mountstats_nfs_operations_sent_bytes_total{export="192.168.1.1:/srv/test",operation="WRITE",protocol="tcp"} 0
1575node_mountstats_nfs_operations_sent_bytes_total{export="192.168.1.1:/srv/test",operation="WRITE",protocol="udp"} 0
1526# HELP node_mountstats_nfs_operations_transmissions_total Number of times an actual RPC request has been transmitted for a given operation. 1576# HELP node_mountstats_nfs_operations_transmissions_total Number of times an actual RPC request has been transmitted for a given operation.
1527# TYPE node_mountstats_nfs_operations_transmissions_total counter 1577# TYPE node_mountstats_nfs_operations_transmissions_total counter
1528node_mountstats_nfs_operations_transmissions_total{export="192.168.1.1:/srv/test",operation="NULL"} 0 1578node_mountstats_nfs_operations_transmissions_total{export="192.168.1.1:/srv/test",operation="NULL",protocol="tcp"} 0
1529node_mountstats_nfs_operations_transmissions_total{export="192.168.1.1:/srv/test",operation="READ"} 1298 1579node_mountstats_nfs_operations_transmissions_total{export="192.168.1.1:/srv/test",operation="NULL",protocol="udp"} 0
1530node_mountstats_nfs_operations_transmissions_total{export="192.168.1.1:/srv/test",operation="WRITE"} 0 1580node_mountstats_nfs_operations_transmissions_total{export="192.168.1.1:/srv/test",operation="READ",protocol="tcp"} 1298
1581node_mountstats_nfs_operations_transmissions_total{export="192.168.1.1:/srv/test",operation="READ",protocol="udp"} 1298
1582node_mountstats_nfs_operations_transmissions_total{export="192.168.1.1:/srv/test",operation="WRITE",protocol="tcp"} 0
1583node_mountstats_nfs_operations_transmissions_total{export="192.168.1.1:/srv/test",operation="WRITE",protocol="udp"} 0
1531# HELP node_mountstats_nfs_read_bytes_total Number of bytes read using the read() syscall. 1584# HELP node_mountstats_nfs_read_bytes_total Number of bytes read using the read() syscall.
1532# TYPE node_mountstats_nfs_read_bytes_total counter 1585# TYPE node_mountstats_nfs_read_bytes_total counter
1533node_mountstats_nfs_read_bytes_total{export="192.168.1.1:/srv/test"} 1.20764023e+09 1586node_mountstats_nfs_read_bytes_total{export="192.168.1.1:/srv/test",protocol="tcp"} 1.20764023e+09
1587node_mountstats_nfs_read_bytes_total{export="192.168.1.1:/srv/test",protocol="udp"} 1.20764023e+09
1534# HELP node_mountstats_nfs_read_pages_total Number of pages read directly via mmap()'d files. 1588# HELP node_mountstats_nfs_read_pages_total Number of pages read directly via mmap()'d files.
1535# TYPE node_mountstats_nfs_read_pages_total counter 1589# TYPE node_mountstats_nfs_read_pages_total counter
1536node_mountstats_nfs_read_pages_total{export="192.168.1.1:/srv/test"} 295483 1590node_mountstats_nfs_read_pages_total{export="192.168.1.1:/srv/test",protocol="tcp"} 295483
1591node_mountstats_nfs_read_pages_total{export="192.168.1.1:/srv/test",protocol="udp"} 295483
1537# HELP node_mountstats_nfs_total_read_bytes_total Number of bytes read from the NFS server, in total. 1592# HELP node_mountstats_nfs_total_read_bytes_total Number of bytes read from the NFS server, in total.
1538# TYPE node_mountstats_nfs_total_read_bytes_total counter 1593# TYPE node_mountstats_nfs_total_read_bytes_total counter
1539node_mountstats_nfs_total_read_bytes_total{export="192.168.1.1:/srv/test"} 1.210214218e+09 1594node_mountstats_nfs_total_read_bytes_total{export="192.168.1.1:/srv/test",protocol="tcp"} 1.210214218e+09
1595node_mountstats_nfs_total_read_bytes_total{export="192.168.1.1:/srv/test",protocol="udp"} 1.210214218e+09
1540# HELP node_mountstats_nfs_total_write_bytes_total Number of bytes written to the NFS server, in total. 1596# HELP node_mountstats_nfs_total_write_bytes_total Number of bytes written to the NFS server, in total.
1541# TYPE node_mountstats_nfs_total_write_bytes_total counter 1597# TYPE node_mountstats_nfs_total_write_bytes_total counter
1542node_mountstats_nfs_total_write_bytes_total{export="192.168.1.1:/srv/test"} 0 1598node_mountstats_nfs_total_write_bytes_total{export="192.168.1.1:/srv/test",protocol="tcp"} 0
1599node_mountstats_nfs_total_write_bytes_total{export="192.168.1.1:/srv/test",protocol="udp"} 0
1543# HELP node_mountstats_nfs_transport_backlog_queue_total Total number of items added to the RPC backlog queue. 1600# HELP node_mountstats_nfs_transport_backlog_queue_total Total number of items added to the RPC backlog queue.
1544# TYPE node_mountstats_nfs_transport_backlog_queue_total counter 1601# TYPE node_mountstats_nfs_transport_backlog_queue_total counter
1545node_mountstats_nfs_transport_backlog_queue_total{export="192.168.1.1:/srv/test"} 0 1602node_mountstats_nfs_transport_backlog_queue_total{export="192.168.1.1:/srv/test",protocol="tcp"} 0
1603node_mountstats_nfs_transport_backlog_queue_total{export="192.168.1.1:/srv/test",protocol="udp"} 0
1546# HELP node_mountstats_nfs_transport_bad_transaction_ids_total Number of times the NFS server sent a response with a transaction ID unknown to this client. 1604# HELP node_mountstats_nfs_transport_bad_transaction_ids_total Number of times the NFS server sent a response with a transaction ID unknown to this client.
1547# TYPE node_mountstats_nfs_transport_bad_transaction_ids_total counter 1605# TYPE node_mountstats_nfs_transport_bad_transaction_ids_total counter
1548node_mountstats_nfs_transport_bad_transaction_ids_total{export="192.168.1.1:/srv/test"} 0 1606node_mountstats_nfs_transport_bad_transaction_ids_total{export="192.168.1.1:/srv/test",protocol="tcp"} 0
1607node_mountstats_nfs_transport_bad_transaction_ids_total{export="192.168.1.1:/srv/test",protocol="udp"} 0
1549# HELP node_mountstats_nfs_transport_bind_total Number of times the client has had to establish a connection from scratch to the NFS server. 1608# HELP node_mountstats_nfs_transport_bind_total Number of times the client has had to establish a connection from scratch to the NFS server.
1550# TYPE node_mountstats_nfs_transport_bind_total counter 1609# TYPE node_mountstats_nfs_transport_bind_total counter
1551node_mountstats_nfs_transport_bind_total{export="192.168.1.1:/srv/test"} 0 1610node_mountstats_nfs_transport_bind_total{export="192.168.1.1:/srv/test",protocol="tcp"} 0
1611node_mountstats_nfs_transport_bind_total{export="192.168.1.1:/srv/test",protocol="udp"} 0
1552# HELP node_mountstats_nfs_transport_connect_total Number of times the client has made a TCP connection to the NFS server. 1612# HELP node_mountstats_nfs_transport_connect_total Number of times the client has made a TCP connection to the NFS server.
1553# TYPE node_mountstats_nfs_transport_connect_total counter 1613# TYPE node_mountstats_nfs_transport_connect_total counter
1554node_mountstats_nfs_transport_connect_total{export="192.168.1.1:/srv/test"} 1 1614node_mountstats_nfs_transport_connect_total{export="192.168.1.1:/srv/test",protocol="tcp"} 1
1615node_mountstats_nfs_transport_connect_total{export="192.168.1.1:/srv/test",protocol="udp"} 0
1555# HELP node_mountstats_nfs_transport_idle_time_seconds Duration since the NFS mount last saw any RPC traffic, in seconds. 1616# HELP node_mountstats_nfs_transport_idle_time_seconds Duration since the NFS mount last saw any RPC traffic, in seconds.
1556# TYPE node_mountstats_nfs_transport_idle_time_seconds gauge 1617# TYPE node_mountstats_nfs_transport_idle_time_seconds gauge
1557node_mountstats_nfs_transport_idle_time_seconds{export="192.168.1.1:/srv/test"} 11 1618node_mountstats_nfs_transport_idle_time_seconds{export="192.168.1.1:/srv/test",protocol="tcp"} 11
1619node_mountstats_nfs_transport_idle_time_seconds{export="192.168.1.1:/srv/test",protocol="udp"} 0
1558# HELP node_mountstats_nfs_transport_maximum_rpc_slots Maximum number of simultaneously active RPC requests ever used. 1620# HELP node_mountstats_nfs_transport_maximum_rpc_slots Maximum number of simultaneously active RPC requests ever used.
1559# TYPE node_mountstats_nfs_transport_maximum_rpc_slots gauge 1621# TYPE node_mountstats_nfs_transport_maximum_rpc_slots gauge
1560node_mountstats_nfs_transport_maximum_rpc_slots{export="192.168.1.1:/srv/test"} 24 1622node_mountstats_nfs_transport_maximum_rpc_slots{export="192.168.1.1:/srv/test",protocol="tcp"} 24
1623node_mountstats_nfs_transport_maximum_rpc_slots{export="192.168.1.1:/srv/test",protocol="udp"} 24
1561# HELP node_mountstats_nfs_transport_pending_queue_total Total number of items added to the RPC transmission pending queue. 1624# HELP node_mountstats_nfs_transport_pending_queue_total Total number of items added to the RPC transmission pending queue.
1562# TYPE node_mountstats_nfs_transport_pending_queue_total counter 1625# TYPE node_mountstats_nfs_transport_pending_queue_total counter
1563node_mountstats_nfs_transport_pending_queue_total{export="192.168.1.1:/srv/test"} 5726 1626node_mountstats_nfs_transport_pending_queue_total{export="192.168.1.1:/srv/test",protocol="tcp"} 5726
1627node_mountstats_nfs_transport_pending_queue_total{export="192.168.1.1:/srv/test",protocol="udp"} 5726
1564# HELP node_mountstats_nfs_transport_receives_total Number of RPC responses for this mount received from the NFS server. 1628# HELP node_mountstats_nfs_transport_receives_total Number of RPC responses for this mount received from the NFS server.
1565# TYPE node_mountstats_nfs_transport_receives_total counter 1629# TYPE node_mountstats_nfs_transport_receives_total counter
1566node_mountstats_nfs_transport_receives_total{export="192.168.1.1:/srv/test"} 6428 1630node_mountstats_nfs_transport_receives_total{export="192.168.1.1:/srv/test",protocol="tcp"} 6428
1631node_mountstats_nfs_transport_receives_total{export="192.168.1.1:/srv/test",protocol="udp"} 6428
1567# HELP node_mountstats_nfs_transport_sending_queue_total Total number of items added to the RPC transmission sending queue. 1632# HELP node_mountstats_nfs_transport_sending_queue_total Total number of items added to the RPC transmission sending queue.
1568# TYPE node_mountstats_nfs_transport_sending_queue_total counter 1633# TYPE node_mountstats_nfs_transport_sending_queue_total counter
1569node_mountstats_nfs_transport_sending_queue_total{export="192.168.1.1:/srv/test"} 26 1634node_mountstats_nfs_transport_sending_queue_total{export="192.168.1.1:/srv/test",protocol="tcp"} 26
1635node_mountstats_nfs_transport_sending_queue_total{export="192.168.1.1:/srv/test",protocol="udp"} 26
1570# HELP node_mountstats_nfs_transport_sends_total Number of RPC requests for this mount sent to the NFS server. 1636# HELP node_mountstats_nfs_transport_sends_total Number of RPC requests for this mount sent to the NFS server.
1571# TYPE node_mountstats_nfs_transport_sends_total counter 1637# TYPE node_mountstats_nfs_transport_sends_total counter
1572node_mountstats_nfs_transport_sends_total{export="192.168.1.1:/srv/test"} 6428 1638node_mountstats_nfs_transport_sends_total{export="192.168.1.1:/srv/test",protocol="tcp"} 6428
1639node_mountstats_nfs_transport_sends_total{export="192.168.1.1:/srv/test",protocol="udp"} 6428
1573# HELP node_mountstats_nfs_write_bytes_total Number of bytes written using the write() syscall. 1640# HELP node_mountstats_nfs_write_bytes_total Number of bytes written using the write() syscall.
1574# TYPE node_mountstats_nfs_write_bytes_total counter 1641# TYPE node_mountstats_nfs_write_bytes_total counter
1575node_mountstats_nfs_write_bytes_total{export="192.168.1.1:/srv/test"} 0 1642node_mountstats_nfs_write_bytes_total{export="192.168.1.1:/srv/test",protocol="tcp"} 0
1643node_mountstats_nfs_write_bytes_total{export="192.168.1.1:/srv/test",protocol="udp"} 0
1576# HELP node_mountstats_nfs_write_pages_total Number of pages written directly via mmap()'d files. 1644# HELP node_mountstats_nfs_write_pages_total Number of pages written directly via mmap()'d files.
1577# TYPE node_mountstats_nfs_write_pages_total counter 1645# TYPE node_mountstats_nfs_write_pages_total counter
1578node_mountstats_nfs_write_pages_total{export="192.168.1.1:/srv/test"} 0 1646node_mountstats_nfs_write_pages_total{export="192.168.1.1:/srv/test",protocol="tcp"} 0
1647node_mountstats_nfs_write_pages_total{export="192.168.1.1:/srv/test",protocol="udp"} 0
1579# HELP node_netstat_Icmp6_InErrors Statistic Icmp6InErrors. 1648# HELP node_netstat_Icmp6_InErrors Statistic Icmp6InErrors.
1580# TYPE node_netstat_Icmp6_InErrors untyped 1649# TYPE node_netstat_Icmp6_InErrors untyped
1581node_netstat_Icmp6_InErrors 0 1650node_netstat_Icmp6_InErrors 0
diff --git a/collector/fixtures/e2e-output.txt b/collector/fixtures/e2e-output.txt
index 326890f..bf10320 100644
--- a/collector/fixtures/e2e-output.txt
+++ b/collector/fixtures/e2e-output.txt
@@ -1403,179 +1403,248 @@ node_memory_numa_other_node_total{node="1"} 5.986052692e+10
1403node_memory_numa_other_node_total{node="2"} 9.86052692e+09 1403node_memory_numa_other_node_total{node="2"} 9.86052692e+09
1404# HELP node_mountstats_nfs_age_seconds_total The age of the NFS mount in seconds. 1404# HELP node_mountstats_nfs_age_seconds_total The age of the NFS mount in seconds.
1405# TYPE node_mountstats_nfs_age_seconds_total counter 1405# TYPE node_mountstats_nfs_age_seconds_total counter
1406node_mountstats_nfs_age_seconds_total{export="192.168.1.1:/srv/test"} 13968 1406node_mountstats_nfs_age_seconds_total{export="192.168.1.1:/srv/test",protocol="tcp"} 13968
1407node_mountstats_nfs_age_seconds_total{export="192.168.1.1:/srv/test",protocol="udp"} 13968
1407# HELP node_mountstats_nfs_direct_read_bytes_total Number of bytes read using the read() syscall in O_DIRECT mode. 1408# HELP node_mountstats_nfs_direct_read_bytes_total Number of bytes read using the read() syscall in O_DIRECT mode.
1408# TYPE node_mountstats_nfs_direct_read_bytes_total counter 1409# TYPE node_mountstats_nfs_direct_read_bytes_total counter
1409node_mountstats_nfs_direct_read_bytes_total{export="192.168.1.1:/srv/test"} 0 1410node_mountstats_nfs_direct_read_bytes_total{export="192.168.1.1:/srv/test",protocol="tcp"} 0
1411node_mountstats_nfs_direct_read_bytes_total{export="192.168.1.1:/srv/test",protocol="udp"} 0
1410# HELP node_mountstats_nfs_direct_write_bytes_total Number of bytes written using the write() syscall in O_DIRECT mode. 1412# HELP node_mountstats_nfs_direct_write_bytes_total Number of bytes written using the write() syscall in O_DIRECT mode.
1411# TYPE node_mountstats_nfs_direct_write_bytes_total counter 1413# TYPE node_mountstats_nfs_direct_write_bytes_total counter
1412node_mountstats_nfs_direct_write_bytes_total{export="192.168.1.1:/srv/test"} 0 1414node_mountstats_nfs_direct_write_bytes_total{export="192.168.1.1:/srv/test",protocol="tcp"} 0
1415node_mountstats_nfs_direct_write_bytes_total{export="192.168.1.1:/srv/test",protocol="udp"} 0
1413# HELP node_mountstats_nfs_event_attribute_invalidate_total Number of times cached inode attributes are invalidated. 1416# HELP node_mountstats_nfs_event_attribute_invalidate_total Number of times cached inode attributes are invalidated.
1414# TYPE node_mountstats_nfs_event_attribute_invalidate_total counter 1417# TYPE node_mountstats_nfs_event_attribute_invalidate_total counter
1415node_mountstats_nfs_event_attribute_invalidate_total{export="192.168.1.1:/srv/test"} 0 1418node_mountstats_nfs_event_attribute_invalidate_total{export="192.168.1.1:/srv/test",protocol="tcp"} 0
1419node_mountstats_nfs_event_attribute_invalidate_total{export="192.168.1.1:/srv/test",protocol="udp"} 0
1416# HELP node_mountstats_nfs_event_data_invalidate_total Number of times an inode cache is cleared. 1420# HELP node_mountstats_nfs_event_data_invalidate_total Number of times an inode cache is cleared.
1417# TYPE node_mountstats_nfs_event_data_invalidate_total counter 1421# TYPE node_mountstats_nfs_event_data_invalidate_total counter
1418node_mountstats_nfs_event_data_invalidate_total{export="192.168.1.1:/srv/test"} 0 1422node_mountstats_nfs_event_data_invalidate_total{export="192.168.1.1:/srv/test",protocol="tcp"} 0
1423node_mountstats_nfs_event_data_invalidate_total{export="192.168.1.1:/srv/test",protocol="udp"} 0
1419# HELP node_mountstats_nfs_event_dnode_revalidate_total Number of times cached dentry nodes are re-validated from the server. 1424# HELP node_mountstats_nfs_event_dnode_revalidate_total Number of times cached dentry nodes are re-validated from the server.
1420# TYPE node_mountstats_nfs_event_dnode_revalidate_total counter 1425# TYPE node_mountstats_nfs_event_dnode_revalidate_total counter
1421node_mountstats_nfs_event_dnode_revalidate_total{export="192.168.1.1:/srv/test"} 226 1426node_mountstats_nfs_event_dnode_revalidate_total{export="192.168.1.1:/srv/test",protocol="tcp"} 226
1427node_mountstats_nfs_event_dnode_revalidate_total{export="192.168.1.1:/srv/test",protocol="udp"} 226
1422# HELP node_mountstats_nfs_event_inode_revalidate_total Number of times cached inode attributes are re-validated from the server. 1428# HELP node_mountstats_nfs_event_inode_revalidate_total Number of times cached inode attributes are re-validated from the server.
1423# TYPE node_mountstats_nfs_event_inode_revalidate_total counter 1429# TYPE node_mountstats_nfs_event_inode_revalidate_total counter
1424node_mountstats_nfs_event_inode_revalidate_total{export="192.168.1.1:/srv/test"} 52 1430node_mountstats_nfs_event_inode_revalidate_total{export="192.168.1.1:/srv/test",protocol="tcp"} 52
1431node_mountstats_nfs_event_inode_revalidate_total{export="192.168.1.1:/srv/test",protocol="udp"} 52
1425# HELP node_mountstats_nfs_event_jukebox_delay_total Number of times the NFS server indicated EJUKEBOX; retrieving data from offline storage. 1432# HELP node_mountstats_nfs_event_jukebox_delay_total Number of times the NFS server indicated EJUKEBOX; retrieving data from offline storage.
1426# TYPE node_mountstats_nfs_event_jukebox_delay_total counter 1433# TYPE node_mountstats_nfs_event_jukebox_delay_total counter
1427node_mountstats_nfs_event_jukebox_delay_total{export="192.168.1.1:/srv/test"} 0 1434node_mountstats_nfs_event_jukebox_delay_total{export="192.168.1.1:/srv/test",protocol="tcp"} 0
1435node_mountstats_nfs_event_jukebox_delay_total{export="192.168.1.1:/srv/test",protocol="udp"} 0
1428# HELP node_mountstats_nfs_event_pnfs_read_total Number of NFS v4.1+ pNFS reads. 1436# HELP node_mountstats_nfs_event_pnfs_read_total Number of NFS v4.1+ pNFS reads.
1429# TYPE node_mountstats_nfs_event_pnfs_read_total counter 1437# TYPE node_mountstats_nfs_event_pnfs_read_total counter
1430node_mountstats_nfs_event_pnfs_read_total{export="192.168.1.1:/srv/test"} 0 1438node_mountstats_nfs_event_pnfs_read_total{export="192.168.1.1:/srv/test",protocol="tcp"} 0
1439node_mountstats_nfs_event_pnfs_read_total{export="192.168.1.1:/srv/test",protocol="udp"} 0
1431# HELP node_mountstats_nfs_event_pnfs_write_total Number of NFS v4.1+ pNFS writes. 1440# HELP node_mountstats_nfs_event_pnfs_write_total Number of NFS v4.1+ pNFS writes.
1432# TYPE node_mountstats_nfs_event_pnfs_write_total counter 1441# TYPE node_mountstats_nfs_event_pnfs_write_total counter
1433node_mountstats_nfs_event_pnfs_write_total{export="192.168.1.1:/srv/test"} 0 1442node_mountstats_nfs_event_pnfs_write_total{export="192.168.1.1:/srv/test",protocol="tcp"} 0
1443node_mountstats_nfs_event_pnfs_write_total{export="192.168.1.1:/srv/test",protocol="udp"} 0
1434# HELP node_mountstats_nfs_event_short_read_total Number of times the NFS server gave less data than expected while reading. 1444# HELP node_mountstats_nfs_event_short_read_total Number of times the NFS server gave less data than expected while reading.
1435# TYPE node_mountstats_nfs_event_short_read_total counter 1445# TYPE node_mountstats_nfs_event_short_read_total counter
1436node_mountstats_nfs_event_short_read_total{export="192.168.1.1:/srv/test"} 0 1446node_mountstats_nfs_event_short_read_total{export="192.168.1.1:/srv/test",protocol="tcp"} 0
1447node_mountstats_nfs_event_short_read_total{export="192.168.1.1:/srv/test",protocol="udp"} 0
1437# HELP node_mountstats_nfs_event_short_write_total Number of times the NFS server wrote less data than expected while writing. 1448# HELP node_mountstats_nfs_event_short_write_total Number of times the NFS server wrote less data than expected while writing.
1438# TYPE node_mountstats_nfs_event_short_write_total counter 1449# TYPE node_mountstats_nfs_event_short_write_total counter
1439node_mountstats_nfs_event_short_write_total{export="192.168.1.1:/srv/test"} 0 1450node_mountstats_nfs_event_short_write_total{export="192.168.1.1:/srv/test",protocol="tcp"} 0
1451node_mountstats_nfs_event_short_write_total{export="192.168.1.1:/srv/test",protocol="udp"} 0
1440# HELP node_mountstats_nfs_event_silly_rename_total Number of times a file was removed while still open by another process. 1452# HELP node_mountstats_nfs_event_silly_rename_total Number of times a file was removed while still open by another process.
1441# TYPE node_mountstats_nfs_event_silly_rename_total counter 1453# TYPE node_mountstats_nfs_event_silly_rename_total counter
1442node_mountstats_nfs_event_silly_rename_total{export="192.168.1.1:/srv/test"} 0 1454node_mountstats_nfs_event_silly_rename_total{export="192.168.1.1:/srv/test",protocol="tcp"} 0
1455node_mountstats_nfs_event_silly_rename_total{export="192.168.1.1:/srv/test",protocol="udp"} 0
1443# HELP node_mountstats_nfs_event_truncation_total Number of times files have been truncated. 1456# HELP node_mountstats_nfs_event_truncation_total Number of times files have been truncated.
1444# TYPE node_mountstats_nfs_event_truncation_total counter 1457# TYPE node_mountstats_nfs_event_truncation_total counter
1445node_mountstats_nfs_event_truncation_total{export="192.168.1.1:/srv/test"} 0 1458node_mountstats_nfs_event_truncation_total{export="192.168.1.1:/srv/test",protocol="tcp"} 0
1459node_mountstats_nfs_event_truncation_total{export="192.168.1.1:/srv/test",protocol="udp"} 0
1446# HELP node_mountstats_nfs_event_vfs_access_total Number of times permissions have been checked. 1460# HELP node_mountstats_nfs_event_vfs_access_total Number of times permissions have been checked.
1447# TYPE node_mountstats_nfs_event_vfs_access_total counter 1461# TYPE node_mountstats_nfs_event_vfs_access_total counter
1448node_mountstats_nfs_event_vfs_access_total{export="192.168.1.1:/srv/test"} 398 1462node_mountstats_nfs_event_vfs_access_total{export="192.168.1.1:/srv/test",protocol="tcp"} 398
1463node_mountstats_nfs_event_vfs_access_total{export="192.168.1.1:/srv/test",protocol="udp"} 398
1449# HELP node_mountstats_nfs_event_vfs_file_release_total Number of times files have been closed and released. 1464# HELP node_mountstats_nfs_event_vfs_file_release_total Number of times files have been closed and released.
1450# TYPE node_mountstats_nfs_event_vfs_file_release_total counter 1465# TYPE node_mountstats_nfs_event_vfs_file_release_total counter
1451node_mountstats_nfs_event_vfs_file_release_total{export="192.168.1.1:/srv/test"} 77 1466node_mountstats_nfs_event_vfs_file_release_total{export="192.168.1.1:/srv/test",protocol="tcp"} 77
1467node_mountstats_nfs_event_vfs_file_release_total{export="192.168.1.1:/srv/test",protocol="udp"} 77
1452# HELP node_mountstats_nfs_event_vfs_flush_total Number of pending writes that have been forcefully flushed to the server. 1468# HELP node_mountstats_nfs_event_vfs_flush_total Number of pending writes that have been forcefully flushed to the server.
1453# TYPE node_mountstats_nfs_event_vfs_flush_total counter 1469# TYPE node_mountstats_nfs_event_vfs_flush_total counter
1454node_mountstats_nfs_event_vfs_flush_total{export="192.168.1.1:/srv/test"} 77 1470node_mountstats_nfs_event_vfs_flush_total{export="192.168.1.1:/srv/test",protocol="tcp"} 77
1471node_mountstats_nfs_event_vfs_flush_total{export="192.168.1.1:/srv/test",protocol="udp"} 77
1455# HELP node_mountstats_nfs_event_vfs_fsync_total Number of times fsync() has been called on directories and files. 1472# HELP node_mountstats_nfs_event_vfs_fsync_total Number of times fsync() has been called on directories and files.
1456# TYPE node_mountstats_nfs_event_vfs_fsync_total counter 1473# TYPE node_mountstats_nfs_event_vfs_fsync_total counter
1457node_mountstats_nfs_event_vfs_fsync_total{export="192.168.1.1:/srv/test"} 0 1474node_mountstats_nfs_event_vfs_fsync_total{export="192.168.1.1:/srv/test",protocol="tcp"} 0
1475node_mountstats_nfs_event_vfs_fsync_total{export="192.168.1.1:/srv/test",protocol="udp"} 0
1458# HELP node_mountstats_nfs_event_vfs_getdents_total Number of times directory entries have been read with getdents(). 1476# HELP node_mountstats_nfs_event_vfs_getdents_total Number of times directory entries have been read with getdents().
1459# TYPE node_mountstats_nfs_event_vfs_getdents_total counter 1477# TYPE node_mountstats_nfs_event_vfs_getdents_total counter
1460node_mountstats_nfs_event_vfs_getdents_total{export="192.168.1.1:/srv/test"} 0 1478node_mountstats_nfs_event_vfs_getdents_total{export="192.168.1.1:/srv/test",protocol="tcp"} 0
1479node_mountstats_nfs_event_vfs_getdents_total{export="192.168.1.1:/srv/test",protocol="udp"} 0
1461# HELP node_mountstats_nfs_event_vfs_lock_total Number of times locking has been attempted on a file. 1480# HELP node_mountstats_nfs_event_vfs_lock_total Number of times locking has been attempted on a file.
1462# TYPE node_mountstats_nfs_event_vfs_lock_total counter 1481# TYPE node_mountstats_nfs_event_vfs_lock_total counter
1463node_mountstats_nfs_event_vfs_lock_total{export="192.168.1.1:/srv/test"} 0 1482node_mountstats_nfs_event_vfs_lock_total{export="192.168.1.1:/srv/test",protocol="tcp"} 0
1483node_mountstats_nfs_event_vfs_lock_total{export="192.168.1.1:/srv/test",protocol="udp"} 0
1464# HELP node_mountstats_nfs_event_vfs_lookup_total Number of times a directory lookup has occurred. 1484# HELP node_mountstats_nfs_event_vfs_lookup_total Number of times a directory lookup has occurred.
1465# TYPE node_mountstats_nfs_event_vfs_lookup_total counter 1485# TYPE node_mountstats_nfs_event_vfs_lookup_total counter
1466node_mountstats_nfs_event_vfs_lookup_total{export="192.168.1.1:/srv/test"} 13 1486node_mountstats_nfs_event_vfs_lookup_total{export="192.168.1.1:/srv/test",protocol="tcp"} 13
1487node_mountstats_nfs_event_vfs_lookup_total{export="192.168.1.1:/srv/test",protocol="udp"} 13
1467# HELP node_mountstats_nfs_event_vfs_open_total Number of times cached inode attributes are invalidated. 1488# HELP node_mountstats_nfs_event_vfs_open_total Number of times cached inode attributes are invalidated.
1468# TYPE node_mountstats_nfs_event_vfs_open_total counter 1489# TYPE node_mountstats_nfs_event_vfs_open_total counter
1469node_mountstats_nfs_event_vfs_open_total{export="192.168.1.1:/srv/test"} 1 1490node_mountstats_nfs_event_vfs_open_total{export="192.168.1.1:/srv/test",protocol="tcp"} 1
1491node_mountstats_nfs_event_vfs_open_total{export="192.168.1.1:/srv/test",protocol="udp"} 1
1470# HELP node_mountstats_nfs_event_vfs_read_page_total Number of pages read directly via mmap()'d files. 1492# HELP node_mountstats_nfs_event_vfs_read_page_total Number of pages read directly via mmap()'d files.
1471# TYPE node_mountstats_nfs_event_vfs_read_page_total counter 1493# TYPE node_mountstats_nfs_event_vfs_read_page_total counter
1472node_mountstats_nfs_event_vfs_read_page_total{export="192.168.1.1:/srv/test"} 0 1494node_mountstats_nfs_event_vfs_read_page_total{export="192.168.1.1:/srv/test",protocol="tcp"} 0
1495node_mountstats_nfs_event_vfs_read_page_total{export="192.168.1.1:/srv/test",protocol="udp"} 0
1473# HELP node_mountstats_nfs_event_vfs_read_pages_total Number of times a group of pages have been read. 1496# HELP node_mountstats_nfs_event_vfs_read_pages_total Number of times a group of pages have been read.
1474# TYPE node_mountstats_nfs_event_vfs_read_pages_total counter 1497# TYPE node_mountstats_nfs_event_vfs_read_pages_total counter
1475node_mountstats_nfs_event_vfs_read_pages_total{export="192.168.1.1:/srv/test"} 331 1498node_mountstats_nfs_event_vfs_read_pages_total{export="192.168.1.1:/srv/test",protocol="tcp"} 331
1499node_mountstats_nfs_event_vfs_read_pages_total{export="192.168.1.1:/srv/test",protocol="udp"} 331
1476# HELP node_mountstats_nfs_event_vfs_setattr_total Number of times directory entries have been read with getdents(). 1500# HELP node_mountstats_nfs_event_vfs_setattr_total Number of times directory entries have been read with getdents().
1477# TYPE node_mountstats_nfs_event_vfs_setattr_total counter 1501# TYPE node_mountstats_nfs_event_vfs_setattr_total counter
1478node_mountstats_nfs_event_vfs_setattr_total{export="192.168.1.1:/srv/test"} 0 1502node_mountstats_nfs_event_vfs_setattr_total{export="192.168.1.1:/srv/test",protocol="tcp"} 0
1503node_mountstats_nfs_event_vfs_setattr_total{export="192.168.1.1:/srv/test",protocol="udp"} 0
1479# HELP node_mountstats_nfs_event_vfs_update_page_total Number of updates (and potential writes) to pages. 1504# HELP node_mountstats_nfs_event_vfs_update_page_total Number of updates (and potential writes) to pages.
1480# TYPE node_mountstats_nfs_event_vfs_update_page_total counter 1505# TYPE node_mountstats_nfs_event_vfs_update_page_total counter
1481node_mountstats_nfs_event_vfs_update_page_total{export="192.168.1.1:/srv/test"} 0 1506node_mountstats_nfs_event_vfs_update_page_total{export="192.168.1.1:/srv/test",protocol="tcp"} 0
1507node_mountstats_nfs_event_vfs_update_page_total{export="192.168.1.1:/srv/test",protocol="udp"} 0
1482# HELP node_mountstats_nfs_event_vfs_write_page_total Number of pages written directly via mmap()'d files. 1508# HELP node_mountstats_nfs_event_vfs_write_page_total Number of pages written directly via mmap()'d files.
1483# TYPE node_mountstats_nfs_event_vfs_write_page_total counter 1509# TYPE node_mountstats_nfs_event_vfs_write_page_total counter
1484node_mountstats_nfs_event_vfs_write_page_total{export="192.168.1.1:/srv/test"} 0 1510node_mountstats_nfs_event_vfs_write_page_total{export="192.168.1.1:/srv/test",protocol="tcp"} 0
1511node_mountstats_nfs_event_vfs_write_page_total{export="192.168.1.1:/srv/test",protocol="udp"} 0
1485# HELP node_mountstats_nfs_event_vfs_write_pages_total Number of times a group of pages have been written. 1512# HELP node_mountstats_nfs_event_vfs_write_pages_total Number of times a group of pages have been written.
1486# TYPE node_mountstats_nfs_event_vfs_write_pages_total counter 1513# TYPE node_mountstats_nfs_event_vfs_write_pages_total counter
1487node_mountstats_nfs_event_vfs_write_pages_total{export="192.168.1.1:/srv/test"} 47 1514node_mountstats_nfs_event_vfs_write_pages_total{export="192.168.1.1:/srv/test",protocol="tcp"} 47
1515node_mountstats_nfs_event_vfs_write_pages_total{export="192.168.1.1:/srv/test",protocol="udp"} 47
1488# HELP node_mountstats_nfs_event_write_extension_total Number of times a file has been grown due to writes beyond its existing end. 1516# HELP node_mountstats_nfs_event_write_extension_total Number of times a file has been grown due to writes beyond its existing end.
1489# TYPE node_mountstats_nfs_event_write_extension_total counter 1517# TYPE node_mountstats_nfs_event_write_extension_total counter
1490node_mountstats_nfs_event_write_extension_total{export="192.168.1.1:/srv/test"} 0 1518node_mountstats_nfs_event_write_extension_total{export="192.168.1.1:/srv/test",protocol="tcp"} 0
1519node_mountstats_nfs_event_write_extension_total{export="192.168.1.1:/srv/test",protocol="udp"} 0
1491# HELP node_mountstats_nfs_operations_major_timeouts_total Number of times a request has had a major timeout for a given operation. 1520# HELP node_mountstats_nfs_operations_major_timeouts_total Number of times a request has had a major timeout for a given operation.
1492# TYPE node_mountstats_nfs_operations_major_timeouts_total counter 1521# TYPE node_mountstats_nfs_operations_major_timeouts_total counter
1493node_mountstats_nfs_operations_major_timeouts_total{export="192.168.1.1:/srv/test",operation="NULL"} 0 1522node_mountstats_nfs_operations_major_timeouts_total{export="192.168.1.1:/srv/test",operation="NULL",protocol="tcp"} 0
1494node_mountstats_nfs_operations_major_timeouts_total{export="192.168.1.1:/srv/test",operation="READ"} 0 1523node_mountstats_nfs_operations_major_timeouts_total{export="192.168.1.1:/srv/test",operation="NULL",protocol="udp"} 0
1495node_mountstats_nfs_operations_major_timeouts_total{export="192.168.1.1:/srv/test",operation="WRITE"} 0 1524node_mountstats_nfs_operations_major_timeouts_total{export="192.168.1.1:/srv/test",operation="READ",protocol="tcp"} 0
1525node_mountstats_nfs_operations_major_timeouts_total{export="192.168.1.1:/srv/test",operation="READ",protocol="udp"} 0
1526node_mountstats_nfs_operations_major_timeouts_total{export="192.168.1.1:/srv/test",operation="WRITE",protocol="tcp"} 0
1527node_mountstats_nfs_operations_major_timeouts_total{export="192.168.1.1:/srv/test",operation="WRITE",protocol="udp"} 0
1496# HELP node_mountstats_nfs_operations_queue_time_seconds_total Duration all requests spent queued for transmission for a given operation before they were sent, in seconds. 1528# HELP node_mountstats_nfs_operations_queue_time_seconds_total Duration all requests spent queued for transmission for a given operation before they were sent, in seconds.
1497# TYPE node_mountstats_nfs_operations_queue_time_seconds_total counter 1529# TYPE node_mountstats_nfs_operations_queue_time_seconds_total counter
1498node_mountstats_nfs_operations_queue_time_seconds_total{export="192.168.1.1:/srv/test",operation="NULL"} 0 1530node_mountstats_nfs_operations_queue_time_seconds_total{export="192.168.1.1:/srv/test",operation="NULL",protocol="tcp"} 0
1499node_mountstats_nfs_operations_queue_time_seconds_total{export="192.168.1.1:/srv/test",operation="READ"} 0.006 1531node_mountstats_nfs_operations_queue_time_seconds_total{export="192.168.1.1:/srv/test",operation="NULL",protocol="udp"} 0
1500node_mountstats_nfs_operations_queue_time_seconds_total{export="192.168.1.1:/srv/test",operation="WRITE"} 0 1532node_mountstats_nfs_operations_queue_time_seconds_total{export="192.168.1.1:/srv/test",operation="READ",protocol="tcp"} 0.006
1533node_mountstats_nfs_operations_queue_time_seconds_total{export="192.168.1.1:/srv/test",operation="READ",protocol="udp"} 0.006
1534node_mountstats_nfs_operations_queue_time_seconds_total{export="192.168.1.1:/srv/test",operation="WRITE",protocol="tcp"} 0
1535node_mountstats_nfs_operations_queue_time_seconds_total{export="192.168.1.1:/srv/test",operation="WRITE",protocol="udp"} 0
1501# HELP node_mountstats_nfs_operations_received_bytes_total Number of bytes received for a given operation, including RPC headers and payload. 1536# HELP node_mountstats_nfs_operations_received_bytes_total Number of bytes received for a given operation, including RPC headers and payload.
1502# TYPE node_mountstats_nfs_operations_received_bytes_total counter 1537# TYPE node_mountstats_nfs_operations_received_bytes_total counter
1503node_mountstats_nfs_operations_received_bytes_total{export="192.168.1.1:/srv/test",operation="NULL"} 0 1538node_mountstats_nfs_operations_received_bytes_total{export="192.168.1.1:/srv/test",operation="NULL",protocol="tcp"} 0
1504node_mountstats_nfs_operations_received_bytes_total{export="192.168.1.1:/srv/test",operation="READ"} 1.210292152e+09 1539node_mountstats_nfs_operations_received_bytes_total{export="192.168.1.1:/srv/test",operation="NULL",protocol="udp"} 0
1505node_mountstats_nfs_operations_received_bytes_total{export="192.168.1.1:/srv/test",operation="WRITE"} 0 1540node_mountstats_nfs_operations_received_bytes_total{export="192.168.1.1:/srv/test",operation="READ",protocol="tcp"} 1.210292152e+09
1541node_mountstats_nfs_operations_received_bytes_total{export="192.168.1.1:/srv/test",operation="READ",protocol="udp"} 1.210292152e+09
1542node_mountstats_nfs_operations_received_bytes_total{export="192.168.1.1:/srv/test",operation="WRITE",protocol="tcp"} 0
1543node_mountstats_nfs_operations_received_bytes_total{export="192.168.1.1:/srv/test",operation="WRITE",protocol="udp"} 0
1506# HELP node_mountstats_nfs_operations_request_time_seconds_total Duration all requests took from when a request was enqueued to when it was completely handled for a given operation, in seconds. 1544# HELP node_mountstats_nfs_operations_request_time_seconds_total Duration all requests took from when a request was enqueued to when it was completely handled for a given operation, in seconds.
1507# TYPE node_mountstats_nfs_operations_request_time_seconds_total counter 1545# TYPE node_mountstats_nfs_operations_request_time_seconds_total counter
1508node_mountstats_nfs_operations_request_time_seconds_total{export="192.168.1.1:/srv/test",operation="NULL"} 0 1546node_mountstats_nfs_operations_request_time_seconds_total{export="192.168.1.1:/srv/test",operation="NULL",protocol="tcp"} 0
1509node_mountstats_nfs_operations_request_time_seconds_total{export="192.168.1.1:/srv/test",operation="READ"} 79.407 1547node_mountstats_nfs_operations_request_time_seconds_total{export="192.168.1.1:/srv/test",operation="NULL",protocol="udp"} 0
1510node_mountstats_nfs_operations_request_time_seconds_total{export="192.168.1.1:/srv/test",operation="WRITE"} 0 1548node_mountstats_nfs_operations_request_time_seconds_total{export="192.168.1.1:/srv/test",operation="READ",protocol="tcp"} 79.407
1549node_mountstats_nfs_operations_request_time_seconds_total{export="192.168.1.1:/srv/test",operation="READ",protocol="udp"} 79.407
1550node_mountstats_nfs_operations_request_time_seconds_total{export="192.168.1.1:/srv/test",operation="WRITE",protocol="tcp"} 0
1551node_mountstats_nfs_operations_request_time_seconds_total{export="192.168.1.1:/srv/test",operation="WRITE",protocol="udp"} 0
1511# HELP node_mountstats_nfs_operations_requests_total Number of requests performed for a given operation. 1552# HELP node_mountstats_nfs_operations_requests_total Number of requests performed for a given operation.
1512# TYPE node_mountstats_nfs_operations_requests_total counter 1553# TYPE node_mountstats_nfs_operations_requests_total counter
1513node_mountstats_nfs_operations_requests_total{export="192.168.1.1:/srv/test",operation="NULL"} 0 1554node_mountstats_nfs_operations_requests_total{export="192.168.1.1:/srv/test",operation="NULL",protocol="tcp"} 0
1514node_mountstats_nfs_operations_requests_total{export="192.168.1.1:/srv/test",operation="READ"} 1298 1555node_mountstats_nfs_operations_requests_total{export="192.168.1.1:/srv/test",operation="NULL",protocol="udp"} 0
1515node_mountstats_nfs_operations_requests_total{export="192.168.1.1:/srv/test",operation="WRITE"} 0 1556node_mountstats_nfs_operations_requests_total{export="192.168.1.1:/srv/test",operation="READ",protocol="tcp"} 1298
1557node_mountstats_nfs_operations_requests_total{export="192.168.1.1:/srv/test",operation="READ",protocol="udp"} 1298
1558node_mountstats_nfs_operations_requests_total{export="192.168.1.1:/srv/test",operation="WRITE",protocol="tcp"} 0
1559node_mountstats_nfs_operations_requests_total{export="192.168.1.1:/srv/test",operation="WRITE",protocol="udp"} 0
1516# HELP node_mountstats_nfs_operations_response_time_seconds_total Duration all requests took to get a reply back after a request for a given operation was transmitted, in seconds. 1560# HELP node_mountstats_nfs_operations_response_time_seconds_total Duration all requests took to get a reply back after a request for a given operation was transmitted, in seconds.
1517# TYPE node_mountstats_nfs_operations_response_time_seconds_total counter 1561# TYPE node_mountstats_nfs_operations_response_time_seconds_total counter
1518node_mountstats_nfs_operations_response_time_seconds_total{export="192.168.1.1:/srv/test",operation="NULL"} 0 1562node_mountstats_nfs_operations_response_time_seconds_total{export="192.168.1.1:/srv/test",operation="NULL",protocol="tcp"} 0
1519node_mountstats_nfs_operations_response_time_seconds_total{export="192.168.1.1:/srv/test",operation="READ"} 79.386 1563node_mountstats_nfs_operations_response_time_seconds_total{export="192.168.1.1:/srv/test",operation="NULL",protocol="udp"} 0
1520node_mountstats_nfs_operations_response_time_seconds_total{export="192.168.1.1:/srv/test",operation="WRITE"} 0 1564node_mountstats_nfs_operations_response_time_seconds_total{export="192.168.1.1:/srv/test",operation="READ",protocol="tcp"} 79.386
1565node_mountstats_nfs_operations_response_time_seconds_total{export="192.168.1.1:/srv/test",operation="READ",protocol="udp"} 79.386
1566node_mountstats_nfs_operations_response_time_seconds_total{export="192.168.1.1:/srv/test",operation="WRITE",protocol="tcp"} 0
1567node_mountstats_nfs_operations_response_time_seconds_total{export="192.168.1.1:/srv/test",operation="WRITE",protocol="udp"} 0
1521# HELP node_mountstats_nfs_operations_sent_bytes_total Number of bytes sent for a given operation, including RPC headers and payload. 1568# HELP node_mountstats_nfs_operations_sent_bytes_total Number of bytes sent for a given operation, including RPC headers and payload.
1522# TYPE node_mountstats_nfs_operations_sent_bytes_total counter 1569# TYPE node_mountstats_nfs_operations_sent_bytes_total counter
1523node_mountstats_nfs_operations_sent_bytes_total{export="192.168.1.1:/srv/test",operation="NULL"} 0 1570node_mountstats_nfs_operations_sent_bytes_total{export="192.168.1.1:/srv/test",operation="NULL",protocol="tcp"} 0
1524node_mountstats_nfs_operations_sent_bytes_total{export="192.168.1.1:/srv/test",operation="READ"} 207680 1571node_mountstats_nfs_operations_sent_bytes_total{export="192.168.1.1:/srv/test",operation="NULL",protocol="udp"} 0
1525node_mountstats_nfs_operations_sent_bytes_total{export="192.168.1.1:/srv/test",operation="WRITE"} 0 1572node_mountstats_nfs_operations_sent_bytes_total{export="192.168.1.1:/srv/test",operation="READ",protocol="tcp"} 207680
1573node_mountstats_nfs_operations_sent_bytes_total{export="192.168.1.1:/srv/test",operation="READ",protocol="udp"} 207680
1574node_mountstats_nfs_operations_sent_bytes_total{export="192.168.1.1:/srv/test",operation="WRITE",protocol="tcp"} 0
1575node_mountstats_nfs_operations_sent_bytes_total{export="192.168.1.1:/srv/test",operation="WRITE",protocol="udp"} 0
1526# HELP node_mountstats_nfs_operations_transmissions_total Number of times an actual RPC request has been transmitted for a given operation. 1576# HELP node_mountstats_nfs_operations_transmissions_total Number of times an actual RPC request has been transmitted for a given operation.
1527# TYPE node_mountstats_nfs_operations_transmissions_total counter 1577# TYPE node_mountstats_nfs_operations_transmissions_total counter
1528node_mountstats_nfs_operations_transmissions_total{export="192.168.1.1:/srv/test",operation="NULL"} 0 1578node_mountstats_nfs_operations_transmissions_total{export="192.168.1.1:/srv/test",operation="NULL",protocol="tcp"} 0
1529node_mountstats_nfs_operations_transmissions_total{export="192.168.1.1:/srv/test",operation="READ"} 1298 1579node_mountstats_nfs_operations_transmissions_total{export="192.168.1.1:/srv/test",operation="NULL",protocol="udp"} 0
1530node_mountstats_nfs_operations_transmissions_total{export="192.168.1.1:/srv/test",operation="WRITE"} 0 1580node_mountstats_nfs_operations_transmissions_total{export="192.168.1.1:/srv/test",operation="READ",protocol="tcp"} 1298
1581node_mountstats_nfs_operations_transmissions_total{export="192.168.1.1:/srv/test",operation="READ",protocol="udp"} 1298
1582node_mountstats_nfs_operations_transmissions_total{export="192.168.1.1:/srv/test",operation="WRITE",protocol="tcp"} 0
1583node_mountstats_nfs_operations_transmissions_total{export="192.168.1.1:/srv/test",operation="WRITE",protocol="udp"} 0
1531# HELP node_mountstats_nfs_read_bytes_total Number of bytes read using the read() syscall. 1584# HELP node_mountstats_nfs_read_bytes_total Number of bytes read using the read() syscall.
1532# TYPE node_mountstats_nfs_read_bytes_total counter 1585# TYPE node_mountstats_nfs_read_bytes_total counter
1533node_mountstats_nfs_read_bytes_total{export="192.168.1.1:/srv/test"} 1.20764023e+09 1586node_mountstats_nfs_read_bytes_total{export="192.168.1.1:/srv/test",protocol="tcp"} 1.20764023e+09
1587node_mountstats_nfs_read_bytes_total{export="192.168.1.1:/srv/test",protocol="udp"} 1.20764023e+09
1534# HELP node_mountstats_nfs_read_pages_total Number of pages read directly via mmap()'d files. 1588# HELP node_mountstats_nfs_read_pages_total Number of pages read directly via mmap()'d files.
1535# TYPE node_mountstats_nfs_read_pages_total counter 1589# TYPE node_mountstats_nfs_read_pages_total counter
1536node_mountstats_nfs_read_pages_total{export="192.168.1.1:/srv/test"} 295483 1590node_mountstats_nfs_read_pages_total{export="192.168.1.1:/srv/test",protocol="tcp"} 295483
1591node_mountstats_nfs_read_pages_total{export="192.168.1.1:/srv/test",protocol="udp"} 295483
1537# HELP node_mountstats_nfs_total_read_bytes_total Number of bytes read from the NFS server, in total. 1592# HELP node_mountstats_nfs_total_read_bytes_total Number of bytes read from the NFS server, in total.
1538# TYPE node_mountstats_nfs_total_read_bytes_total counter 1593# TYPE node_mountstats_nfs_total_read_bytes_total counter
1539node_mountstats_nfs_total_read_bytes_total{export="192.168.1.1:/srv/test"} 1.210214218e+09 1594node_mountstats_nfs_total_read_bytes_total{export="192.168.1.1:/srv/test",protocol="tcp"} 1.210214218e+09
1595node_mountstats_nfs_total_read_bytes_total{export="192.168.1.1:/srv/test",protocol="udp"} 1.210214218e+09
1540# HELP node_mountstats_nfs_total_write_bytes_total Number of bytes written to the NFS server, in total. 1596# HELP node_mountstats_nfs_total_write_bytes_total Number of bytes written to the NFS server, in total.
1541# TYPE node_mountstats_nfs_total_write_bytes_total counter 1597# TYPE node_mountstats_nfs_total_write_bytes_total counter
1542node_mountstats_nfs_total_write_bytes_total{export="192.168.1.1:/srv/test"} 0 1598node_mountstats_nfs_total_write_bytes_total{export="192.168.1.1:/srv/test",protocol="tcp"} 0
1599node_mountstats_nfs_total_write_bytes_total{export="192.168.1.1:/srv/test",protocol="udp"} 0
1543# HELP node_mountstats_nfs_transport_backlog_queue_total Total number of items added to the RPC backlog queue. 1600# HELP node_mountstats_nfs_transport_backlog_queue_total Total number of items added to the RPC backlog queue.
1544# TYPE node_mountstats_nfs_transport_backlog_queue_total counter 1601# TYPE node_mountstats_nfs_transport_backlog_queue_total counter
1545node_mountstats_nfs_transport_backlog_queue_total{export="192.168.1.1:/srv/test"} 0 1602node_mountstats_nfs_transport_backlog_queue_total{export="192.168.1.1:/srv/test",protocol="tcp"} 0
1603node_mountstats_nfs_transport_backlog_queue_total{export="192.168.1.1:/srv/test",protocol="udp"} 0
1546# HELP node_mountstats_nfs_transport_bad_transaction_ids_total Number of times the NFS server sent a response with a transaction ID unknown to this client. 1604# HELP node_mountstats_nfs_transport_bad_transaction_ids_total Number of times the NFS server sent a response with a transaction ID unknown to this client.
1547# TYPE node_mountstats_nfs_transport_bad_transaction_ids_total counter 1605# TYPE node_mountstats_nfs_transport_bad_transaction_ids_total counter
1548node_mountstats_nfs_transport_bad_transaction_ids_total{export="192.168.1.1:/srv/test"} 0 1606node_mountstats_nfs_transport_bad_transaction_ids_total{export="192.168.1.1:/srv/test",protocol="tcp"} 0
1607node_mountstats_nfs_transport_bad_transaction_ids_total{export="192.168.1.1:/srv/test",protocol="udp"} 0
1549# HELP node_mountstats_nfs_transport_bind_total Number of times the client has had to establish a connection from scratch to the NFS server. 1608# HELP node_mountstats_nfs_transport_bind_total Number of times the client has had to establish a connection from scratch to the NFS server.
1550# TYPE node_mountstats_nfs_transport_bind_total counter 1609# TYPE node_mountstats_nfs_transport_bind_total counter
1551node_mountstats_nfs_transport_bind_total{export="192.168.1.1:/srv/test"} 0 1610node_mountstats_nfs_transport_bind_total{export="192.168.1.1:/srv/test",protocol="tcp"} 0
1611node_mountstats_nfs_transport_bind_total{export="192.168.1.1:/srv/test",protocol="udp"} 0
1552# HELP node_mountstats_nfs_transport_connect_total Number of times the client has made a TCP connection to the NFS server. 1612# HELP node_mountstats_nfs_transport_connect_total Number of times the client has made a TCP connection to the NFS server.
1553# TYPE node_mountstats_nfs_transport_connect_total counter 1613# TYPE node_mountstats_nfs_transport_connect_total counter
1554node_mountstats_nfs_transport_connect_total{export="192.168.1.1:/srv/test"} 1 1614node_mountstats_nfs_transport_connect_total{export="192.168.1.1:/srv/test",protocol="tcp"} 1
1615node_mountstats_nfs_transport_connect_total{export="192.168.1.1:/srv/test",protocol="udp"} 0
1555# HELP node_mountstats_nfs_transport_idle_time_seconds Duration since the NFS mount last saw any RPC traffic, in seconds. 1616# HELP node_mountstats_nfs_transport_idle_time_seconds Duration since the NFS mount last saw any RPC traffic, in seconds.
1556# TYPE node_mountstats_nfs_transport_idle_time_seconds gauge 1617# TYPE node_mountstats_nfs_transport_idle_time_seconds gauge
1557node_mountstats_nfs_transport_idle_time_seconds{export="192.168.1.1:/srv/test"} 11 1618node_mountstats_nfs_transport_idle_time_seconds{export="192.168.1.1:/srv/test",protocol="tcp"} 11
1619node_mountstats_nfs_transport_idle_time_seconds{export="192.168.1.1:/srv/test",protocol="udp"} 0
1558# HELP node_mountstats_nfs_transport_maximum_rpc_slots Maximum number of simultaneously active RPC requests ever used. 1620# HELP node_mountstats_nfs_transport_maximum_rpc_slots Maximum number of simultaneously active RPC requests ever used.
1559# TYPE node_mountstats_nfs_transport_maximum_rpc_slots gauge 1621# TYPE node_mountstats_nfs_transport_maximum_rpc_slots gauge
1560node_mountstats_nfs_transport_maximum_rpc_slots{export="192.168.1.1:/srv/test"} 24 1622node_mountstats_nfs_transport_maximum_rpc_slots{export="192.168.1.1:/srv/test",protocol="tcp"} 24
1623node_mountstats_nfs_transport_maximum_rpc_slots{export="192.168.1.1:/srv/test",protocol="udp"} 24
1561# HELP node_mountstats_nfs_transport_pending_queue_total Total number of items added to the RPC transmission pending queue. 1624# HELP node_mountstats_nfs_transport_pending_queue_total Total number of items added to the RPC transmission pending queue.
1562# TYPE node_mountstats_nfs_transport_pending_queue_total counter 1625# TYPE node_mountstats_nfs_transport_pending_queue_total counter
1563node_mountstats_nfs_transport_pending_queue_total{export="192.168.1.1:/srv/test"} 5726 1626node_mountstats_nfs_transport_pending_queue_total{export="192.168.1.1:/srv/test",protocol="tcp"} 5726
1627node_mountstats_nfs_transport_pending_queue_total{export="192.168.1.1:/srv/test",protocol="udp"} 5726
1564# HELP node_mountstats_nfs_transport_receives_total Number of RPC responses for this mount received from the NFS server. 1628# HELP node_mountstats_nfs_transport_receives_total Number of RPC responses for this mount received from the NFS server.
1565# TYPE node_mountstats_nfs_transport_receives_total counter 1629# TYPE node_mountstats_nfs_transport_receives_total counter
1566node_mountstats_nfs_transport_receives_total{export="192.168.1.1:/srv/test"} 6428 1630node_mountstats_nfs_transport_receives_total{export="192.168.1.1:/srv/test",protocol="tcp"} 6428
1631node_mountstats_nfs_transport_receives_total{export="192.168.1.1:/srv/test",protocol="udp"} 6428
1567# HELP node_mountstats_nfs_transport_sending_queue_total Total number of items added to the RPC transmission sending queue. 1632# HELP node_mountstats_nfs_transport_sending_queue_total Total number of items added to the RPC transmission sending queue.
1568# TYPE node_mountstats_nfs_transport_sending_queue_total counter 1633# TYPE node_mountstats_nfs_transport_sending_queue_total counter
1569node_mountstats_nfs_transport_sending_queue_total{export="192.168.1.1:/srv/test"} 26 1634node_mountstats_nfs_transport_sending_queue_total{export="192.168.1.1:/srv/test",protocol="tcp"} 26
1635node_mountstats_nfs_transport_sending_queue_total{export="192.168.1.1:/srv/test",protocol="udp"} 26
1570# HELP node_mountstats_nfs_transport_sends_total Number of RPC requests for this mount sent to the NFS server. 1636# HELP node_mountstats_nfs_transport_sends_total Number of RPC requests for this mount sent to the NFS server.
1571# TYPE node_mountstats_nfs_transport_sends_total counter 1637# TYPE node_mountstats_nfs_transport_sends_total counter
1572node_mountstats_nfs_transport_sends_total{export="192.168.1.1:/srv/test"} 6428 1638node_mountstats_nfs_transport_sends_total{export="192.168.1.1:/srv/test",protocol="tcp"} 6428
1639node_mountstats_nfs_transport_sends_total{export="192.168.1.1:/srv/test",protocol="udp"} 6428
1573# HELP node_mountstats_nfs_write_bytes_total Number of bytes written using the write() syscall. 1640# HELP node_mountstats_nfs_write_bytes_total Number of bytes written using the write() syscall.
1574# TYPE node_mountstats_nfs_write_bytes_total counter 1641# TYPE node_mountstats_nfs_write_bytes_total counter
1575node_mountstats_nfs_write_bytes_total{export="192.168.1.1:/srv/test"} 0 1642node_mountstats_nfs_write_bytes_total{export="192.168.1.1:/srv/test",protocol="tcp"} 0
1643node_mountstats_nfs_write_bytes_total{export="192.168.1.1:/srv/test",protocol="udp"} 0
1576# HELP node_mountstats_nfs_write_pages_total Number of pages written directly via mmap()'d files. 1644# HELP node_mountstats_nfs_write_pages_total Number of pages written directly via mmap()'d files.
1577# TYPE node_mountstats_nfs_write_pages_total counter 1645# TYPE node_mountstats_nfs_write_pages_total counter
1578node_mountstats_nfs_write_pages_total{export="192.168.1.1:/srv/test"} 0 1646node_mountstats_nfs_write_pages_total{export="192.168.1.1:/srv/test",protocol="tcp"} 0
1647node_mountstats_nfs_write_pages_total{export="192.168.1.1:/srv/test",protocol="udp"} 0
1579# HELP node_netstat_Icmp6_InErrors Statistic Icmp6InErrors. 1648# HELP node_netstat_Icmp6_InErrors Statistic Icmp6InErrors.
1580# TYPE node_netstat_Icmp6_InErrors untyped 1649# TYPE node_netstat_Icmp6_InErrors untyped
1581node_netstat_Icmp6_InErrors 0 1650node_netstat_Icmp6_InErrors 0
diff --git a/collector/fixtures/proc/10/mountstats b/collector/fixtures/proc/10/mountstats
index fdda676..ddddcd3 100644
--- a/collector/fixtures/proc/10/mountstats
+++ b/collector/fixtures/proc/10/mountstats
@@ -32,3 +32,17 @@ device 192.168.1.1:/srv/test mounted on /mnt/nfs/test-dupe with fstype nfs4 stat
32 READ: 1298 1298 0 207680 1210292152 6 79386 79407 32 READ: 1298 1298 0 207680 1210292152 6 79386 79407
33 WRITE: 0 0 0 0 0 0 0 0 33 WRITE: 0 0 0 0 0 0 0 0
34 34
35device 192.168.1.1:/srv/test mounted on /mnt/nfs/test-dupe with fstype nfs4 statvers=1.1
36 opts: rw,vers=4.0,rsize=1048576,wsize=1048576,namlen=255,acregmin=3,acregmax=60,acdirmin=30,acdirmax=60,hard,proto=udp,port=0,timeo=600,retrans=2,sec=sys,clientaddr=192.168.1.5,local_lock=none
37 age: 13968
38 caps: caps=0xfff7,wtmult=512,dtsize=32768,bsize=0,namlen=255
39 nfsv4: bm0=0xfdffafff,bm1=0xf9be3e,bm2=0x0,acl=0x0,pnfs=not configured
40 sec: flavor=1,pseudoflavor=1
41 events: 52 226 0 0 1 13 398 0 0 331 0 47 0 0 77 0 0 77 0 0 0 0 0 0 0 0 0
42 bytes: 1207640230 0 0 0 1210214218 0 295483 0
43 RPC iostats version: 1.0 p/v: 100003/4 (nfs)
44 xprt: udp 832 0 6428 6428 0 12154 0 24 26 5726
45 per-op statistics
46 NULL: 0 0 0 0 0 0 0 0
47 READ: 1298 1298 0 207680 1210292152 6 79386 79407
48 WRITE: 0 0 0 0 0 0 0 0
diff --git a/collector/mountstats_linux.go b/collector/mountstats_linux.go
index 62e715d..561c7aa 100644
--- a/collector/mountstats_linux.go
+++ b/collector/mountstats_linux.go
@@ -15,7 +15,6 @@ package collector
15 15
16import ( 16import (
17 "fmt" 17 "fmt"
18 "sort"
19 18
20 "github.com/prometheus/client_golang/prometheus" 19 "github.com/prometheus/client_golang/prometheus"
21 "github.com/prometheus/common/log" 20 "github.com/prometheus/common/log"
@@ -89,6 +88,12 @@ type mountStatsCollector struct {
89 proc procfs.Proc 88 proc procfs.Proc
90} 89}
91 90
91// used to uniquely identify an NFS mount to prevent duplicates
92type nfsDeviceIdentifier struct {
93 Device string
94 Protocol string
95}
96
92func init() { 97func init() {
93 registerCollector("mountstats", defaultDisabled, NewMountStatsCollector) 98 registerCollector("mountstats", defaultDisabled, NewMountStatsCollector)
94} 99}
@@ -111,8 +116,8 @@ func NewMountStatsCollector() (Collector, error) {
111 ) 116 )
112 117
113 var ( 118 var (
114 labels = []string{"export"} 119 labels = []string{"export", "protocol"}
115 opLabels = []string{"export", "operation"} 120 opLabels = []string{"export", "protocol", "operation"}
116 ) 121 )
117 122
118 return &mountStatsCollector{ 123 return &mountStatsCollector{
@@ -496,7 +501,9 @@ func (c *mountStatsCollector) Update(ch chan<- prometheus.Metric) error {
496 if err != nil { 501 if err != nil {
497 return fmt.Errorf("failed to parse mountstats: %v", err) 502 return fmt.Errorf("failed to parse mountstats: %v", err)
498 } 503 }
499 var deviceList []string 504
505 // store all seen nfsDeviceIdentifiers for deduplication
506 deviceList := make(map[nfsDeviceIdentifier]bool)
500 507
501 for _, m := range mounts { 508 for _, m := range mounts {
502 // For the time being, only NFS statistics are available via this mechanism 509 // For the time being, only NFS statistics are available via this mechanism
@@ -505,25 +512,27 @@ func (c *mountStatsCollector) Update(ch chan<- prometheus.Metric) error {
505 continue 512 continue
506 } 513 }
507 514
508 sort.Strings(deviceList) 515 deviceIdentifier := nfsDeviceIdentifier{m.Device, stats.Transport.Protocol}
509 i := sort.SearchStrings(deviceList, m.Device) 516 i := deviceList[deviceIdentifier]
510 if i < len(deviceList) && deviceList[i] == m.Device { 517 if i {
511 log.Debugf("Skipping duplicate device entry %q", m.Device) 518 log.Debugf("Skipping duplicate device entry %q", deviceIdentifier)
512 } else { 519 continue
513 deviceList = append(deviceList, m.Device)
514 c.updateNFSStats(ch, m.Device, stats)
515 } 520 }
521
522 deviceList[deviceIdentifier] = true
523 c.updateNFSStats(ch, m.Device, stats.Transport.Protocol, stats)
516 } 524 }
517 525
518 return nil 526 return nil
519} 527}
520 528
521func (c *mountStatsCollector) updateNFSStats(ch chan<- prometheus.Metric, export string, s *procfs.MountStatsNFS) { 529func (c *mountStatsCollector) updateNFSStats(ch chan<- prometheus.Metric, export string, protocol string, s *procfs.MountStatsNFS) {
522 ch <- prometheus.MustNewConstMetric( 530 ch <- prometheus.MustNewConstMetric(
523 c.NFSAgeSecondsTotal, 531 c.NFSAgeSecondsTotal,
524 prometheus.CounterValue, 532 prometheus.CounterValue,
525 s.Age.Seconds(), 533 s.Age.Seconds(),
526 export, 534 export,
535 protocol,
527 ) 536 )
528 537
529 ch <- prometheus.MustNewConstMetric( 538 ch <- prometheus.MustNewConstMetric(
@@ -531,6 +540,7 @@ func (c *mountStatsCollector) updateNFSStats(ch chan<- prometheus.Metric, export
531 prometheus.CounterValue, 540 prometheus.CounterValue,
532 float64(s.Bytes.Read), 541 float64(s.Bytes.Read),
533 export, 542 export,
543 protocol,
534 ) 544 )
535 545
536 ch <- prometheus.MustNewConstMetric( 546 ch <- prometheus.MustNewConstMetric(
@@ -538,6 +548,7 @@ func (c *mountStatsCollector) updateNFSStats(ch chan<- prometheus.Metric, export
538 prometheus.CounterValue, 548 prometheus.CounterValue,
539 float64(s.Bytes.Write), 549 float64(s.Bytes.Write),
540 export, 550 export,
551 protocol,
541 ) 552 )
542 553
543 ch <- prometheus.MustNewConstMetric( 554 ch <- prometheus.MustNewConstMetric(
@@ -545,6 +556,7 @@ func (c *mountStatsCollector) updateNFSStats(ch chan<- prometheus.Metric, export
545 prometheus.CounterValue, 556 prometheus.CounterValue,
546 float64(s.Bytes.DirectRead), 557 float64(s.Bytes.DirectRead),
547 export, 558 export,
559 protocol,
548 ) 560 )
549 561
550 ch <- prometheus.MustNewConstMetric( 562 ch <- prometheus.MustNewConstMetric(
@@ -552,6 +564,7 @@ func (c *mountStatsCollector) updateNFSStats(ch chan<- prometheus.Metric, export
552 prometheus.CounterValue, 564 prometheus.CounterValue,
553 float64(s.Bytes.DirectWrite), 565 float64(s.Bytes.DirectWrite),
554 export, 566 export,
567 protocol,
555 ) 568 )
556 569
557 ch <- prometheus.MustNewConstMetric( 570 ch <- prometheus.MustNewConstMetric(
@@ -559,6 +572,7 @@ func (c *mountStatsCollector) updateNFSStats(ch chan<- prometheus.Metric, export
559 prometheus.CounterValue, 572 prometheus.CounterValue,
560 float64(s.Bytes.ReadTotal), 573 float64(s.Bytes.ReadTotal),
561 export, 574 export,
575 protocol,
562 ) 576 )
563 577
564 ch <- prometheus.MustNewConstMetric( 578 ch <- prometheus.MustNewConstMetric(
@@ -566,6 +580,7 @@ func (c *mountStatsCollector) updateNFSStats(ch chan<- prometheus.Metric, export
566 prometheus.CounterValue, 580 prometheus.CounterValue,
567 float64(s.Bytes.WriteTotal), 581 float64(s.Bytes.WriteTotal),
568 export, 582 export,
583 protocol,
569 ) 584 )
570 585
571 ch <- prometheus.MustNewConstMetric( 586 ch <- prometheus.MustNewConstMetric(
@@ -573,6 +588,7 @@ func (c *mountStatsCollector) updateNFSStats(ch chan<- prometheus.Metric, export
573 prometheus.CounterValue, 588 prometheus.CounterValue,
574 float64(s.Bytes.ReadPages), 589 float64(s.Bytes.ReadPages),
575 export, 590 export,
591 protocol,
576 ) 592 )
577 593
578 ch <- prometheus.MustNewConstMetric( 594 ch <- prometheus.MustNewConstMetric(
@@ -580,6 +596,7 @@ func (c *mountStatsCollector) updateNFSStats(ch chan<- prometheus.Metric, export
580 prometheus.CounterValue, 596 prometheus.CounterValue,
581 float64(s.Bytes.WritePages), 597 float64(s.Bytes.WritePages),
582 export, 598 export,
599 protocol,
583 ) 600 )
584 601
585 ch <- prometheus.MustNewConstMetric( 602 ch <- prometheus.MustNewConstMetric(
@@ -587,6 +604,7 @@ func (c *mountStatsCollector) updateNFSStats(ch chan<- prometheus.Metric, export
587 prometheus.CounterValue, 604 prometheus.CounterValue,
588 float64(s.Transport.Bind), 605 float64(s.Transport.Bind),
589 export, 606 export,
607 protocol,
590 ) 608 )
591 609
592 ch <- prometheus.MustNewConstMetric( 610 ch <- prometheus.MustNewConstMetric(
@@ -594,6 +612,7 @@ func (c *mountStatsCollector) updateNFSStats(ch chan<- prometheus.Metric, export
594 prometheus.CounterValue, 612 prometheus.CounterValue,
595 float64(s.Transport.Connect), 613 float64(s.Transport.Connect),
596 export, 614 export,
615 protocol,
597 ) 616 )
598 617
599 ch <- prometheus.MustNewConstMetric( 618 ch <- prometheus.MustNewConstMetric(
@@ -601,6 +620,7 @@ func (c *mountStatsCollector) updateNFSStats(ch chan<- prometheus.Metric, export
601 prometheus.GaugeValue, 620 prometheus.GaugeValue,
602 s.Transport.IdleTime.Seconds(), 621 s.Transport.IdleTime.Seconds(),
603 export, 622 export,
623 protocol,
604 ) 624 )
605 625
606 ch <- prometheus.MustNewConstMetric( 626 ch <- prometheus.MustNewConstMetric(
@@ -608,6 +628,7 @@ func (c *mountStatsCollector) updateNFSStats(ch chan<- prometheus.Metric, export
608 prometheus.CounterValue, 628 prometheus.CounterValue,
609 float64(s.Transport.Sends), 629 float64(s.Transport.Sends),
610 export, 630 export,
631 protocol,
611 ) 632 )
612 633
613 ch <- prometheus.MustNewConstMetric( 634 ch <- prometheus.MustNewConstMetric(
@@ -615,6 +636,7 @@ func (c *mountStatsCollector) updateNFSStats(ch chan<- prometheus.Metric, export
615 prometheus.CounterValue, 636 prometheus.CounterValue,
616 float64(s.Transport.Receives), 637 float64(s.Transport.Receives),
617 export, 638 export,
639 protocol,
618 ) 640 )
619 641
620 ch <- prometheus.MustNewConstMetric( 642 ch <- prometheus.MustNewConstMetric(
@@ -622,6 +644,7 @@ func (c *mountStatsCollector) updateNFSStats(ch chan<- prometheus.Metric, export
622 prometheus.CounterValue, 644 prometheus.CounterValue,
623 float64(s.Transport.BadTransactionIDs), 645 float64(s.Transport.BadTransactionIDs),
624 export, 646 export,
647 protocol,
625 ) 648 )
626 649
627 ch <- prometheus.MustNewConstMetric( 650 ch <- prometheus.MustNewConstMetric(
@@ -629,6 +652,7 @@ func (c *mountStatsCollector) updateNFSStats(ch chan<- prometheus.Metric, export
629 prometheus.CounterValue, 652 prometheus.CounterValue,
630 float64(s.Transport.CumulativeBacklog), 653 float64(s.Transport.CumulativeBacklog),
631 export, 654 export,
655 protocol,
632 ) 656 )
633 657
634 ch <- prometheus.MustNewConstMetric( 658 ch <- prometheus.MustNewConstMetric(
@@ -636,6 +660,7 @@ func (c *mountStatsCollector) updateNFSStats(ch chan<- prometheus.Metric, export
636 prometheus.GaugeValue, 660 prometheus.GaugeValue,
637 float64(s.Transport.MaximumRPCSlotsUsed), 661 float64(s.Transport.MaximumRPCSlotsUsed),
638 export, 662 export,
663 protocol,
639 ) 664 )
640 665
641 ch <- prometheus.MustNewConstMetric( 666 ch <- prometheus.MustNewConstMetric(
@@ -643,6 +668,7 @@ func (c *mountStatsCollector) updateNFSStats(ch chan<- prometheus.Metric, export
643 prometheus.CounterValue, 668 prometheus.CounterValue,
644 float64(s.Transport.CumulativeSendingQueue), 669 float64(s.Transport.CumulativeSendingQueue),
645 export, 670 export,
671 protocol,
646 ) 672 )
647 673
648 ch <- prometheus.MustNewConstMetric( 674 ch <- prometheus.MustNewConstMetric(
@@ -650,6 +676,7 @@ func (c *mountStatsCollector) updateNFSStats(ch chan<- prometheus.Metric, export
650 prometheus.CounterValue, 676 prometheus.CounterValue,
651 float64(s.Transport.CumulativePendingQueue), 677 float64(s.Transport.CumulativePendingQueue),
652 export, 678 export,
679 protocol,
653 ) 680 )
654 681
655 for _, op := range s.Operations { 682 for _, op := range s.Operations {
@@ -658,6 +685,7 @@ func (c *mountStatsCollector) updateNFSStats(ch chan<- prometheus.Metric, export
658 prometheus.CounterValue, 685 prometheus.CounterValue,
659 float64(op.Requests), 686 float64(op.Requests),
660 export, 687 export,
688 protocol,
661 op.Operation, 689 op.Operation,
662 ) 690 )
663 691
@@ -666,6 +694,7 @@ func (c *mountStatsCollector) updateNFSStats(ch chan<- prometheus.Metric, export
666 prometheus.CounterValue, 694 prometheus.CounterValue,
667 float64(op.Transmissions), 695 float64(op.Transmissions),
668 export, 696 export,
697 protocol,
669 op.Operation, 698 op.Operation,
670 ) 699 )
671 700
@@ -674,6 +703,7 @@ func (c *mountStatsCollector) updateNFSStats(ch chan<- prometheus.Metric, export
674 prometheus.CounterValue, 703 prometheus.CounterValue,
675 float64(op.MajorTimeouts), 704 float64(op.MajorTimeouts),
676 export, 705 export,
706 protocol,
677 op.Operation, 707 op.Operation,
678 ) 708 )
679 709
@@ -682,6 +712,7 @@ func (c *mountStatsCollector) updateNFSStats(ch chan<- prometheus.Metric, export
682 prometheus.CounterValue, 712 prometheus.CounterValue,
683 float64(op.BytesSent), 713 float64(op.BytesSent),
684 export, 714 export,
715 protocol,
685 op.Operation, 716 op.Operation,
686 ) 717 )
687 718
@@ -690,6 +721,7 @@ func (c *mountStatsCollector) updateNFSStats(ch chan<- prometheus.Metric, export
690 prometheus.CounterValue, 721 prometheus.CounterValue,
691 float64(op.BytesReceived), 722 float64(op.BytesReceived),
692 export, 723 export,
724 protocol,
693 op.Operation, 725 op.Operation,
694 ) 726 )
695 727
@@ -698,6 +730,7 @@ func (c *mountStatsCollector) updateNFSStats(ch chan<- prometheus.Metric, export
698 prometheus.CounterValue, 730 prometheus.CounterValue,
699 op.CumulativeQueueTime.Seconds(), 731 op.CumulativeQueueTime.Seconds(),
700 export, 732 export,
733 protocol,
701 op.Operation, 734 op.Operation,
702 ) 735 )
703 736
@@ -706,6 +739,7 @@ func (c *mountStatsCollector) updateNFSStats(ch chan<- prometheus.Metric, export
706 prometheus.CounterValue, 739 prometheus.CounterValue,
707 op.CumulativeTotalResponseTime.Seconds(), 740 op.CumulativeTotalResponseTime.Seconds(),
708 export, 741 export,
742 protocol,
709 op.Operation, 743 op.Operation,
710 ) 744 )
711 745
@@ -714,6 +748,7 @@ func (c *mountStatsCollector) updateNFSStats(ch chan<- prometheus.Metric, export
714 prometheus.CounterValue, 748 prometheus.CounterValue,
715 op.CumulativeTotalRequestTime.Seconds(), 749 op.CumulativeTotalRequestTime.Seconds(),
716 export, 750 export,
751 protocol,
717 op.Operation, 752 op.Operation,
718 ) 753 )
719 } 754 }
@@ -723,6 +758,7 @@ func (c *mountStatsCollector) updateNFSStats(ch chan<- prometheus.Metric, export
723 prometheus.CounterValue, 758 prometheus.CounterValue,
724 float64(s.Events.InodeRevalidate), 759 float64(s.Events.InodeRevalidate),
725 export, 760 export,
761 protocol,
726 ) 762 )
727 763
728 ch <- prometheus.MustNewConstMetric( 764 ch <- prometheus.MustNewConstMetric(
@@ -730,6 +766,7 @@ func (c *mountStatsCollector) updateNFSStats(ch chan<- prometheus.Metric, export
730 prometheus.CounterValue, 766 prometheus.CounterValue,
731 float64(s.Events.DnodeRevalidate), 767 float64(s.Events.DnodeRevalidate),
732 export, 768 export,
769 protocol,
733 ) 770 )
734 771
735 ch <- prometheus.MustNewConstMetric( 772 ch <- prometheus.MustNewConstMetric(
@@ -737,6 +774,7 @@ func (c *mountStatsCollector) updateNFSStats(ch chan<- prometheus.Metric, export
737 prometheus.CounterValue, 774 prometheus.CounterValue,
738 float64(s.Events.DataInvalidate), 775 float64(s.Events.DataInvalidate),
739 export, 776 export,
777 protocol,
740 ) 778 )
741 779
742 ch <- prometheus.MustNewConstMetric( 780 ch <- prometheus.MustNewConstMetric(
@@ -744,6 +782,7 @@ func (c *mountStatsCollector) updateNFSStats(ch chan<- prometheus.Metric, export
744 prometheus.CounterValue, 782 prometheus.CounterValue,
745 float64(s.Events.AttributeInvalidate), 783 float64(s.Events.AttributeInvalidate),
746 export, 784 export,
785 protocol,
747 ) 786 )
748 787
749 ch <- prometheus.MustNewConstMetric( 788 ch <- prometheus.MustNewConstMetric(
@@ -751,6 +790,7 @@ func (c *mountStatsCollector) updateNFSStats(ch chan<- prometheus.Metric, export
751 prometheus.CounterValue, 790 prometheus.CounterValue,
752 float64(s.Events.VFSOpen), 791 float64(s.Events.VFSOpen),
753 export, 792 export,
793 protocol,
754 ) 794 )
755 795
756 ch <- prometheus.MustNewConstMetric( 796 ch <- prometheus.MustNewConstMetric(
@@ -758,6 +798,7 @@ func (c *mountStatsCollector) updateNFSStats(ch chan<- prometheus.Metric, export
758 prometheus.CounterValue, 798 prometheus.CounterValue,
759 float64(s.Events.VFSLookup), 799 float64(s.Events.VFSLookup),
760 export, 800 export,
801 protocol,
761 ) 802 )
762 803
763 ch <- prometheus.MustNewConstMetric( 804 ch <- prometheus.MustNewConstMetric(
@@ -765,6 +806,7 @@ func (c *mountStatsCollector) updateNFSStats(ch chan<- prometheus.Metric, export
765 prometheus.CounterValue, 806 prometheus.CounterValue,
766 float64(s.Events.VFSAccess), 807 float64(s.Events.VFSAccess),
767 export, 808 export,
809 protocol,
768 ) 810 )
769 811
770 ch <- prometheus.MustNewConstMetric( 812 ch <- prometheus.MustNewConstMetric(
@@ -772,6 +814,7 @@ func (c *mountStatsCollector) updateNFSStats(ch chan<- prometheus.Metric, export
772 prometheus.CounterValue, 814 prometheus.CounterValue,
773 float64(s.Events.VFSUpdatePage), 815 float64(s.Events.VFSUpdatePage),
774 export, 816 export,
817 protocol,
775 ) 818 )
776 819
777 ch <- prometheus.MustNewConstMetric( 820 ch <- prometheus.MustNewConstMetric(
@@ -779,6 +822,7 @@ func (c *mountStatsCollector) updateNFSStats(ch chan<- prometheus.Metric, export
779 prometheus.CounterValue, 822 prometheus.CounterValue,
780 float64(s.Events.VFSReadPage), 823 float64(s.Events.VFSReadPage),
781 export, 824 export,
825 protocol,
782 ) 826 )
783 827
784 ch <- prometheus.MustNewConstMetric( 828 ch <- prometheus.MustNewConstMetric(
@@ -786,6 +830,7 @@ func (c *mountStatsCollector) updateNFSStats(ch chan<- prometheus.Metric, export
786 prometheus.CounterValue, 830 prometheus.CounterValue,
787 float64(s.Events.VFSReadPages), 831 float64(s.Events.VFSReadPages),
788 export, 832 export,
833 protocol,
789 ) 834 )
790 835
791 ch <- prometheus.MustNewConstMetric( 836 ch <- prometheus.MustNewConstMetric(
@@ -793,6 +838,7 @@ func (c *mountStatsCollector) updateNFSStats(ch chan<- prometheus.Metric, export
793 prometheus.CounterValue, 838 prometheus.CounterValue,
794 float64(s.Events.VFSWritePage), 839 float64(s.Events.VFSWritePage),
795 export, 840 export,
841 protocol,
796 ) 842 )
797 843
798 ch <- prometheus.MustNewConstMetric( 844 ch <- prometheus.MustNewConstMetric(
@@ -800,6 +846,7 @@ func (c *mountStatsCollector) updateNFSStats(ch chan<- prometheus.Metric, export
800 prometheus.CounterValue, 846 prometheus.CounterValue,
801 float64(s.Events.VFSWritePages), 847 float64(s.Events.VFSWritePages),
802 export, 848 export,
849 protocol,
803 ) 850 )
804 851
805 ch <- prometheus.MustNewConstMetric( 852 ch <- prometheus.MustNewConstMetric(
@@ -807,6 +854,7 @@ func (c *mountStatsCollector) updateNFSStats(ch chan<- prometheus.Metric, export
807 prometheus.CounterValue, 854 prometheus.CounterValue,
808 float64(s.Events.VFSGetdents), 855 float64(s.Events.VFSGetdents),
809 export, 856 export,
857 protocol,
810 ) 858 )
811 859
812 ch <- prometheus.MustNewConstMetric( 860 ch <- prometheus.MustNewConstMetric(
@@ -814,6 +862,7 @@ func (c *mountStatsCollector) updateNFSStats(ch chan<- prometheus.Metric, export
814 prometheus.CounterValue, 862 prometheus.CounterValue,
815 float64(s.Events.VFSSetattr), 863 float64(s.Events.VFSSetattr),
816 export, 864 export,
865 protocol,
817 ) 866 )
818 867
819 ch <- prometheus.MustNewConstMetric( 868 ch <- prometheus.MustNewConstMetric(
@@ -821,6 +870,7 @@ func (c *mountStatsCollector) updateNFSStats(ch chan<- prometheus.Metric, export
821 prometheus.CounterValue, 870 prometheus.CounterValue,
822 float64(s.Events.VFSFlush), 871 float64(s.Events.VFSFlush),
823 export, 872 export,
873 protocol,
824 ) 874 )
825 875
826 ch <- prometheus.MustNewConstMetric( 876 ch <- prometheus.MustNewConstMetric(
@@ -828,6 +878,7 @@ func (c *mountStatsCollector) updateNFSStats(ch chan<- prometheus.Metric, export
828 prometheus.CounterValue, 878 prometheus.CounterValue,
829 float64(s.Events.VFSFsync), 879 float64(s.Events.VFSFsync),
830 export, 880 export,
881 protocol,
831 ) 882 )
832 883
833 ch <- prometheus.MustNewConstMetric( 884 ch <- prometheus.MustNewConstMetric(
@@ -835,6 +886,7 @@ func (c *mountStatsCollector) updateNFSStats(ch chan<- prometheus.Metric, export
835 prometheus.CounterValue, 886 prometheus.CounterValue,
836 float64(s.Events.VFSLock), 887 float64(s.Events.VFSLock),
837 export, 888 export,
889 protocol,
838 ) 890 )
839 891
840 ch <- prometheus.MustNewConstMetric( 892 ch <- prometheus.MustNewConstMetric(
@@ -842,6 +894,7 @@ func (c *mountStatsCollector) updateNFSStats(ch chan<- prometheus.Metric, export
842 prometheus.CounterValue, 894 prometheus.CounterValue,
843 float64(s.Events.VFSFileRelease), 895 float64(s.Events.VFSFileRelease),
844 export, 896 export,
897 protocol,
845 ) 898 )
846 899
847 ch <- prometheus.MustNewConstMetric( 900 ch <- prometheus.MustNewConstMetric(
@@ -849,6 +902,7 @@ func (c *mountStatsCollector) updateNFSStats(ch chan<- prometheus.Metric, export
849 prometheus.CounterValue, 902 prometheus.CounterValue,
850 float64(s.Events.Truncation), 903 float64(s.Events.Truncation),
851 export, 904 export,
905 protocol,
852 ) 906 )
853 907
854 ch <- prometheus.MustNewConstMetric( 908 ch <- prometheus.MustNewConstMetric(
@@ -856,6 +910,7 @@ func (c *mountStatsCollector) updateNFSStats(ch chan<- prometheus.Metric, export
856 prometheus.CounterValue, 910 prometheus.CounterValue,
857 float64(s.Events.WriteExtension), 911 float64(s.Events.WriteExtension),
858 export, 912 export,
913 protocol,
859 ) 914 )
860 915
861 ch <- prometheus.MustNewConstMetric( 916 ch <- prometheus.MustNewConstMetric(
@@ -863,6 +918,7 @@ func (c *mountStatsCollector) updateNFSStats(ch chan<- prometheus.Metric, export
863 prometheus.CounterValue, 918 prometheus.CounterValue,
864 float64(s.Events.SillyRename), 919 float64(s.Events.SillyRename),
865 export, 920 export,
921 protocol,
866 ) 922 )
867 923
868 ch <- prometheus.MustNewConstMetric( 924 ch <- prometheus.MustNewConstMetric(
@@ -870,6 +926,7 @@ func (c *mountStatsCollector) updateNFSStats(ch chan<- prometheus.Metric, export
870 prometheus.CounterValue, 926 prometheus.CounterValue,
871 float64(s.Events.ShortRead), 927 float64(s.Events.ShortRead),
872 export, 928 export,
929 protocol,
873 ) 930 )
874 931
875 ch <- prometheus.MustNewConstMetric( 932 ch <- prometheus.MustNewConstMetric(
@@ -877,6 +934,7 @@ func (c *mountStatsCollector) updateNFSStats(ch chan<- prometheus.Metric, export
877 prometheus.CounterValue, 934 prometheus.CounterValue,
878 float64(s.Events.ShortWrite), 935 float64(s.Events.ShortWrite),
879 export, 936 export,
937 protocol,
880 ) 938 )
881 939
882 ch <- prometheus.MustNewConstMetric( 940 ch <- prometheus.MustNewConstMetric(
@@ -884,6 +942,7 @@ func (c *mountStatsCollector) updateNFSStats(ch chan<- prometheus.Metric, export
884 prometheus.CounterValue, 942 prometheus.CounterValue,
885 float64(s.Events.JukeboxDelay), 943 float64(s.Events.JukeboxDelay),
886 export, 944 export,
945 protocol,
887 ) 946 )
888 947
889 ch <- prometheus.MustNewConstMetric( 948 ch <- prometheus.MustNewConstMetric(
@@ -891,6 +950,7 @@ func (c *mountStatsCollector) updateNFSStats(ch chan<- prometheus.Metric, export
891 prometheus.CounterValue, 950 prometheus.CounterValue,
892 float64(s.Events.PNFSRead), 951 float64(s.Events.PNFSRead),
893 export, 952 export,
953 protocol,
894 ) 954 )
895 955
896 ch <- prometheus.MustNewConstMetric( 956 ch <- prometheus.MustNewConstMetric(
@@ -898,5 +958,6 @@ func (c *mountStatsCollector) updateNFSStats(ch chan<- prometheus.Metric, export
898 prometheus.CounterValue, 958 prometheus.CounterValue,
899 float64(s.Events.PNFSWrite), 959 float64(s.Events.PNFSWrite),
900 export, 960 export,
961 protocol,
901 ) 962 )
902} 963}
diff --git a/vendor/github.com/prometheus/procfs/.gitignore b/vendor/github.com/prometheus/procfs/.gitignore
new file mode 100644
index 0000000..25e3659
--- /dev/null
+++ b/vendor/github.com/prometheus/procfs/.gitignore
@@ -0,0 +1 @@
/fixtures/
diff --git a/vendor/github.com/prometheus/procfs/.travis.yml b/vendor/github.com/prometheus/procfs/.travis.yml
new file mode 100644
index 0000000..5416cf8
--- /dev/null
+++ b/vendor/github.com/prometheus/procfs/.travis.yml
@@ -0,0 +1,15 @@
1sudo: false
2
3language: go
4
5go:
6- 1.7.x
7- 1.8.x
8- 1.9.x
9- 1.10.x
10- 1.x
11
12go_import_path: github.com/prometheus/procfs
13
14script:
15- make style check_license vet test staticcheck
diff --git a/vendor/github.com/prometheus/procfs/Makefile b/vendor/github.com/prometheus/procfs/Makefile
index 5c8f726..4d10983 100644
--- a/vendor/github.com/prometheus/procfs/Makefile
+++ b/vendor/github.com/prometheus/procfs/Makefile
@@ -59,6 +59,12 @@ staticcheck: $(STATICCHECK)
59 ./ttar -C $(dir $*) -x -f $*.ttar 59 ./ttar -C $(dir $*) -x -f $*.ttar
60 touch $@ 60 touch $@
61 61
62update_fixtures: fixtures.ttar sysfs/fixtures.ttar
63
64%fixtures.ttar: %/fixtures
65 rm -v $(dir $*)fixtures/.unpacked
66 ./ttar -C $(dir $*) -c -f $*fixtures.ttar fixtures/
67
62$(FIRST_GOPATH)/bin/staticcheck: 68$(FIRST_GOPATH)/bin/staticcheck:
63 @GOOS= GOARCH= $(GO) get -u honnef.co/go/tools/cmd/staticcheck 69 @GOOS= GOARCH= $(GO) get -u honnef.co/go/tools/cmd/staticcheck
64 70
diff --git a/vendor/github.com/prometheus/procfs/bcache/get_test.go b/vendor/github.com/prometheus/procfs/bcache/get_test.go
new file mode 100644
index 0000000..1d41a5a
--- /dev/null
+++ b/vendor/github.com/prometheus/procfs/bcache/get_test.go
@@ -0,0 +1,114 @@
1// Copyright 2017 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 bcache
15
16import (
17 "math"
18 "testing"
19)
20
21func TestDehumanizeTests(t *testing.T) {
22 dehumanizeTests := []struct {
23 in []byte
24 out uint64
25 invalid bool
26 }{
27 {
28 in: []byte("542k"),
29 out: 555008,
30 },
31 {
32 in: []byte("322M"),
33 out: 337641472,
34 },
35 {
36 in: []byte("1.1k"),
37 out: 1124,
38 },
39 {
40 in: []byte("1.9k"),
41 out: 1924,
42 },
43 {
44 in: []byte("1.10k"),
45 out: 2024,
46 },
47 {
48 in: []byte(""),
49 out: 0,
50 invalid: true,
51 },
52 }
53 for _, tst := range dehumanizeTests {
54 got, err := dehumanize(tst.in)
55 if tst.invalid && err == nil {
56 t.Error("expected an error, but none occurred")
57 }
58 if !tst.invalid && err != nil {
59 t.Errorf("unexpected error: %v", err)
60 }
61 if got != tst.out {
62 t.Errorf("dehumanize: '%s', want %d, got %d", tst.in, tst.out, got)
63 }
64 }
65}
66
67func TestParsePseudoFloatTests(t *testing.T) {
68 parsePseudoFloatTests := []struct {
69 in string
70 out float64
71 }{
72 {
73 in: "1.1",
74 out: float64(1.097656),
75 },
76 {
77 in: "1.9",
78 out: float64(1.878906),
79 },
80 {
81 in: "1.10",
82 out: float64(1.976562),
83 },
84 }
85 for _, tst := range parsePseudoFloatTests {
86 got, err := parsePseudoFloat(tst.in)
87 if err != nil || math.Abs(got-tst.out) > 0.0001 {
88 t.Errorf("parsePseudoFloat: %s, want %f, got %f", tst.in, tst.out, got)
89 }
90 }
91}
92
93func TestPriorityStats(t *testing.T) {
94 var want = PriorityStats{
95 UnusedPercent: 99,
96 MetadataPercent: 5,
97 }
98 var (
99 in string
100 gotErr error
101 got PriorityStats
102 )
103 in = "Metadata: 5%"
104 gotErr = parsePriorityStats(in, &got)
105 if gotErr != nil || got.MetadataPercent != want.MetadataPercent {
106 t.Errorf("parsePriorityStats: '%s', want %d, got %d", in, want.MetadataPercent, got.MetadataPercent)
107 }
108
109 in = "Unused: 99%"
110 gotErr = parsePriorityStats(in, &got)
111 if gotErr != nil || got.UnusedPercent != want.UnusedPercent {
112 t.Errorf("parsePriorityStats: '%s', want %d, got %d", in, want.UnusedPercent, got.UnusedPercent)
113 }
114}
diff --git a/vendor/github.com/prometheus/procfs/buddyinfo_test.go b/vendor/github.com/prometheus/procfs/buddyinfo_test.go
new file mode 100644
index 0000000..bcf9355
--- /dev/null
+++ b/vendor/github.com/prometheus/procfs/buddyinfo_test.go
@@ -0,0 +1,64 @@
1// Copyright 2017 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 "strings"
18 "testing"
19)
20
21func TestBuddyInfo(t *testing.T) {
22 buddyInfo, err := FS("fixtures/buddyinfo/valid").NewBuddyInfo()
23 if err != nil {
24 t.Fatal(err)
25 }
26
27 if want, got := "DMA", buddyInfo[0].Zone; want != got {
28 t.Errorf("want Node 0, Zone %s, got %s", want, got)
29 }
30
31 if want, got := "Normal", buddyInfo[2].Zone; want != got {
32 t.Errorf("want Node 0, Zone %s, got %s", want, got)
33 }
34
35 if want, got := 4381.0, buddyInfo[2].Sizes[0]; want != got {
36 t.Errorf("want Node 0, Zone Normal %f, got %f", want, got)
37 }
38
39 if want, got := 572.0, buddyInfo[1].Sizes[1]; want != got {
40 t.Errorf("want Node 0, Zone DMA32 %f, got %f", want, got)
41 }
42}
43
44func TestBuddyInfoShort(t *testing.T) {
45 _, err := FS("fixtures/buddyinfo/short").NewBuddyInfo()
46 if err == nil {
47 t.Errorf("expected error, but none occurred")
48 }
49
50 if want, got := "invalid number of fields when parsing buddyinfo", err.Error(); want != got {
51 t.Errorf("wrong error returned, wanted %q, got %q", want, got)
52 }
53}
54
55func TestBuddyInfoSizeMismatch(t *testing.T) {
56 _, err := FS("fixtures/buddyinfo/sizemismatch").NewBuddyInfo()
57 if err == nil {
58 t.Errorf("expected error, but none occurred")
59 }
60
61 if want, got := "mismatch in number of buddyinfo buckets", err.Error(); !strings.HasPrefix(got, want) {
62 t.Errorf("wrong error returned, wanted prefix %q, got %q", want, got)
63 }
64}
diff --git a/vendor/github.com/prometheus/procfs/fs_test.go b/vendor/github.com/prometheus/procfs/fs_test.go
new file mode 100644
index 0000000..a4e07f5
--- /dev/null
+++ b/vendor/github.com/prometheus/procfs/fs_test.go
@@ -0,0 +1,39 @@
1// Copyright 2018 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 "testing"
17
18func TestNewFS(t *testing.T) {
19 if _, err := NewFS("foobar"); err == nil {
20 t.Error("want NewFS to fail for non-existing mount point")
21 }
22
23 if _, err := NewFS("procfs.go"); err == nil {
24 t.Error("want NewFS to fail if mount point is not a directory")
25 }
26}
27
28func TestFSXFSStats(t *testing.T) {
29 stats, err := FS("fixtures").XFSStats()
30 if err != nil {
31 t.Fatalf("failed to parse XFS stats: %v", err)
32 }
33
34 // Very lightweight test just to sanity check the path used
35 // to open XFS stats. Heavier tests in package xfs.
36 if want, got := uint32(92447), stats.ExtentAllocation.ExtentsAllocated; want != got {
37 t.Errorf("unexpected extents allocated:\nwant: %d\nhave: %d", want, got)
38 }
39}
diff --git a/vendor/github.com/prometheus/procfs/ipvs_test.go b/vendor/github.com/prometheus/procfs/ipvs_test.go
new file mode 100644
index 0000000..9c34e6d
--- /dev/null
+++ b/vendor/github.com/prometheus/procfs/ipvs_test.go
@@ -0,0 +1,250 @@
1// Copyright 2018 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 "net"
18 "testing"
19)
20
21var (
22 expectedIPVSStats = IPVSStats{
23 Connections: 23765872,
24 IncomingPackets: 3811989221,
25 OutgoingPackets: 0,
26 IncomingBytes: 89991519156915,
27 OutgoingBytes: 0,
28 }
29 expectedIPVSBackendStatuses = []IPVSBackendStatus{
30 {
31 LocalAddress: net.ParseIP("192.168.0.22"),
32 LocalPort: 3306,
33 RemoteAddress: net.ParseIP("192.168.82.22"),
34 RemotePort: 3306,
35 Proto: "TCP",
36 Weight: 100,
37 ActiveConn: 248,
38 InactConn: 2,
39 },
40 {
41 LocalAddress: net.ParseIP("192.168.0.22"),
42 LocalPort: 3306,
43 RemoteAddress: net.ParseIP("192.168.83.24"),
44 RemotePort: 3306,
45 Proto: "TCP",
46 Weight: 100,
47 ActiveConn: 248,
48 InactConn: 2,
49 },
50 {
51 LocalAddress: net.ParseIP("192.168.0.22"),
52 LocalPort: 3306,
53 RemoteAddress: net.ParseIP("192.168.83.21"),
54 RemotePort: 3306,
55 Proto: "TCP",
56 Weight: 100,
57 ActiveConn: 248,
58 InactConn: 1,
59 },
60 {
61 LocalAddress: net.ParseIP("192.168.0.57"),
62 LocalPort: 3306,
63 RemoteAddress: net.ParseIP("192.168.84.22"),
64 RemotePort: 3306,
65 Proto: "TCP",
66 Weight: 0,
67 ActiveConn: 0,
68 InactConn: 0,
69 },
70 {
71 LocalAddress: net.ParseIP("192.168.0.57"),
72 LocalPort: 3306,
73 RemoteAddress: net.ParseIP("192.168.82.21"),
74 RemotePort: 3306,
75 Proto: "TCP",
76 Weight: 100,
77 ActiveConn: 1499,
78 InactConn: 0,
79 },
80 {
81 LocalAddress: net.ParseIP("192.168.0.57"),
82 LocalPort: 3306,
83 RemoteAddress: net.ParseIP("192.168.50.21"),
84 RemotePort: 3306,
85 Proto: "TCP",
86 Weight: 100,
87 ActiveConn: 1498,
88 InactConn: 0,
89 },
90 {
91 LocalAddress: net.ParseIP("192.168.0.55"),
92 LocalPort: 3306,
93 RemoteAddress: net.ParseIP("192.168.50.26"),
94 RemotePort: 3306,
95 Proto: "TCP",
96 Weight: 0,
97 ActiveConn: 0,
98 InactConn: 0,
99 },
100 {
101 LocalAddress: net.ParseIP("192.168.0.55"),
102 LocalPort: 3306,
103 RemoteAddress: net.ParseIP("192.168.49.32"),
104 RemotePort: 3306,
105 Proto: "TCP",
106 Weight: 100,
107 ActiveConn: 0,
108 InactConn: 0,
109 },
110 {
111 LocalAddress: net.ParseIP("2620::1"),
112 LocalPort: 80,
113 RemoteAddress: net.ParseIP("2620::2"),
114 RemotePort: 80,
115 Proto: "TCP",
116 Weight: 1,
117 ActiveConn: 0,
118 InactConn: 0,
119 },
120 {
121 LocalAddress: net.ParseIP("2620::1"),
122 LocalPort: 80,
123 RemoteAddress: net.ParseIP("2620::3"),
124 RemotePort: 80,
125 Proto: "TCP",
126 Weight: 1,
127 ActiveConn: 0,
128 InactConn: 0,
129 },
130 {
131 LocalAddress: net.ParseIP("2620::1"),
132 LocalPort: 80,
133 RemoteAddress: net.ParseIP("2620::4"),
134 RemotePort: 80,
135 Proto: "TCP",
136 Weight: 1,
137 ActiveConn: 1,
138 InactConn: 1,
139 },
140 {
141 LocalMark: "10001000",
142 RemoteAddress: net.ParseIP("192.168.50.26"),
143 RemotePort: 3306,
144 Proto: "FWM",
145 Weight: 0,
146 ActiveConn: 0,
147 InactConn: 1,
148 },
149 {
150 LocalMark: "10001000",
151 RemoteAddress: net.ParseIP("192.168.50.21"),
152 RemotePort: 3306,
153 Proto: "FWM",
154 Weight: 0,
155 ActiveConn: 0,
156 InactConn: 2,
157 },
158 }
159)
160
161func TestIPVSStats(t *testing.T) {
162 stats, err := FS("fixtures").NewIPVSStats()
163 if err != nil {
164 t.Fatal(err)
165 }
166
167 if stats != expectedIPVSStats {
168 t.Errorf("want %+v, have %+v", expectedIPVSStats, stats)
169 }
170}
171
172func TestParseIPPort(t *testing.T) {
173 ip := net.ParseIP("192.168.0.22")
174 port := uint16(3306)
175
176 gotIP, gotPort, err := parseIPPort("C0A80016:0CEA")
177 if err != nil {
178 t.Fatal(err)
179 }
180 if !(gotIP.Equal(ip) && port == gotPort) {
181 t.Errorf("want %s:%d, have %s:%d", ip, port, gotIP, gotPort)
182 }
183}
184
185func TestParseIPPortInvalid(t *testing.T) {
186 testcases := []string{
187 "",
188 "C0A80016",
189 "C0A800:1234",
190 "FOOBARBA:1234",
191 "C0A80016:0CEA:1234",
192 }
193
194 for _, s := range testcases {
195 ip, port, err := parseIPPort(s)
196 if ip != nil || port != uint16(0) || err == nil {
197 t.Errorf("Expected error for input %s, have ip = %s, port = %v, err = %v", s, ip, port, err)
198 }
199 }
200}
201
202func TestParseIPPortIPv6(t *testing.T) {
203 ip := net.ParseIP("dead:beef::1")
204 port := uint16(8080)
205
206 gotIP, gotPort, err := parseIPPort("[DEAD:BEEF:0000:0000:0000:0000:0000:0001]:1F90")
207 if err != nil {
208 t.Fatal(err)
209 }
210 if !(gotIP.Equal(ip) && port == gotPort) {
211 t.Errorf("want %s:%d, have %s:%d", ip, port, gotIP, gotPort)
212 }
213}
214
215func TestIPVSBackendStatus(t *testing.T) {
216 backendStats, err := FS("fixtures").NewIPVSBackendStatus()
217 if err != nil {
218 t.Fatal(err)
219 }
220 if want, have := len(expectedIPVSBackendStatuses), len(backendStats); want != have {
221 t.Fatalf("want %d backend statuses, have %d", want, have)
222 }
223
224 for idx, expect := range expectedIPVSBackendStatuses {
225 if !backendStats[idx].LocalAddress.Equal(expect.LocalAddress) {
226 t.Errorf("want LocalAddress %s, have %s", expect.LocalAddress, backendStats[idx].LocalAddress)
227 }
228 if backendStats[idx].LocalPort != expect.LocalPort {
229 t.Errorf("want LocalPort %d, have %d", expect.LocalPort, backendStats[idx].LocalPort)
230 }
231 if !backendStats[idx].RemoteAddress.Equal(expect.RemoteAddress) {
232 t.Errorf("want RemoteAddress %s, have %s", expect.RemoteAddress, backendStats[idx].RemoteAddress)
233 }
234 if backendStats[idx].RemotePort != expect.RemotePort {
235 t.Errorf("want RemotePort %d, have %d", expect.RemotePort, backendStats[idx].RemotePort)
236 }
237 if backendStats[idx].Proto != expect.Proto {
238 t.Errorf("want Proto %s, have %s", expect.Proto, backendStats[idx].Proto)
239 }
240 if backendStats[idx].Weight != expect.Weight {
241 t.Errorf("want Weight %d, have %d", expect.Weight, backendStats[idx].Weight)
242 }
243 if backendStats[idx].ActiveConn != expect.ActiveConn {
244 t.Errorf("want ActiveConn %d, have %d", expect.ActiveConn, backendStats[idx].ActiveConn)
245 }
246 if backendStats[idx].InactConn != expect.InactConn {
247 t.Errorf("want InactConn %d, have %d", expect.InactConn, backendStats[idx].InactConn)
248 }
249 }
250}
diff --git a/vendor/github.com/prometheus/procfs/mdstat_test.go b/vendor/github.com/prometheus/procfs/mdstat_test.go
new file mode 100644
index 0000000..8819228
--- /dev/null
+++ b/vendor/github.com/prometheus/procfs/mdstat_test.go
@@ -0,0 +1,44 @@
1// Copyright 2018 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 "testing"
18)
19
20func TestMDStat(t *testing.T) {
21 mdStates, err := FS("fixtures").ParseMDStat()
22 if err != nil {
23 t.Fatalf("parsing of reference-file failed entirely: %s", err)
24 }
25
26 refs := map[string]MDStat{
27 "md3": {"md3", "active", 8, 8, 5853468288, 5853468288},
28 "md127": {"md127", "active", 2, 2, 312319552, 312319552},
29 "md0": {"md0", "active", 2, 2, 248896, 248896},
30 "md4": {"md4", "inactive", 2, 2, 4883648, 4883648},
31 "md6": {"md6", "active", 1, 2, 195310144, 16775552},
32 "md8": {"md8", "active", 2, 2, 195310144, 16775552},
33 "md7": {"md7", "active", 3, 4, 7813735424, 7813735424},
34 }
35
36 if want, have := len(refs), len(mdStates); want != have {
37 t.Errorf("want %d parsed md-devices, have %d", want, have)
38 }
39 for _, md := range mdStates {
40 if want, have := refs[md.Name], md; want != have {
41 t.Errorf("%s: want %v, have %v", md.Name, want, have)
42 }
43 }
44}
diff --git a/vendor/github.com/prometheus/procfs/mountstats.go b/vendor/github.com/prometheus/procfs/mountstats.go
index e95ddbc..7a8a1e0 100644
--- a/vendor/github.com/prometheus/procfs/mountstats.go
+++ b/vendor/github.com/prometheus/procfs/mountstats.go
@@ -39,8 +39,11 @@ const (
39 statVersion10 = "1.0" 39 statVersion10 = "1.0"
40 statVersion11 = "1.1" 40 statVersion11 = "1.1"
41 41
42 fieldTransport10Len = 10 42 fieldTransport10TCPLen = 10
43 fieldTransport11Len = 13 43 fieldTransport10UDPLen = 7
44
45 fieldTransport11TCPLen = 13
46 fieldTransport11UDPLen = 10
44) 47)
45 48
46// A Mount is a device mount parsed from /proc/[pid]/mountstats. 49// A Mount is a device mount parsed from /proc/[pid]/mountstats.
@@ -186,6 +189,8 @@ type NFSOperationStats struct {
186// A NFSTransportStats contains statistics for the NFS mount RPC requests and 189// A NFSTransportStats contains statistics for the NFS mount RPC requests and
187// responses. 190// responses.
188type NFSTransportStats struct { 191type NFSTransportStats struct {
192 // The transport protocol used for the NFS mount.
193 Protocol string
189 // The local port used for the NFS mount. 194 // The local port used for the NFS mount.
190 Port uint64 195 Port uint64
191 // Number of times the client has had to establish a connection from scratch 196 // Number of times the client has had to establish a connection from scratch
@@ -360,7 +365,7 @@ func parseMountStatsNFS(s *bufio.Scanner, statVersion string) (*MountStatsNFS, e
360 return nil, fmt.Errorf("not enough information for NFS transport stats: %v", ss) 365 return nil, fmt.Errorf("not enough information for NFS transport stats: %v", ss)
361 } 366 }
362 367
363 tstats, err := parseNFSTransportStats(ss[2:], statVersion) 368 tstats, err := parseNFSTransportStats(ss[1:], statVersion)
364 if err != nil { 369 if err != nil {
365 return nil, err 370 return nil, err
366 } 371 }
@@ -522,13 +527,33 @@ func parseNFSOperationStats(s *bufio.Scanner) ([]NFSOperationStats, error) {
522// parseNFSTransportStats parses a NFSTransportStats line using an input set of 527// parseNFSTransportStats parses a NFSTransportStats line using an input set of
523// integer fields matched to a specific stats version. 528// integer fields matched to a specific stats version.
524func parseNFSTransportStats(ss []string, statVersion string) (*NFSTransportStats, error) { 529func parseNFSTransportStats(ss []string, statVersion string) (*NFSTransportStats, error) {
530 // Extract the protocol field. It is the only string value in the line
531 protocol := ss[0]
532 ss = ss[1:]
533
525 switch statVersion { 534 switch statVersion {
526 case statVersion10: 535 case statVersion10:
527 if len(ss) != fieldTransport10Len { 536 var expectedLength int
537 if protocol == "tcp" {
538 expectedLength = fieldTransport10TCPLen
539 } else if protocol == "udp" {
540 expectedLength = fieldTransport10UDPLen
541 } else {
542 return nil, fmt.Errorf("invalid NFS protocol \"%s\" in stats 1.0 statement: %v", protocol, ss)
543 }
544 if len(ss) != expectedLength {
528 return nil, fmt.Errorf("invalid NFS transport stats 1.0 statement: %v", ss) 545 return nil, fmt.Errorf("invalid NFS transport stats 1.0 statement: %v", ss)
529 } 546 }
530 case statVersion11: 547 case statVersion11:
531 if len(ss) != fieldTransport11Len { 548 var expectedLength int
549 if protocol == "tcp" {
550 expectedLength = fieldTransport11TCPLen
551 } else if protocol == "udp" {
552 expectedLength = fieldTransport11UDPLen
553 } else {
554 return nil, fmt.Errorf("invalid NFS protocol \"%s\" in stats 1.1 statement: %v", protocol, ss)
555 }
556 if len(ss) != expectedLength {
532 return nil, fmt.Errorf("invalid NFS transport stats 1.1 statement: %v", ss) 557 return nil, fmt.Errorf("invalid NFS transport stats 1.1 statement: %v", ss)
533 } 558 }
534 default: 559 default:
@@ -536,12 +561,13 @@ func parseNFSTransportStats(ss []string, statVersion string) (*NFSTransportStats
536 } 561 }
537 562
538 // Allocate enough for v1.1 stats since zero value for v1.1 stats will be okay 563 // Allocate enough for v1.1 stats since zero value for v1.1 stats will be okay
539 // in a v1.0 response. 564 // in a v1.0 response. Since the stat length is bigger for TCP stats, we use
565 // the TCP length here.
540 // 566 //
541 // Note: slice length must be set to length of v1.1 stats to avoid a panic when 567 // Note: slice length must be set to length of v1.1 stats to avoid a panic when
542 // only v1.0 stats are present. 568 // only v1.0 stats are present.
543 // See: https://github.com/prometheus/node_exporter/issues/571. 569 // See: https://github.com/prometheus/node_exporter/issues/571.
544 ns := make([]uint64, fieldTransport11Len) 570 ns := make([]uint64, fieldTransport11TCPLen)
545 for i, s := range ss { 571 for i, s := range ss {
546 n, err := strconv.ParseUint(s, 10, 64) 572 n, err := strconv.ParseUint(s, 10, 64)
547 if err != nil { 573 if err != nil {
@@ -551,7 +577,18 @@ func parseNFSTransportStats(ss []string, statVersion string) (*NFSTransportStats
551 ns[i] = n 577 ns[i] = n
552 } 578 }
553 579
580 // The fields differ depending on the transport protocol (TCP or UDP)
581 // From https://utcc.utoronto.ca/%7Ecks/space/blog/linux/NFSMountstatsXprt
582 //
583 // For the udp RPC transport there is no connection count, connect idle time,
584 // or idle time (fields #3, #4, and #5); all other fields are the same. So
585 // we set them to 0 here.
586 if protocol == "udp" {
587 ns = append(ns[:2], append(make([]uint64, 3), ns[2:]...)...)
588 }
589
554 return &NFSTransportStats{ 590 return &NFSTransportStats{
591 Protocol: protocol,
555 Port: ns[0], 592 Port: ns[0],
556 Bind: ns[1], 593 Bind: ns[1],
557 Connect: ns[2], 594 Connect: ns[2],
diff --git a/vendor/github.com/prometheus/procfs/mountstats_test.go b/vendor/github.com/prometheus/procfs/mountstats_test.go
new file mode 100644
index 0000000..9ae3b02
--- /dev/null
+++ b/vendor/github.com/prometheus/procfs/mountstats_test.go
@@ -0,0 +1,380 @@
1// Copyright 2018 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 "fmt"
18 "reflect"
19 "strings"
20 "testing"
21 "time"
22)
23
24func TestMountStats(t *testing.T) {
25 tests := []struct {
26 name string
27 s string
28 mounts []*Mount
29 invalid bool
30 }{
31 {
32 name: "no devices",
33 s: `hello`,
34 },
35 {
36 name: "device has too few fields",
37 s: `device foo`,
38 invalid: true,
39 },
40 {
41 name: "device incorrect format",
42 s: `device rootfs BAD on / with fstype rootfs`,
43 invalid: true,
44 },
45 {
46 name: "device incorrect format",
47 s: `device rootfs mounted BAD / with fstype rootfs`,
48 invalid: true,
49 },
50 {
51 name: "device incorrect format",
52 s: `device rootfs mounted on / BAD fstype rootfs`,
53 invalid: true,
54 },
55 {
56 name: "device incorrect format",
57 s: `device rootfs mounted on / with BAD rootfs`,
58 invalid: true,
59 },
60 {
61 name: "device rootfs cannot have stats",
62 s: `device rootfs mounted on / with fstype rootfs stats`,
63 invalid: true,
64 },
65 {
66 name: "NFSv4 device with too little info",
67 s: "device 192.168.1.1:/srv mounted on /mnt/nfs with fstype nfs4 statvers=1.1\nhello",
68 invalid: true,
69 },
70 {
71 name: "NFSv4 device with bad bytes",
72 s: "device 192.168.1.1:/srv mounted on /mnt/nfs with fstype nfs4 statvers=1.1\nbytes: 0",
73 invalid: true,
74 },
75 {
76 name: "NFSv4 device with bad events",
77 s: "device 192.168.1.1:/srv mounted on /mnt/nfs with fstype nfs4 statvers=1.1\nevents: 0",
78 invalid: true,
79 },
80 {
81 name: "NFSv4 device with bad per-op stats",
82 s: "device 192.168.1.1:/srv mounted on /mnt/nfs with fstype nfs4 statvers=1.1\nper-op statistics\nFOO 0",
83 invalid: true,
84 },
85 {
86 name: "NFSv4 device with bad transport stats",
87 s: "device 192.168.1.1:/srv mounted on /mnt/nfs with fstype nfs4 statvers=1.1\nxprt: tcp",
88 invalid: true,
89 },
90 {
91 name: "NFSv4 device with bad transport version",
92 s: "device 192.168.1.1:/srv mounted on /mnt/nfs with fstype nfs4 statvers=foo\nxprt: tcp 0",
93 invalid: true,
94 },
95 {
96 name: "NFSv4 device with bad transport stats version 1.0",
97 s: "device 192.168.1.1:/srv mounted on /mnt/nfs with fstype nfs4 statvers=1.0\nxprt: tcp 0 0 0 0 0 0 0 0 0 0 0 0 0",
98 invalid: true,
99 },
100 {
101 name: "NFSv4 device with bad transport stats version 1.1",
102 s: "device 192.168.1.1:/srv mounted on /mnt/nfs with fstype nfs4 statvers=1.1\nxprt: tcp 0 0 0 0 0 0 0 0 0 0",
103 invalid: true,
104 },
105 {
106 name: "NFSv3 device with bad transport protocol",
107 s: "device 192.168.1.1:/srv mounted on /mnt/nfs with fstype nfs4 statvers=1.1\nxprt: tcpx 0 0 0 0 0 0 0 0 0 0",
108 invalid: true,
109 },
110 {
111 name: "NFSv3 device using TCP with transport stats version 1.0 OK",
112 s: "device 192.168.1.1:/srv mounted on /mnt/nfs with fstype nfs statvers=1.0\nxprt: tcp 1 2 3 4 5 6 7 8 9 10",
113 mounts: []*Mount{{
114 Device: "192.168.1.1:/srv",
115 Mount: "/mnt/nfs",
116 Type: "nfs",
117 Stats: &MountStatsNFS{
118 StatVersion: "1.0",
119 Transport: NFSTransportStats{
120 Protocol: "tcp",
121 Port: 1,
122 Bind: 2,
123 Connect: 3,
124 ConnectIdleTime: 4,
125 IdleTime: 5 * time.Second,
126 Sends: 6,
127 Receives: 7,
128 BadTransactionIDs: 8,
129 CumulativeActiveRequests: 9,
130 CumulativeBacklog: 10,
131 MaximumRPCSlotsUsed: 0, // these three are not
132 CumulativeSendingQueue: 0, // present in statvers=1.0
133 CumulativePendingQueue: 0, //
134 },
135 },
136 }},
137 },
138 {
139 name: "NFSv3 device using UDP with transport stats version 1.0 OK",
140 s: "device 192.168.1.1:/srv mounted on /mnt/nfs with fstype nfs statvers=1.0\nxprt: udp 1 2 3 4 5 6 7",
141 mounts: []*Mount{{
142 Device: "192.168.1.1:/srv",
143 Mount: "/mnt/nfs",
144 Type: "nfs",
145 Stats: &MountStatsNFS{
146 StatVersion: "1.0",
147 Transport: NFSTransportStats{
148 Protocol: "udp",
149 Port: 1,
150 Bind: 2,
151 Connect: 0,
152 ConnectIdleTime: 0,
153 IdleTime: 0,
154 Sends: 3,
155 Receives: 4,
156 BadTransactionIDs: 5,
157 CumulativeActiveRequests: 6,
158 CumulativeBacklog: 7,
159 MaximumRPCSlotsUsed: 0, // these three are not
160 CumulativeSendingQueue: 0, // present in statvers=1.0
161 CumulativePendingQueue: 0, //
162 },
163 },
164 }},
165 },
166 {
167 name: "NFSv3 device using TCP with transport stats version 1.1 OK",
168 s: "device 192.168.1.1:/srv mounted on /mnt/nfs with fstype nfs statvers=1.1\nxprt: tcp 1 2 3 4 5 6 7 8 9 10 11 12 13",
169 mounts: []*Mount{{
170 Device: "192.168.1.1:/srv",
171 Mount: "/mnt/nfs",
172 Type: "nfs",
173 Stats: &MountStatsNFS{
174 StatVersion: "1.1",
175 Transport: NFSTransportStats{
176 Protocol: "tcp",
177 Port: 1,
178 Bind: 2,
179 Connect: 3,
180 ConnectIdleTime: 4,
181 IdleTime: 5 * time.Second,
182 Sends: 6,
183 Receives: 7,
184 BadTransactionIDs: 8,
185 CumulativeActiveRequests: 9,
186 CumulativeBacklog: 10,
187 MaximumRPCSlotsUsed: 11,
188 CumulativeSendingQueue: 12,
189 CumulativePendingQueue: 13,
190 },
191 },
192 }},
193 },
194 {
195 name: "NFSv3 device using UDP with transport stats version 1.1 OK",
196 s: "device 192.168.1.1:/srv mounted on /mnt/nfs with fstype nfs statvers=1.1\nxprt: udp 1 2 3 4 5 6 7 8 9 10",
197 mounts: []*Mount{{
198 Device: "192.168.1.1:/srv",
199 Mount: "/mnt/nfs",
200 Type: "nfs",
201 Stats: &MountStatsNFS{
202 StatVersion: "1.1",
203 Transport: NFSTransportStats{
204 Protocol: "udp",
205 Port: 1,
206 Bind: 2,
207 Connect: 0, // these three are not
208 ConnectIdleTime: 0, // present for UDP
209 IdleTime: 0, //
210 Sends: 3,
211 Receives: 4,
212 BadTransactionIDs: 5,
213 CumulativeActiveRequests: 6,
214 CumulativeBacklog: 7,
215 MaximumRPCSlotsUsed: 8,
216 CumulativeSendingQueue: 9,
217 CumulativePendingQueue: 10,
218 },
219 },
220 }},
221 },
222 {
223 name: "device rootfs OK",
224 s: `device rootfs mounted on / with fstype rootfs`,
225 mounts: []*Mount{{
226 Device: "rootfs",
227 Mount: "/",
228 Type: "rootfs",
229 }},
230 },
231 {
232 name: "NFSv3 device with minimal stats OK",
233 s: `device 192.168.1.1:/srv mounted on /mnt/nfs with fstype nfs statvers=1.1`,
234 mounts: []*Mount{{
235 Device: "192.168.1.1:/srv",
236 Mount: "/mnt/nfs",
237 Type: "nfs",
238 Stats: &MountStatsNFS{
239 StatVersion: "1.1",
240 },
241 }},
242 },
243 {
244 name: "fixtures OK",
245 mounts: []*Mount{
246 {
247 Device: "rootfs",
248 Mount: "/",
249 Type: "rootfs",
250 },
251 {
252 Device: "sysfs",
253 Mount: "/sys",
254 Type: "sysfs",
255 },
256 {
257 Device: "proc",
258 Mount: "/proc",
259 Type: "proc",
260 },
261 {
262 Device: "/dev/sda1",
263 Mount: "/",
264 Type: "ext4",
265 },
266 {
267 Device: "192.168.1.1:/srv/test",
268 Mount: "/mnt/nfs/test",
269 Type: "nfs4",
270 Stats: &MountStatsNFS{
271 StatVersion: "1.1",
272 Age: 13968 * time.Second,
273 Bytes: NFSBytesStats{
274 Read: 1207640230,
275 ReadTotal: 1210214218,
276 ReadPages: 295483,
277 },
278 Events: NFSEventsStats{
279 InodeRevalidate: 52,
280 DnodeRevalidate: 226,
281 VFSOpen: 1,
282 VFSLookup: 13,
283 VFSAccess: 398,
284 VFSReadPages: 331,
285 VFSWritePages: 47,
286 VFSFlush: 77,
287 VFSFileRelease: 77,
288 },
289 Operations: []NFSOperationStats{
290 {
291 Operation: "NULL",
292 },
293 {
294 Operation: "READ",
295 Requests: 1298,
296 Transmissions: 1298,
297 BytesSent: 207680,
298 BytesReceived: 1210292152,
299 CumulativeQueueTime: 6 * time.Millisecond,
300 CumulativeTotalResponseTime: 79386 * time.Millisecond,
301 CumulativeTotalRequestTime: 79407 * time.Millisecond,
302 },
303 {
304 Operation: "WRITE",
305 },
306 },
307 Transport: NFSTransportStats{
308 Protocol: "tcp",
309 Port: 832,
310 Connect: 1,
311 IdleTime: 11 * time.Second,
312 Sends: 6428,
313 Receives: 6428,
314 CumulativeActiveRequests: 12154,
315 MaximumRPCSlotsUsed: 24,
316 CumulativeSendingQueue: 26,
317 CumulativePendingQueue: 5726,
318 },
319 },
320 },
321 },
322 },
323 }
324
325 for i, tt := range tests {
326 t.Logf("[%02d] test %q", i, tt.name)
327
328 var mounts []*Mount
329 var err error
330
331 if tt.s != "" {
332 mounts, err = parseMountStats(strings.NewReader(tt.s))
333 } else {
334 proc, e := FS("fixtures").NewProc(26231)
335 if e != nil {
336 t.Fatalf("failed to create proc: %v", err)
337 }
338
339 mounts, err = proc.MountStats()
340 }
341
342 if tt.invalid && err == nil {
343 t.Error("expected an error, but none occurred")
344 }
345 if !tt.invalid && err != nil {
346 t.Errorf("unexpected error: %v", err)
347 }
348
349 if want, have := tt.mounts, mounts; !reflect.DeepEqual(want, have) {
350 t.Errorf("mounts:\nwant:\n%v\nhave:\n%v", mountsStr(want), mountsStr(have))
351 }
352 }
353}
354
355func mountsStr(mounts []*Mount) string {
356 var out string
357 for i, m := range mounts {
358 out += fmt.Sprintf("[%d] %q on %q (%q)", i, m.Device, m.Mount, m.Type)
359
360 stats, ok := m.Stats.(*MountStatsNFS)
361 if !ok {
362 out += "\n"
363 continue
364 }
365
366 out += fmt.Sprintf("\n\t- v%s, age: %s", stats.StatVersion, stats.Age)
367 out += fmt.Sprintf("\n\t- bytes: %v", stats.Bytes)
368 out += fmt.Sprintf("\n\t- events: %v", stats.Events)
369 out += fmt.Sprintf("\n\t- transport: %v", stats.Transport)
370 out += fmt.Sprintf("\n\t- per-operation stats:")
371
372 for _, o := range stats.Operations {
373 out += fmt.Sprintf("\n\t\t- %v", o)
374 }
375
376 out += "\n"
377 }
378
379 return out
380}
diff --git a/vendor/github.com/prometheus/procfs/net_dev_test.go b/vendor/github.com/prometheus/procfs/net_dev_test.go
new file mode 100644
index 0000000..b162e9c
--- /dev/null
+++ b/vendor/github.com/prometheus/procfs/net_dev_test.go
@@ -0,0 +1,86 @@
1// Copyright 2018 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 "testing"
18)
19
20func TestNetDevParseLine(t *testing.T) {
21 const rawLine = ` eth0: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16`
22
23 have, err := NetDev{}.parseLine(rawLine)
24 if err != nil {
25 t.Fatal(err)
26 }
27
28 want := NetDevLine{"eth0", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}
29 if want != *have {
30 t.Errorf("want %v, have %v", want, have)
31 }
32}
33
34func TestNewNetDev(t *testing.T) {
35 fs, err := NewFS("fixtures")
36 if err != nil {
37 t.Fatal(err)
38 }
39
40 nd, err := fs.NewNetDev()
41 if err != nil {
42 t.Fatal(err)
43 }
44
45 lines := map[string]NetDevLine{
46 "vethf345468": {Name: "vethf345468", RxBytes: 648, RxPackets: 8, TxBytes: 438, TxPackets: 5},
47 "lo": {Name: "lo", RxBytes: 1664039048, RxPackets: 1566805, TxBytes: 1664039048, TxPackets: 1566805},
48 "docker0": {Name: "docker0", RxBytes: 2568, RxPackets: 38, TxBytes: 438, TxPackets: 5},
49 "eth0": {Name: "eth0", RxBytes: 874354587, RxPackets: 1036395, TxBytes: 563352563, TxPackets: 732147},
50 }
51
52 if want, have := len(lines), len(nd); want != have {
53 t.Errorf("want %d parsed net/dev lines, have %d", want, have)
54 }
55 for _, line := range nd {
56 if want, have := lines[line.Name], line; want != have {
57 t.Errorf("%s: want %v, have %v", line.Name, want, have)
58 }
59 }
60}
61
62func TestProcNewNetDev(t *testing.T) {
63 p, err := FS("fixtures").NewProc(26231)
64 if err != nil {
65 t.Fatal(err)
66 }
67
68 nd, err := p.NewNetDev()
69 if err != nil {
70 t.Fatal(err)
71 }
72
73 lines := map[string]NetDevLine{
74 "lo": {Name: "lo"},
75 "eth0": {Name: "eth0", RxBytes: 438, RxPackets: 5, TxBytes: 648, TxPackets: 8},
76 }
77
78 if want, have := len(lines), len(nd); want != have {
79 t.Errorf("want %d parsed net/dev lines, have %d", want, have)
80 }
81 for _, line := range nd {
82 if want, have := lines[line.Name], line; want != have {
83 t.Errorf("%s: want %v, have %v", line.Name, want, have)
84 }
85 }
86}
diff --git a/vendor/github.com/prometheus/procfs/nfs/parse_nfs_test.go b/vendor/github.com/prometheus/procfs/nfs/parse_nfs_test.go
new file mode 100644
index 0000000..8ebcfd1
--- /dev/null
+++ b/vendor/github.com/prometheus/procfs/nfs/parse_nfs_test.go
@@ -0,0 +1,305 @@
1// Copyright 2018 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 nfs_test
15
16import (
17 "reflect"
18 "strings"
19 "testing"
20
21 "github.com/prometheus/procfs/nfs"
22)
23
24func TestNewNFSClientRPCStats(t *testing.T) {
25 tests := []struct {
26 name string
27 content string
28 stats *nfs.ClientRPCStats
29 invalid bool
30 }{
31 {
32 name: "invalid file",
33 content: "invalid",
34 invalid: true,
35 }, {
36 name: "good old kernel version file",
37 content: `net 70 70 69 45
38rpc 1218785755 374636 1218815394
39proc2 18 16 57 74 52 71 73 45 86 0 52 83 61 17 53 50 23 70 82
40proc3 22 0 1061909262 48906 4077635 117661341 5 29391916 2570425 2993289 590 0 0 7815 15 1130 0 3983 92385 13332 2 1 23729
41proc4 48 98 51 54 83 85 23 24 1 28 73 68 83 12 84 39 68 59 58 88 29 74 69 96 21 84 15 53 86 54 66 56 97 36 49 32 85 81 11 58 32 67 13 28 35 90 1 26 1337
42`,
43 stats: &nfs.ClientRPCStats{
44 Network: nfs.Network{
45 NetCount: 70,
46 UDPCount: 70,
47 TCPCount: 69,
48 TCPConnect: 45,
49 },
50 ClientRPC: nfs.ClientRPC{
51 RPCCount: 1218785755,
52 Retransmissions: 374636,
53 AuthRefreshes: 1218815394,
54 },
55 V2Stats: nfs.V2Stats{
56 Null: 16,
57 GetAttr: 57,
58 SetAttr: 74,
59 Root: 52,
60 Lookup: 71,
61 ReadLink: 73,
62 Read: 45,
63 WrCache: 86,
64 Write: 0,
65 Create: 52,
66 Remove: 83,
67 Rename: 61,
68 Link: 17,
69 SymLink: 53,
70 MkDir: 50,
71 RmDir: 23,
72 ReadDir: 70,
73 FsStat: 82,
74 },
75 V3Stats: nfs.V3Stats{
76 Null: 0,
77 GetAttr: 1061909262,
78 SetAttr: 48906,
79 Lookup: 4077635,
80 Access: 117661341,
81 ReadLink: 5,
82 Read: 29391916,
83 Write: 2570425,
84 Create: 2993289,
85 MkDir: 590,
86 SymLink: 0,
87 MkNod: 0,
88 Remove: 7815,
89 RmDir: 15,
90 Rename: 1130,
91 Link: 0,
92 ReadDir: 3983,
93 ReadDirPlus: 92385,
94 FsStat: 13332,
95 FsInfo: 2,
96 PathConf: 1,
97 Commit: 23729},
98 ClientV4Stats: nfs.ClientV4Stats{
99 Null: 98,
100 Read: 51,
101 Write: 54,
102 Commit: 83,
103 Open: 85,
104 OpenConfirm: 23,
105 OpenNoattr: 24,
106 OpenDowngrade: 1,
107 Close: 28,
108 Setattr: 73,
109 FsInfo: 68,
110 Renew: 83,
111 SetClientID: 12,
112 SetClientIDConfirm: 84,
113 Lock: 39,
114 Lockt: 68,
115 Locku: 59,
116 Access: 58,
117 Getattr: 88,
118 Lookup: 29,
119 LookupRoot: 74,
120 Remove: 69,
121 Rename: 96,
122 Link: 21,
123 Symlink: 84,
124 Create: 15,
125 Pathconf: 53,
126 StatFs: 86,
127 ReadLink: 54,
128 ReadDir: 66,
129 ServerCaps: 56,
130 DelegReturn: 97,
131 GetACL: 36,
132 SetACL: 49,
133 FsLocations: 32,
134 ReleaseLockowner: 85,
135 Secinfo: 81,
136 FsidPresent: 11,
137 ExchangeID: 58,
138 CreateSession: 32,
139 DestroySession: 67,
140 Sequence: 13,
141 GetLeaseTime: 28,
142 ReclaimComplete: 35,
143 LayoutGet: 90,
144 GetDeviceInfo: 1,
145 LayoutCommit: 26,
146 LayoutReturn: 1337,
147 SecinfoNoName: 0,
148 TestStateID: 0,
149 FreeStateID: 0,
150 GetDeviceList: 0,
151 BindConnToSession: 0,
152 DestroyClientID: 0,
153 Seek: 0,
154 Allocate: 0,
155 DeAllocate: 0,
156 LayoutStats: 0,
157 Clone: 0,
158 },
159 },
160 }, {
161 name: "good file",
162 content: `net 18628 0 18628 6
163rpc 4329785 0 4338291
164proc2 18 2 69 0 0 4410 0 0 0 0 0 0 0 0 0 0 0 99 2
165proc3 22 1 4084749 29200 94754 32580 186 47747 7981 8639 0 6356 0 6962 0 7958 0 0 241 4 4 2 39
166proc4 61 1 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
167`,
168 stats: &nfs.ClientRPCStats{
169 Network: nfs.Network{
170 NetCount: 18628,
171 UDPCount: 0,
172 TCPCount: 18628,
173 TCPConnect: 6,
174 },
175 ClientRPC: nfs.ClientRPC{
176 RPCCount: 4329785,
177 Retransmissions: 0,
178 AuthRefreshes: 4338291,
179 },
180 V2Stats: nfs.V2Stats{
181 Null: 2,
182 GetAttr: 69,
183 SetAttr: 0,
184 Root: 0,
185 Lookup: 4410,
186 ReadLink: 0,
187 Read: 0,
188 WrCache: 0,
189 Write: 0,
190 Create: 0,
191 Remove: 0,
192 Rename: 0,
193 Link: 0,
194 SymLink: 0,
195 MkDir: 0,
196 RmDir: 0,
197 ReadDir: 99,
198 FsStat: 2,
199 },
200 V3Stats: nfs.V3Stats{
201 Null: 1,
202 GetAttr: 4084749,
203 SetAttr: 29200,
204 Lookup: 94754,
205 Access: 32580,
206 ReadLink: 186,
207 Read: 47747,
208 Write: 7981,
209 Create: 8639,
210 MkDir: 0,
211 SymLink: 6356,
212 MkNod: 0,
213 Remove: 6962,
214 RmDir: 0,
215 Rename: 7958,
216 Link: 0,
217 ReadDir: 0,
218 ReadDirPlus: 241,
219 FsStat: 4,
220 FsInfo: 4,
221 PathConf: 2,
222 Commit: 39,
223 },
224 ClientV4Stats: nfs.ClientV4Stats{
225 Null: 1,
226 Read: 0,
227 Write: 0,
228 Commit: 0,
229 Open: 0,
230 OpenConfirm: 0,
231 OpenNoattr: 0,
232 OpenDowngrade: 0,
233 Close: 0,
234 Setattr: 0,
235 FsInfo: 0,
236 Renew: 0,
237 SetClientID: 1,
238 SetClientIDConfirm: 1,
239 Lock: 0,
240 Lockt: 0,
241 Locku: 0,
242 Access: 0,
243 Getattr: 0,
244 Lookup: 0,
245 LookupRoot: 0,
246 Remove: 2,
247 Rename: 0,
248 Link: 0,
249 Symlink: 0,
250 Create: 0,
251 Pathconf: 0,
252 StatFs: 0,
253 ReadLink: 0,
254 ReadDir: 0,
255 ServerCaps: 0,
256 DelegReturn: 0,
257 GetACL: 0,
258 SetACL: 0,
259 FsLocations: 0,
260 ReleaseLockowner: 0,
261 Secinfo: 0,
262 FsidPresent: 0,
263 ExchangeID: 0,
264 CreateSession: 0,
265 DestroySession: 0,
266 Sequence: 0,
267 GetLeaseTime: 0,
268 ReclaimComplete: 0,
269 LayoutGet: 0,
270 GetDeviceInfo: 0,
271 LayoutCommit: 0,
272 LayoutReturn: 0,
273 SecinfoNoName: 0,
274 TestStateID: 0,
275 FreeStateID: 0,
276 GetDeviceList: 0,
277 BindConnToSession: 0,
278 DestroyClientID: 0,
279 Seek: 0,
280 Allocate: 0,
281 DeAllocate: 0,
282 LayoutStats: 0,
283 Clone: 0,
284 },
285 },
286 },
287 }
288
289 for _, tt := range tests {
290 t.Run(tt.name, func(t *testing.T) {
291 stats, err := nfs.ParseClientRPCStats(strings.NewReader(tt.content))
292
293 if tt.invalid && err == nil {
294 t.Fatal("expected an error, but none occurred")
295 }
296 if !tt.invalid && err != nil {
297 t.Fatalf("unexpected error: %v", err)
298 }
299
300 if want, have := tt.stats, stats; !reflect.DeepEqual(want, have) {
301 t.Fatalf("unexpected NFS stats:\nwant:\n%v\nhave:\n%v", want, have)
302 }
303 })
304 }
305}
diff --git a/vendor/github.com/prometheus/procfs/nfs/parse_nfsd_test.go b/vendor/github.com/prometheus/procfs/nfs/parse_nfsd_test.go
new file mode 100644
index 0000000..b09b3b5
--- /dev/null
+++ b/vendor/github.com/prometheus/procfs/nfs/parse_nfsd_test.go
@@ -0,0 +1,196 @@
1// Copyright 2018 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 nfs_test
15
16import (
17 "reflect"
18 "strings"
19 "testing"
20
21 "github.com/prometheus/procfs/nfs"
22)
23
24func TestNewNFSdServerRPCStats(t *testing.T) {
25 tests := []struct {
26 name string
27 content string
28 stats *nfs.ServerRPCStats
29 invalid bool
30 }{
31 {
32 name: "invalid file",
33 content: "invalid",
34 invalid: true,
35 }, {
36 name: "good file",
37 content: `rc 0 6 18622
38fh 0 0 0 0 0
39io 157286400 0
40th 8 0 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
41ra 32 0 0 0 0 0 0 0 0 0 0 0
42net 18628 0 18628 6
43rpc 18628 0 0 0 0
44proc2 18 2 69 0 0 4410 0 0 0 0 0 0 0 0 0 0 0 99 2
45proc3 22 2 112 0 2719 111 0 0 0 0 0 0 0 0 0 0 0 27 216 0 2 1 0
46proc4 2 2 10853
47proc4ops 72 0 0 0 1098 2 0 0 0 0 8179 5896 0 0 0 0 5900 0 0 2 0 2 0 9609 0 2 150 1272 0 0 0 1236 0 0 0 0 3 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
48`,
49 stats: &nfs.ServerRPCStats{
50 ReplyCache: nfs.ReplyCache{
51 Hits: 0,
52 Misses: 6,
53 NoCache: 18622,
54 },
55 FileHandles: nfs.FileHandles{
56 Stale: 0,
57 TotalLookups: 0,
58 AnonLookups: 0,
59 DirNoCache: 0,
60 NoDirNoCache: 0,
61 },
62 InputOutput: nfs.InputOutput{
63 Read: 157286400,
64 Write: 0,
65 },
66 Threads: nfs.Threads{
67 Threads: 8,
68 FullCnt: 0,
69 },
70 ReadAheadCache: nfs.ReadAheadCache{
71 CacheSize: 32,
72 CacheHistogram: []uint64{0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
73 NotFound: 0,
74 },
75 Network: nfs.Network{
76 NetCount: 18628,
77 UDPCount: 0,
78 TCPCount: 18628,
79 TCPConnect: 6,
80 },
81 ServerRPC: nfs.ServerRPC{
82 RPCCount: 18628,
83 BadCnt: 0,
84 BadFmt: 0,
85 BadAuth: 0,
86 BadcInt: 0,
87 },
88 V2Stats: nfs.V2Stats{
89 Null: 2,
90 GetAttr: 69,
91 SetAttr: 0,
92 Root: 0,
93 Lookup: 4410,
94 ReadLink: 0,
95 Read: 0,
96 WrCache: 0,
97 Write: 0,
98 Create: 0,
99 Remove: 0,
100 Rename: 0,
101 Link: 0,
102 SymLink: 0,
103 MkDir: 0,
104 RmDir: 0,
105 ReadDir: 99,
106 FsStat: 2,
107 },
108 V3Stats: nfs.V3Stats{
109 Null: 2,
110 GetAttr: 112,
111 SetAttr: 0,
112 Lookup: 2719,
113 Access: 111,
114 ReadLink: 0,
115 Read: 0,
116 Write: 0,
117 Create: 0,
118 MkDir: 0,
119 SymLink: 0,
120 MkNod: 0,
121 Remove: 0,
122 RmDir: 0,
123 Rename: 0,
124 Link: 0,
125 ReadDir: 27,
126 ReadDirPlus: 216,
127 FsStat: 0,
128 FsInfo: 2,
129 PathConf: 1,
130 Commit: 0,
131 },
132 ServerV4Stats: nfs.ServerV4Stats{
133 Null: 2,
134 Compound: 10853,
135 },
136 V4Ops: nfs.V4Ops{
137 Op0Unused: 0,
138 Op1Unused: 0,
139 Op2Future: 0,
140 Access: 1098,
141 Close: 2,
142 Commit: 0,
143 Create: 0,
144 DelegPurge: 0,
145 DelegReturn: 0,
146 GetAttr: 8179,
147 GetFH: 5896,
148 Link: 0,
149 Lock: 0,
150 Lockt: 0,
151 Locku: 0,
152 Lookup: 5900,
153 LookupRoot: 0,
154 Nverify: 0,
155 Open: 2,
156 OpenAttr: 0,
157 OpenConfirm: 2,
158 OpenDgrd: 0,
159 PutFH: 9609,
160 PutPubFH: 0,
161 PutRootFH: 2,
162 Read: 150,
163 ReadDir: 1272,
164 ReadLink: 0,
165 Remove: 0,
166 Rename: 0,
167 Renew: 1236,
168 RestoreFH: 0,
169 SaveFH: 0,
170 SecInfo: 0,
171 SetAttr: 0,
172 Verify: 3,
173 Write: 3,
174 RelLockOwner: 0,
175 },
176 },
177 },
178 }
179
180 for _, tt := range tests {
181 t.Run(tt.name, func(t *testing.T) {
182 stats, err := nfs.ParseServerRPCStats(strings.NewReader(tt.content))
183
184 if tt.invalid && err == nil {
185 t.Fatal("expected an error, but none occurred")
186 }
187 if !tt.invalid && err != nil {
188 t.Fatalf("unexpected error: %v", err)
189 }
190
191 if want, have := tt.stats, stats; !reflect.DeepEqual(want, have) {
192 t.Fatalf("unexpected NFS stats:\nwant:\n%v\nhave:\n%v", want, have)
193 }
194 })
195 }
196}
diff --git a/vendor/github.com/prometheus/procfs/proc_io_test.go b/vendor/github.com/prometheus/procfs/proc_io_test.go
new file mode 100644
index 0000000..1afdbd4
--- /dev/null
+++ b/vendor/github.com/prometheus/procfs/proc_io_test.go
@@ -0,0 +1,46 @@
1// Copyright 2018 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 "testing"
17
18func TestProcIO(t *testing.T) {
19 p, err := FS("fixtures").NewProc(26231)
20 if err != nil {
21 t.Fatal(err)
22 }
23
24 s, err := p.NewIO()
25 if err != nil {
26 t.Fatal(err)
27 }
28
29 for _, test := range []struct {
30 name string
31 want int64
32 have int64
33 }{
34 {name: "RChar", want: 750339, have: int64(s.RChar)},
35 {name: "WChar", want: 818609, have: int64(s.WChar)},
36 {name: "SyscR", want: 7405, have: int64(s.SyscR)},
37 {name: "SyscW", want: 5245, have: int64(s.SyscW)},
38 {name: "ReadBytes", want: 1024, have: int64(s.ReadBytes)},
39 {name: "WriteBytes", want: 2048, have: int64(s.WriteBytes)},
40 {name: "CancelledWriteBytes", want: -1024, have: s.CancelledWriteBytes},
41 } {
42 if test.want != test.have {
43 t.Errorf("want %s %d, have %d", test.name, test.want, test.have)
44 }
45 }
46}
diff --git a/vendor/github.com/prometheus/procfs/proc_limits_test.go b/vendor/github.com/prometheus/procfs/proc_limits_test.go
new file mode 100644
index 0000000..ebb43ae
--- /dev/null
+++ b/vendor/github.com/prometheus/procfs/proc_limits_test.go
@@ -0,0 +1,44 @@
1// Copyright 2018 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 "testing"
17
18func TestNewLimits(t *testing.T) {
19 p, err := FS("fixtures").NewProc(26231)
20 if err != nil {
21 t.Fatal(err)
22 }
23
24 l, err := p.NewLimits()
25 if err != nil {
26 t.Fatal(err)
27 }
28
29 for _, test := range []struct {
30 name string
31 want int64
32 have int64
33 }{
34 {name: "cpu time", want: -1, have: l.CPUTime},
35 {name: "open files", want: 2048, have: l.OpenFiles},
36 {name: "msgqueue size", want: 819200, have: l.MsqqueueSize},
37 {name: "nice priority", want: 0, have: l.NicePriority},
38 {name: "address space", want: 8589934592, have: l.AddressSpace},
39 } {
40 if test.want != test.have {
41 t.Errorf("want %s %d, have %d", test.name, test.want, test.have)
42 }
43 }
44}
diff --git a/vendor/github.com/prometheus/procfs/proc_ns_test.go b/vendor/github.com/prometheus/procfs/proc_ns_test.go
new file mode 100644
index 0000000..abfd63e
--- /dev/null
+++ b/vendor/github.com/prometheus/procfs/proc_ns_test.go
@@ -0,0 +1,44 @@
1// Copyright 2018 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 "testing"
18)
19
20func TestNewNamespaces(t *testing.T) {
21 p, err := FS("fixtures").NewProc(26231)
22 if err != nil {
23 t.Fatal(err)
24 }
25
26 namespaces, err := p.NewNamespaces()
27 if err != nil {
28 t.Fatal(err)
29 }
30
31 expectedNamespaces := map[string]Namespace{
32 "mnt": {"mnt", 4026531840},
33 "net": {"net", 4026531993},
34 }
35
36 if want, have := len(expectedNamespaces), len(namespaces); want != have {
37 t.Errorf("want %d parsed namespaces, have %d", want, have)
38 }
39 for _, ns := range namespaces {
40 if want, have := expectedNamespaces[ns.Type], ns; want != have {
41 t.Errorf("%s: want %v, have %v", ns.Type, want, have)
42 }
43 }
44}
diff --git a/vendor/github.com/prometheus/procfs/proc_stat_test.go b/vendor/github.com/prometheus/procfs/proc_stat_test.go
new file mode 100644
index 0000000..e2df884
--- /dev/null
+++ b/vendor/github.com/prometheus/procfs/proc_stat_test.go
@@ -0,0 +1,123 @@
1// Copyright 2018 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 "os"
18 "testing"
19)
20
21func TestProcStat(t *testing.T) {
22 p, err := FS("fixtures").NewProc(26231)
23 if err != nil {
24 t.Fatal(err)
25 }
26
27 s, err := p.NewStat()
28 if err != nil {
29 t.Fatal(err)
30 }
31
32 for _, test := range []struct {
33 name string
34 want int
35 have int
36 }{
37 {name: "pid", want: 26231, have: s.PID},
38 {name: "user time", want: 1677, have: int(s.UTime)},
39 {name: "system time", want: 44, have: int(s.STime)},
40 {name: "start time", want: 82375, have: int(s.Starttime)},
41 {name: "virtual memory size", want: 56274944, have: s.VSize},
42 {name: "resident set size", want: 1981, have: s.RSS},
43 } {
44 if test.want != test.have {
45 t.Errorf("want %s %d, have %d", test.name, test.want, test.have)
46 }
47 }
48}
49
50func TestProcStatComm(t *testing.T) {
51 s1, err := testProcStat(26231)
52 if err != nil {
53 t.Fatal(err)
54 }
55 if want, have := "vim", s1.Comm; want != have {
56 t.Errorf("want comm %s, have %s", want, have)
57 }
58
59 s2, err := testProcStat(584)
60 if err != nil {
61 t.Fatal(err)
62 }
63 if want, have := "(a b ) ( c d) ", s2.Comm; want != have {
64 t.Errorf("want comm %s, have %s", want, have)
65 }
66}
67
68func TestProcStatVirtualMemory(t *testing.T) {
69 s, err := testProcStat(26231)
70 if err != nil {
71 t.Fatal(err)
72 }
73
74 if want, have := 56274944, s.VirtualMemory(); want != have {
75 t.Errorf("want virtual memory %d, have %d", want, have)
76 }
77}
78
79func TestProcStatResidentMemory(t *testing.T) {
80 s, err := testProcStat(26231)
81 if err != nil {
82 t.Fatal(err)
83 }
84
85 if want, have := 1981*os.Getpagesize(), s.ResidentMemory(); want != have {
86 t.Errorf("want resident memory %d, have %d", want, have)
87 }
88}
89
90func TestProcStatStartTime(t *testing.T) {
91 s, err := testProcStat(26231)
92 if err != nil {
93 t.Fatal(err)
94 }
95
96 time, err := s.StartTime()
97 if err != nil {
98 t.Fatal(err)
99 }
100 if want, have := 1418184099.75, time; want != have {
101 t.Errorf("want start time %f, have %f", want, have)
102 }
103}
104
105func TestProcStatCPUTime(t *testing.T) {
106 s, err := testProcStat(26231)
107 if err != nil {
108 t.Fatal(err)
109 }
110
111 if want, have := 17.21, s.CPUTime(); want != have {
112 t.Errorf("want cpu time %f, have %f", want, have)
113 }
114}
115
116func testProcStat(pid int) (ProcStat, error) {
117 p, err := FS("fixtures").NewProc(pid)
118 if err != nil {
119 return ProcStat{}, err
120 }
121
122 return p.NewStat()
123}
diff --git a/vendor/github.com/prometheus/procfs/proc_test.go b/vendor/github.com/prometheus/procfs/proc_test.go
new file mode 100644
index 0000000..ee7e69d
--- /dev/null
+++ b/vendor/github.com/prometheus/procfs/proc_test.go
@@ -0,0 +1,174 @@
1// Copyright 2018 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 "reflect"
18 "sort"
19 "testing"
20)
21
22func TestSelf(t *testing.T) {
23 fs := FS("fixtures")
24
25 p1, err := fs.NewProc(26231)
26 if err != nil {
27 t.Fatal(err)
28 }
29 p2, err := fs.Self()
30 if err != nil {
31 t.Fatal(err)
32 }
33
34 if !reflect.DeepEqual(p1, p2) {
35 t.Errorf("want process %v, have %v", p1, p2)
36 }
37}
38
39func TestAllProcs(t *testing.T) {
40 procs, err := FS("fixtures").AllProcs()
41 if err != nil {
42 t.Fatal(err)
43 }
44 sort.Sort(procs)
45 for i, p := range []*Proc{{PID: 584}, {PID: 26231}} {
46 if want, have := p.PID, procs[i].PID; want != have {
47 t.Errorf("want processes %d, have %d", want, have)
48 }
49 }
50}
51
52func TestCmdLine(t *testing.T) {
53 for _, tt := range []struct {
54 process int
55 want []string
56 }{
57 {process: 26231, want: []string{"vim", "test.go", "+10"}},
58 {process: 26232, want: []string{}},
59 {process: 26233, want: []string{"com.github.uiautomator"}},
60 } {
61 p1, err := FS("fixtures").NewProc(tt.process)
62 if err != nil {
63 t.Fatal(err)
64 }
65 c1, err := p1.CmdLine()
66 if err != nil {
67 t.Fatal(err)
68 }
69 if !reflect.DeepEqual(tt.want, c1) {
70 t.Errorf("want cmdline %v, have %v", tt.want, c1)
71 }
72 }
73}
74
75func TestComm(t *testing.T) {
76 for _, tt := range []struct {
77 process int
78 want string
79 }{
80 {process: 26231, want: "vim"},
81 {process: 26232, want: "ata_sff"},
82 } {
83 p1, err := FS("fixtures").NewProc(tt.process)
84 if err != nil {
85 t.Fatal(err)
86 }
87 c1, err := p1.Comm()
88 if err != nil {
89 t.Fatal(err)
90 }
91 if !reflect.DeepEqual(tt.want, c1) {
92 t.Errorf("want comm %v, have %v", tt.want, c1)
93 }
94 }
95}
96
97func TestExecutable(t *testing.T) {
98 for _, tt := range []struct {
99 process int
100 want string
101 }{
102 {process: 26231, want: "/usr/bin/vim"},
103 {process: 26232, want: ""},
104 } {
105 p, err := FS("fixtures").NewProc(tt.process)
106 if err != nil {
107 t.Fatal(err)
108 }
109 exe, err := p.Executable()
110 if err != nil {
111 t.Fatal(err)
112 }
113 if !reflect.DeepEqual(tt.want, exe) {
114 t.Errorf("want absolute path to cmdline %v, have %v", tt.want, exe)
115 }
116 }
117}
118
119func TestFileDescriptors(t *testing.T) {
120 p1, err := FS("fixtures").NewProc(26231)
121 if err != nil {
122 t.Fatal(err)
123 }
124 fds, err := p1.FileDescriptors()
125 if err != nil {
126 t.Fatal(err)
127 }
128 sort.Sort(byUintptr(fds))
129 if want := []uintptr{0, 1, 2, 3, 10}; !reflect.DeepEqual(want, fds) {
130 t.Errorf("want fds %v, have %v", want, fds)
131 }
132}
133
134func TestFileDescriptorTargets(t *testing.T) {
135 p1, err := FS("fixtures").NewProc(26231)
136 if err != nil {
137 t.Fatal(err)
138 }
139 fds, err := p1.FileDescriptorTargets()
140 if err != nil {
141 t.Fatal(err)
142 }
143 sort.Strings(fds)
144 var want = []string{
145 "../../symlinktargets/abc",
146 "../../symlinktargets/def",
147 "../../symlinktargets/ghi",
148 "../../symlinktargets/uvw",
149 "../../symlinktargets/xyz",
150 }
151 if !reflect.DeepEqual(want, fds) {
152 t.Errorf("want fds %v, have %v", want, fds)
153 }
154}
155
156func TestFileDescriptorsLen(t *testing.T) {
157 p1, err := FS("fixtures").NewProc(26231)
158 if err != nil {
159 t.Fatal(err)
160 }
161 l, err := p1.FileDescriptorsLen()
162 if err != nil {
163 t.Fatal(err)
164 }
165 if want, have := 5, l; want != have {
166 t.Errorf("want fds %d, have %d", want, have)
167 }
168}
169
170type byUintptr []uintptr
171
172func (a byUintptr) Len() int { return len(a) }
173func (a byUintptr) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
174func (a byUintptr) Less(i, j int) bool { return a[i] < a[j] }
diff --git a/vendor/github.com/prometheus/procfs/scripts/check_license.sh b/vendor/github.com/prometheus/procfs/scripts/check_license.sh
new file mode 100755
index 0000000..ac13e96
--- /dev/null
+++ b/vendor/github.com/prometheus/procfs/scripts/check_license.sh
@@ -0,0 +1,29 @@
1#!/bin/sh
2#
3# Copyright 2018 The Prometheus Authors
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16check_license() {
17 local file=""
18 for file in $(find . -type f -iname '*.go' ! -path './vendor/*'); do
19 head -n3 "${file}" | grep -Eq "(Copyright|generated|GENERATED)" || echo " ${file}"
20 done
21}
22
23licRes=$(check_license)
24
25if [ -n "${licRes}" ]; then
26 echo "license header checking failed:"
27 echo "${licRes}"
28 exit 255
29fi
diff --git a/vendor/github.com/prometheus/procfs/stat_test.go b/vendor/github.com/prometheus/procfs/stat_test.go
new file mode 100644
index 0000000..2043b5e
--- /dev/null
+++ b/vendor/github.com/prometheus/procfs/stat_test.go
@@ -0,0 +1,74 @@
1// Copyright 2018 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 "testing"
17
18func TestStat(t *testing.T) {
19 s, err := FS("fixtures").NewStat()
20 if err != nil {
21 t.Fatal(err)
22 }
23
24 // cpu
25 if want, have := float64(301854)/userHZ, s.CPUTotal.User; want != have {
26 t.Errorf("want cpu/user %v, have %v", want, have)
27 }
28 if want, have := float64(31)/userHZ, s.CPU[7].SoftIRQ; want != have {
29 t.Errorf("want cpu7/softirq %v, have %v", want, have)
30 }
31
32 // intr
33 if want, have := uint64(8885917), s.IRQTotal; want != have {
34 t.Errorf("want irq/total %d, have %d", want, have)
35 }
36 if want, have := uint64(1), s.IRQ[8]; want != have {
37 t.Errorf("want irq8 %d, have %d", want, have)
38 }
39
40 // ctxt
41 if want, have := uint64(38014093), s.ContextSwitches; want != have {
42 t.Errorf("want context switches (ctxt) %d, have %d", want, have)
43 }
44
45 // btime
46 if want, have := uint64(1418183276), s.BootTime; want != have {
47 t.Errorf("want boot time (btime) %d, have %d", want, have)
48 }
49
50 // processes
51 if want, have := uint64(26442), s.ProcessCreated; want != have {
52 t.Errorf("want process created (processes) %d, have %d", want, have)
53 }
54
55 // procs_running
56 if want, have := uint64(2), s.ProcessesRunning; want != have {
57 t.Errorf("want processes running (procs_running) %d, have %d", want, have)
58 }
59
60 // procs_blocked
61 if want, have := uint64(1), s.ProcessesBlocked; want != have {
62 t.Errorf("want processes blocked (procs_blocked) %d, have %d", want, have)
63 }
64
65 // softirq
66 if want, have := uint64(5057579), s.SoftIRQTotal; want != have {
67 t.Errorf("want softirq total %d, have %d", want, have)
68 }
69
70 if want, have := uint64(508444), s.SoftIRQ.Rcu; want != have {
71 t.Errorf("want softirq RCU %d, have %d", want, have)
72 }
73
74}
diff --git a/vendor/github.com/prometheus/procfs/sysfs/.gitignore b/vendor/github.com/prometheus/procfs/sysfs/.gitignore
new file mode 100644
index 0000000..67fc140
--- /dev/null
+++ b/vendor/github.com/prometheus/procfs/sysfs/.gitignore
@@ -0,0 +1 @@
fixtures/
diff --git a/vendor/github.com/prometheus/procfs/sysfs/fixtures.ttar b/vendor/github.com/prometheus/procfs/sysfs/fixtures.ttar
index 8e665ce..9731b50 100644
--- a/vendor/github.com/prometheus/procfs/sysfs/fixtures.ttar
+++ b/vendor/github.com/prometheus/procfs/sysfs/fixtures.ttar
@@ -1,7 +1,142 @@
1# Archive created by ttar -c -f fixtures.ttar fixtures/ 1# Archive created by ttar -C sysfs/ -c -f sysfs/fixtures.ttar fixtures/
2Directory: fixtures 2Directory: fixtures
3Mode: 755 3Mode: 755
4# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 4# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5Directory: fixtures/class
6Mode: 775
7# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
8Directory: fixtures/class/net
9Mode: 775
10# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
11Directory: fixtures/class/net/eth0
12Mode: 755
13# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
14Path: fixtures/class/net/eth0/addr_assign_type
15Lines: 1
163
17Mode: 644
18# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
19Path: fixtures/class/net/eth0/addr_len
20Lines: 1
216
22Mode: 644
23# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
24Path: fixtures/class/net/eth0/address
25Lines: 1
2601:01:01:01:01:01
27Mode: 644
28# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
29Path: fixtures/class/net/eth0/broadcast
30Lines: 1
31ff:ff:ff:ff:ff:ff
32Mode: 644
33# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
34Path: fixtures/class/net/eth0/carrier
35Lines: 1
361
37Mode: 644
38# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
39Path: fixtures/class/net/eth0/carrier_changes
40Lines: 1
412
42Mode: 644
43# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
44Path: fixtures/class/net/eth0/carrier_down_count
45Lines: 1
461
47Mode: 644
48# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
49Path: fixtures/class/net/eth0/carrier_up_count
50Lines: 1
511
52Mode: 644
53# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
54Path: fixtures/class/net/eth0/dev_id
55Lines: 1
560x20
57Mode: 644
58# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
59Path: fixtures/class/net/eth0/dormant
60Lines: 1
611
62Mode: 644
63# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
64Path: fixtures/class/net/eth0/duplex
65Lines: 1
66full
67Mode: 644
68# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
69Path: fixtures/class/net/eth0/flags
70Lines: 1
710x1303
72Mode: 644
73# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
74Path: fixtures/class/net/eth0/ifalias
75Lines: 0
76Mode: 644
77# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
78Path: fixtures/class/net/eth0/ifindex
79Lines: 1
802
81Mode: 644
82# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
83Path: fixtures/class/net/eth0/iflink
84Lines: 1
852
86Mode: 644
87# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
88Path: fixtures/class/net/eth0/link_mode
89Lines: 1
901
91Mode: 644
92# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
93Path: fixtures/class/net/eth0/mtu
94Lines: 1
951500
96Mode: 644
97# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
98Path: fixtures/class/net/eth0/name_assign_type
99Lines: 1
1002
101Mode: 644
102# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
103Path: fixtures/class/net/eth0/netdev_group
104Lines: 1
1050
106Mode: 644
107# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
108Path: fixtures/class/net/eth0/operstate
109Lines: 1
110up
111Mode: 644
112# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
113Path: fixtures/class/net/eth0/phys_port_id
114Lines: 0
115Mode: 644
116# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
117Path: fixtures/class/net/eth0/phys_port_name
118Lines: 0
119Mode: 644
120# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
121Path: fixtures/class/net/eth0/phys_switch_id
122Lines: 0
123Mode: 644
124# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
125Path: fixtures/class/net/eth0/speed
126Lines: 1
1271000
128Mode: 644
129# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
130Path: fixtures/class/net/eth0/tx_queue_len
131Lines: 1
1321000
133Mode: 644
134# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
135Path: fixtures/class/net/eth0/type
136Lines: 1
1371
138Mode: 644
139# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5Directory: fixtures/devices 140Directory: fixtures/devices
6Mode: 755 141Mode: 755
7# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 142# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -720,132 +855,3 @@ Lines: 1
720extent_alloc 2 0 0 0 855extent_alloc 2 0 0 0
721Mode: 644 856Mode: 644
722# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 857# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
723Directory: fixtures/class/net/eth0/
724Mode: 755
725# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
726Path: fixtures/class/net/eth0/addr_assign_type
727Lines: 1
7283
729Mode: 644
730# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
731Path: fixtures/class/net/eth0/addr_len
732Lines: 1
7336
734Mode: 644
735# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
736Path: fixtures/class/net/eth0/address
737Lines: 1
73801:01:01:01:01:01
739Mode: 644
740# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
741Path: fixtures/class/net/eth0/broadcast
742Lines: 1
743ff:ff:ff:ff:ff:ff
744Mode: 644
745# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
746Path: fixtures/class/net/eth0/carrier
747Lines: 1
7481
749Mode: 644
750# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
751Path: fixtures/class/net/eth0/carrier_changes
752Lines: 1
7532
754Mode: 644
755# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
756Path: fixtures/class/net/eth0/carrier_down_count
757Lines: 1
7581
759Mode: 644
760# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
761Path: fixtures/class/net/eth0/carrier_up_count
762Lines: 1
7631
764Mode: 644
765# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
766Path: fixtures/class/net/eth0/dev_id
767Lines: 1
7680x20
769Mode: 644
770# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
771Path: fixtures/class/net/eth0/dormant
772Lines: 1
7731
774Mode: 644
775# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
776Path: fixtures/class/net/eth0/duplex
777Lines: 1
778full
779Mode: 644
780# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
781Path: fixtures/class/net/eth0/flags
782Lines: 1
7830x1303
784Mode: 644
785# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
786Path: fixtures/class/net/eth0/ifalias
787Lines: 0
788Mode: 644
789# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
790Path: fixtures/class/net/eth0/ifindex
791Lines: 1
7922
793Mode: 644
794# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
795Path: fixtures/class/net/eth0/iflink
796Lines: 1
7972
798Mode: 644
799# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
800Path: fixtures/class/net/eth0/link_mode
801Lines: 1
8021
803Mode: 644
804# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
805Path: fixtures/class/net/eth0/mtu
806Lines: 1
8071500
808Mode: 644
809# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
810Path: fixtures/class/net/eth0/name_assign_type
811Lines: 1
8122
813Mode: 644
814# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
815Path: fixtures/class/net/eth0/netdev_group
816Lines: 1
8170
818Mode: 644
819# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
820Path: fixtures/class/net/eth0/operstate
821Lines: 1
822up
823Mode: 644
824# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
825Path: fixtures/class/net/eth0/phys_port_id
826Lines: 0
827Mode: 644
828# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
829Path: fixtures/class/net/eth0/phys_port_name
830Lines: 0
831Mode: 644
832# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
833Path: fixtures/class/net/eth0/phys_switch_id
834Lines: 0
835Mode: 644
836# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
837Path: fixtures/class/net/eth0/speed
838Lines: 1
8391000
840Mode: 644
841# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
842Path: fixtures/class/net/eth0/tx_queue_len
843Lines: 1
8441000
845Mode: 644
846# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
847Path: fixtures/class/net/eth0/type
848Lines: 1
8491
850Mode: 644
851# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file
diff --git a/vendor/github.com/prometheus/procfs/sysfs/fs_test.go b/vendor/github.com/prometheus/procfs/sysfs/fs_test.go
new file mode 100644
index 0000000..2b7402e
--- /dev/null
+++ b/vendor/github.com/prometheus/procfs/sysfs/fs_test.go
@@ -0,0 +1,108 @@
1// Copyright 2017 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 sysfs
15
16import "testing"
17
18func TestNewFS(t *testing.T) {
19 if _, err := NewFS("foobar"); err == nil {
20 t.Error("want NewFS to fail for non-existing mount point")
21 }
22
23 if _, err := NewFS("doc.go"); err == nil {
24 t.Error("want NewFS to fail if mount point is not a directory")
25 }
26}
27
28func TestFSXFSStats(t *testing.T) {
29 stats, err := FS("fixtures").XFSStats()
30 if err != nil {
31 t.Fatalf("failed to parse XFS stats: %v", err)
32 }
33
34 tests := []struct {
35 name string
36 allocated uint32
37 }{
38 {
39 name: "sda1",
40 allocated: 1,
41 },
42 {
43 name: "sdb1",
44 allocated: 2,
45 },
46 }
47
48 const expect = 2
49
50 if l := len(stats); l != expect {
51 t.Fatalf("unexpected number of XFS stats: %d", l)
52 }
53 if l := len(tests); l != expect {
54 t.Fatalf("unexpected number of tests: %d", l)
55 }
56
57 for i, tt := range tests {
58 if want, got := tt.name, stats[i].Name; want != got {
59 t.Errorf("unexpected stats name:\nwant: %q\nhave: %q", want, got)
60 }
61
62 if want, got := tt.allocated, stats[i].ExtentAllocation.ExtentsAllocated; want != got {
63 t.Errorf("unexpected extents allocated:\nwant: %d\nhave: %d", want, got)
64 }
65 }
66}
67
68func TestFSBcacheStats(t *testing.T) {
69 stats, err := FS("fixtures").BcacheStats()
70 if err != nil {
71 t.Fatalf("failed to parse bcache stats: %v", err)
72 }
73
74 tests := []struct {
75 name string
76 bdevs int
77 caches int
78 }{
79 {
80 name: "deaddd54-c735-46d5-868e-f331c5fd7c74",
81 bdevs: 1,
82 caches: 1,
83 },
84 }
85
86 const expect = 1
87
88 if l := len(stats); l != expect {
89 t.Fatalf("unexpected number of bcache stats: %d", l)
90 }
91 if l := len(tests); l != expect {
92 t.Fatalf("unexpected number of tests: %d", l)
93 }
94
95 for i, tt := range tests {
96 if want, got := tt.name, stats[i].Name; want != got {
97 t.Errorf("unexpected stats name:\nwant: %q\nhave: %q", want, got)
98 }
99
100 if want, got := tt.bdevs, len(stats[i].Bdevs); want != got {
101 t.Errorf("unexpected value allocated:\nwant: %d\nhave: %d", want, got)
102 }
103
104 if want, got := tt.caches, len(stats[i].Caches); want != got {
105 t.Errorf("unexpected value allocated:\nwant: %d\nhave: %d", want, got)
106 }
107 }
108}
diff --git a/vendor/github.com/prometheus/procfs/sysfs/net_class_test.go b/vendor/github.com/prometheus/procfs/sysfs/net_class_test.go
new file mode 100644
index 0000000..e6d05f0
--- /dev/null
+++ b/vendor/github.com/prometheus/procfs/sysfs/net_class_test.go
@@ -0,0 +1,88 @@
1// Copyright 2018 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 sysfs
15
16import (
17 "reflect"
18 "testing"
19)
20
21func TestNewNetClass(t *testing.T) {
22 fs, err := NewFS("fixtures")
23 if err != nil {
24 t.Fatal(err)
25 }
26
27 nc, err := fs.NewNetClass()
28 if err != nil {
29 t.Fatal(err)
30 }
31
32 var (
33 addrAssignType int64 = 3
34 addrLen int64 = 6
35 carrier int64 = 1
36 carrierChanges int64 = 2
37 carrierDownCount int64 = 1
38 carrierUpCount int64 = 1
39 devID int64 = 32
40 dormant int64 = 1
41 flags int64 = 4867
42 ifIndex int64 = 2
43 ifLink int64 = 2
44 linkMode int64 = 1
45 mtu int64 = 1500
46 nameAssignType int64 = 2
47 netDevGroup int64 = 0
48 speed int64 = 1000
49 txQueueLen int64 = 1000
50 netType int64 = 1
51 )
52
53 netClass := NetClass{
54 "eth0": {
55 Address: "01:01:01:01:01:01",
56 AddrAssignType: &addrAssignType,
57 AddrLen: &addrLen,
58 Broadcast: "ff:ff:ff:ff:ff:ff",
59 Carrier: &carrier,
60 CarrierChanges: &carrierChanges,
61 CarrierDownCount: &carrierDownCount,
62 CarrierUpCount: &carrierUpCount,
63 DevID: &devID,
64 Dormant: &dormant,
65 Duplex: "full",
66 Flags: &flags,
67 IfAlias: "",
68 IfIndex: &ifIndex,
69 IfLink: &ifLink,
70 LinkMode: &linkMode,
71 MTU: &mtu,
72 Name: "eth0",
73 NameAssignType: &nameAssignType,
74 NetDevGroup: &netDevGroup,
75 OperState: "up",
76 PhysPortID: "",
77 PhysPortName: "",
78 PhysSwitchID: "",
79 Speed: &speed,
80 TxQueueLen: &txQueueLen,
81 Type: &netType,
82 },
83 }
84
85 if !reflect.DeepEqual(netClass, nc) {
86 t.Errorf("Result not correct: want %v, have %v", netClass, nc)
87 }
88}
diff --git a/vendor/github.com/prometheus/procfs/xfrm.go b/vendor/github.com/prometheus/procfs/xfrm.go
index ffe9df5..8f1508f 100644
--- a/vendor/github.com/prometheus/procfs/xfrm.go
+++ b/vendor/github.com/prometheus/procfs/xfrm.go
@@ -113,7 +113,7 @@ func (fs FS) NewXfrmStat() (XfrmStat, error) {
113 113
114 if len(fields) != 2 { 114 if len(fields) != 2 {
115 return XfrmStat{}, fmt.Errorf( 115 return XfrmStat{}, fmt.Errorf(
116 "couldnt parse %s line %s", file.Name(), s.Text()) 116 "couldn't parse %s line %s", file.Name(), s.Text())
117 } 117 }
118 118
119 name := fields[0] 119 name := fields[0]
diff --git a/vendor/github.com/prometheus/procfs/xfrm_test.go b/vendor/github.com/prometheus/procfs/xfrm_test.go
new file mode 100644
index 0000000..5918c39
--- /dev/null
+++ b/vendor/github.com/prometheus/procfs/xfrm_test.go
@@ -0,0 +1,66 @@
1// Copyright 2017 Prometheus Team
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 "testing"
18)
19
20func TestXfrmStats(t *testing.T) {
21 xfrmStats, err := FS("fixtures").NewXfrmStat()
22 if err != nil {
23 t.Fatal(err)
24 }
25
26 for _, test := range []struct {
27 name string
28 want int
29 got int
30 }{
31 {name: "XfrmInError", want: 1, got: xfrmStats.XfrmInError},
32 {name: "XfrmInBufferError", want: 2, got: xfrmStats.XfrmInBufferError},
33 {name: "XfrmInHdrError", want: 4, got: xfrmStats.XfrmInHdrError},
34 {name: "XfrmInNoStates", want: 3, got: xfrmStats.XfrmInNoStates},
35 {name: "XfrmInStateProtoError", want: 40, got: xfrmStats.XfrmInStateProtoError},
36 {name: "XfrmInStateModeError", want: 100, got: xfrmStats.XfrmInStateModeError},
37 {name: "XfrmInStateSeqError", want: 6000, got: xfrmStats.XfrmInStateSeqError},
38 {name: "XfrmInStateExpired", want: 4, got: xfrmStats.XfrmInStateExpired},
39 {name: "XfrmInStateMismatch", want: 23451, got: xfrmStats.XfrmInStateMismatch},
40 {name: "XfrmInStateInvalid", want: 55555, got: xfrmStats.XfrmInStateInvalid},
41 {name: "XfrmInTmplMismatch", want: 51, got: xfrmStats.XfrmInTmplMismatch},
42 {name: "XfrmInNoPols", want: 65432, got: xfrmStats.XfrmInNoPols},
43 {name: "XfrmInPolBlock", want: 100, got: xfrmStats.XfrmInPolBlock},
44 {name: "XfrmInPolError", want: 10000, got: xfrmStats.XfrmInPolError},
45 {name: "XfrmOutError", want: 1000000, got: xfrmStats.XfrmOutError},
46 {name: "XfrmOutBundleGenError", want: 43321, got: xfrmStats.XfrmOutBundleGenError},
47 {name: "XfrmOutBundleCheckError", want: 555, got: xfrmStats.XfrmOutBundleCheckError},
48 {name: "XfrmOutNoStates", want: 869, got: xfrmStats.XfrmOutNoStates},
49 {name: "XfrmOutStateProtoError", want: 4542, got: xfrmStats.XfrmOutStateProtoError},
50 {name: "XfrmOutStateModeError", want: 4, got: xfrmStats.XfrmOutStateModeError},
51 {name: "XfrmOutStateSeqError", want: 543, got: xfrmStats.XfrmOutStateSeqError},
52 {name: "XfrmOutStateExpired", want: 565, got: xfrmStats.XfrmOutStateExpired},
53 {name: "XfrmOutPolBlock", want: 43456, got: xfrmStats.XfrmOutPolBlock},
54 {name: "XfrmOutPolDead", want: 7656, got: xfrmStats.XfrmOutPolDead},
55 {name: "XfrmOutPolError", want: 1454, got: xfrmStats.XfrmOutPolError},
56 {name: "XfrmFwdHdrError", want: 6654, got: xfrmStats.XfrmFwdHdrError},
57 {name: "XfrmOutStateInvaliad", want: 28765, got: xfrmStats.XfrmOutStateInvalid},
58 {name: "XfrmAcquireError", want: 24532, got: xfrmStats.XfrmAcquireError},
59 {name: "XfrmInStateInvalid", want: 55555, got: xfrmStats.XfrmInStateInvalid},
60 {name: "XfrmOutError", want: 1000000, got: xfrmStats.XfrmOutError},
61 } {
62 if test.want != test.got {
63 t.Errorf("Want %s %d, have %d", test.name, test.want, test.got)
64 }
65 }
66}
diff --git a/vendor/github.com/prometheus/procfs/xfs/parse_test.go b/vendor/github.com/prometheus/procfs/xfs/parse_test.go
new file mode 100644
index 0000000..2e946c2
--- /dev/null
+++ b/vendor/github.com/prometheus/procfs/xfs/parse_test.go
@@ -0,0 +1,442 @@
1// Copyright 2017 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 xfs_test
15
16import (
17 "reflect"
18 "strings"
19 "testing"
20
21 "github.com/prometheus/procfs"
22 "github.com/prometheus/procfs/xfs"
23)
24
25func TestParseStats(t *testing.T) {
26 tests := []struct {
27 name string
28 s string
29 fs bool
30 stats *xfs.Stats
31 invalid bool
32 }{
33 {
34 name: "empty file OK",
35 },
36 {
37 name: "short or empty lines and unknown labels ignored",
38 s: "one\n\ntwo 1 2 3\n",
39 stats: &xfs.Stats{},
40 },
41 {
42 name: "bad uint32",
43 s: "extent_alloc XXX",
44 invalid: true,
45 },
46 {
47 name: "bad uint64",
48 s: "xpc XXX",
49 invalid: true,
50 },
51 {
52 name: "extent_alloc bad",
53 s: "extent_alloc 1",
54 invalid: true,
55 },
56 {
57 name: "extent_alloc OK",
58 s: "extent_alloc 1 2 3 4",
59 stats: &xfs.Stats{
60 ExtentAllocation: xfs.ExtentAllocationStats{
61 ExtentsAllocated: 1,
62 BlocksAllocated: 2,
63 ExtentsFreed: 3,
64 BlocksFreed: 4,
65 },
66 },
67 },
68 {
69 name: "abt bad",
70 s: "abt 1",
71 invalid: true,
72 },
73 {
74 name: "abt OK",
75 s: "abt 1 2 3 4",
76 stats: &xfs.Stats{
77 AllocationBTree: xfs.BTreeStats{
78 Lookups: 1,
79 Compares: 2,
80 RecordsInserted: 3,
81 RecordsDeleted: 4,
82 },
83 },
84 },
85 {
86 name: "blk_map bad",
87 s: "blk_map 1",
88 invalid: true,
89 },
90 {
91 name: "blk_map OK",
92 s: "blk_map 1 2 3 4 5 6 7",
93 stats: &xfs.Stats{
94 BlockMapping: xfs.BlockMappingStats{
95 Reads: 1,
96 Writes: 2,
97 Unmaps: 3,
98 ExtentListInsertions: 4,
99 ExtentListDeletions: 5,
100 ExtentListLookups: 6,
101 ExtentListCompares: 7,
102 },
103 },
104 },
105 {
106 name: "bmbt bad",
107 s: "bmbt 1",
108 invalid: true,
109 },
110 {
111 name: "bmbt OK",
112 s: "bmbt 1 2 3 4",
113 stats: &xfs.Stats{
114 BlockMapBTree: xfs.BTreeStats{
115 Lookups: 1,
116 Compares: 2,
117 RecordsInserted: 3,
118 RecordsDeleted: 4,
119 },
120 },
121 },
122 {
123 name: "dir bad",
124 s: "dir 1",
125 invalid: true,
126 },
127 {
128 name: "dir OK",
129 s: "dir 1 2 3 4",
130 stats: &xfs.Stats{
131 DirectoryOperation: xfs.DirectoryOperationStats{
132 Lookups: 1,
133 Creates: 2,
134 Removes: 3,
135 Getdents: 4,
136 },
137 },
138 },
139 {
140 name: "trans bad",
141 s: "trans 1",
142 invalid: true,
143 },
144 {
145 name: "trans OK",
146 s: "trans 1 2 3",
147 stats: &xfs.Stats{
148 Transaction: xfs.TransactionStats{
149 Sync: 1,
150 Async: 2,
151 Empty: 3,
152 },
153 },
154 },
155 {
156 name: "ig bad",
157 s: "ig 1",
158 invalid: true,
159 },
160 {
161 name: "ig OK",
162 s: "ig 1 2 3 4 5 6 7",
163 stats: &xfs.Stats{
164 InodeOperation: xfs.InodeOperationStats{
165 Attempts: 1,
166 Found: 2,
167 Recycle: 3,
168 Missed: 4,
169 Duplicate: 5,
170 Reclaims: 6,
171 AttributeChange: 7,
172 },
173 },
174 },
175 {
176 name: "log bad",
177 s: "log 1",
178 invalid: true,
179 },
180 {
181 name: "log OK",
182 s: "log 1 2 3 4 5",
183 stats: &xfs.Stats{
184 LogOperation: xfs.LogOperationStats{
185 Writes: 1,
186 Blocks: 2,
187 NoInternalBuffers: 3,
188 Force: 4,
189 ForceSleep: 5,
190 },
191 },
192 },
193 {
194 name: "rw bad",
195 s: "rw 1",
196 invalid: true,
197 },
198 {
199 name: "rw OK",
200 s: "rw 1 2",
201 stats: &xfs.Stats{
202 ReadWrite: xfs.ReadWriteStats{
203 Read: 1,
204 Write: 2,
205 },
206 },
207 },
208 {
209 name: "attr bad",
210 s: "attr 1",
211 invalid: true,
212 },
213 {
214 name: "attr OK",
215 s: "attr 1 2 3 4",
216 stats: &xfs.Stats{
217 AttributeOperation: xfs.AttributeOperationStats{
218 Get: 1,
219 Set: 2,
220 Remove: 3,
221 List: 4,
222 },
223 },
224 },
225 {
226 name: "icluster bad",
227 s: "icluster 1",
228 invalid: true,
229 },
230 {
231 name: "icluster OK",
232 s: "icluster 1 2 3",
233 stats: &xfs.Stats{
234 InodeClustering: xfs.InodeClusteringStats{
235 Iflush: 1,
236 Flush: 2,
237 FlushInode: 3,
238 },
239 },
240 },
241 {
242 name: "vnodes bad",
243 s: "vnodes 1",
244 invalid: true,
245 },
246 {
247 name: "vnodes (missing free) OK",
248 s: "vnodes 1 2 3 4 5 6 7",
249 stats: &xfs.Stats{
250 Vnode: xfs.VnodeStats{
251 Active: 1,
252 Allocate: 2,
253 Get: 3,
254 Hold: 4,
255 Release: 5,
256 Reclaim: 6,
257 Remove: 7,
258 },
259 },
260 },
261 {
262 name: "vnodes (with free) OK",
263 s: "vnodes 1 2 3 4 5 6 7 8",
264 stats: &xfs.Stats{
265 Vnode: xfs.VnodeStats{
266 Active: 1,
267 Allocate: 2,
268 Get: 3,
269 Hold: 4,
270 Release: 5,
271 Reclaim: 6,
272 Remove: 7,
273 Free: 8,
274 },
275 },
276 },
277 {
278 name: "buf bad",
279 s: "buf 1",
280 invalid: true,
281 },
282 {
283 name: "buf OK",
284 s: "buf 1 2 3 4 5 6 7 8 9",
285 stats: &xfs.Stats{
286 Buffer: xfs.BufferStats{
287 Get: 1,
288 Create: 2,
289 GetLocked: 3,
290 GetLockedWaited: 4,
291 BusyLocked: 5,
292 MissLocked: 6,
293 PageRetries: 7,
294 PageFound: 8,
295 GetRead: 9,
296 },
297 },
298 },
299 {
300 name: "xpc bad",
301 s: "xpc 1",
302 invalid: true,
303 },
304 {
305 name: "xpc OK",
306 s: "xpc 1 2 3",
307 stats: &xfs.Stats{
308 ExtendedPrecision: xfs.ExtendedPrecisionStats{
309 FlushBytes: 1,
310 WriteBytes: 2,
311 ReadBytes: 3,
312 },
313 },
314 },
315 {
316 name: "fixtures OK",
317 fs: true,
318 stats: &xfs.Stats{
319 ExtentAllocation: xfs.ExtentAllocationStats{
320 ExtentsAllocated: 92447,
321 BlocksAllocated: 97589,
322 ExtentsFreed: 92448,
323 BlocksFreed: 93751,
324 },
325 AllocationBTree: xfs.BTreeStats{
326 Lookups: 0,
327 Compares: 0,
328 RecordsInserted: 0,
329 RecordsDeleted: 0,
330 },
331 BlockMapping: xfs.BlockMappingStats{
332 Reads: 1767055,
333 Writes: 188820,
334 Unmaps: 184891,
335 ExtentListInsertions: 92447,
336 ExtentListDeletions: 92448,
337 ExtentListLookups: 2140766,
338 ExtentListCompares: 0,
339 },
340 BlockMapBTree: xfs.BTreeStats{
341 Lookups: 0,
342 Compares: 0,
343 RecordsInserted: 0,
344 RecordsDeleted: 0,
345 },
346 DirectoryOperation: xfs.DirectoryOperationStats{
347 Lookups: 185039,
348 Creates: 92447,
349 Removes: 92444,
350 Getdents: 136422,
351 },
352 Transaction: xfs.TransactionStats{
353 Sync: 706,
354 Async: 944304,
355 Empty: 0,
356 },
357 InodeOperation: xfs.InodeOperationStats{
358 Attempts: 185045,
359 Found: 58807,
360 Recycle: 0,
361 Missed: 126238,
362 Duplicate: 0,
363 Reclaims: 33637,
364 AttributeChange: 22,
365 },
366 LogOperation: xfs.LogOperationStats{
367 Writes: 2883,
368 Blocks: 113448,
369 NoInternalBuffers: 9,
370 Force: 17360,
371 ForceSleep: 739,
372 },
373 ReadWrite: xfs.ReadWriteStats{
374 Read: 107739,
375 Write: 94045,
376 },
377 AttributeOperation: xfs.AttributeOperationStats{
378 Get: 4,
379 Set: 0,
380 Remove: 0,
381 List: 0,
382 },
383 InodeClustering: xfs.InodeClusteringStats{
384 Iflush: 8677,
385 Flush: 7849,
386 FlushInode: 135802,
387 },
388 Vnode: xfs.VnodeStats{
389 Active: 92601,
390 Allocate: 0,
391 Get: 0,
392 Hold: 0,
393 Release: 92444,
394 Reclaim: 92444,
395 Remove: 92444,
396 Free: 0,
397 },
398 Buffer: xfs.BufferStats{
399 Get: 2666287,
400 Create: 7122,
401 GetLocked: 2659202,
402 GetLockedWaited: 3599,
403 BusyLocked: 2,
404 MissLocked: 7085,
405 PageRetries: 0,
406 PageFound: 10297,
407 GetRead: 7085,
408 },
409 ExtendedPrecision: xfs.ExtendedPrecisionStats{
410 FlushBytes: 399724544,
411 WriteBytes: 92823103,
412 ReadBytes: 86219234,
413 },
414 },
415 },
416 }
417
418 for _, tt := range tests {
419 var (
420 stats *xfs.Stats
421 err error
422 )
423
424 if tt.s != "" {
425 stats, err = xfs.ParseStats(strings.NewReader(tt.s))
426 }
427 if tt.fs {
428 stats, err = procfs.FS("../fixtures").XFSStats()
429 }
430
431 if tt.invalid && err == nil {
432 t.Error("expected an error, but none occurred")
433 }
434 if !tt.invalid && err != nil {
435 t.Errorf("unexpected error: %v", err)
436 }
437
438 if want, have := tt.stats, stats; !reflect.DeepEqual(want, have) {
439 t.Errorf("unexpected XFS stats:\nwant:\n%v\nhave:\n%v", want, have)
440 }
441 }
442}