Commit Graph

72 Commits (4201ef19df877533ed45526c9c20a970fc02a4e3)

Author SHA1 Message Date
Joseph Malicki 6f716d14c8 Add support for Linux discards and flushes in IOCounterStats.
These were added in kernels 4.18 and 5.5, respectively.

Flushes (i.e. fsyncs) are especially important for logging for database servers and
the like, as flushes can be a very limiting factor on IO throughput.
3 years ago
arstercz f6dc96c30e follow the psutil principles, do nothing if can not find root device 3 years ago
arstercz d52b97cd25 fix disk readlink error which system boot by nfs mount 3 years ago
Jamie Strandboge 9e6e627ec8 [disk][linux] add HOST_PROC_MOUNTINFO, closes #1271
The changes to gopsutil for reading /proc/1/mountinfo affected
applications running under restricted environments that disallows access
to /proc/1/mountinfo. #1159 was filed for android but other restricted
environments are also affected (eg, snaps)). The fix for #1159 addressed
the application behavior to work under confinement for non-android as
well. However, depending on the system, the attempt to read
/proc/1/mountinfo could cause a sandbox denial in the logs which can be
quite noisy if using gopsutil as part of a monitoring solution that
polls often.

This introduces HOST_PROC_MOUNTINFO to force reading from the parent dir
of the specified path instead of first trying /proc/1. When unset,
retain the current behavior with fallback. This allows people, for
example, to set HOST_PROC_MOUNTINFO=/proc/self/mountinfo when gopsutil
is running under these restricted environments.

This change updates the private readMountFile() to use a root path
instead of a root subpath, and adjusts PartitionsWithContext() to set
the root path to /proc/1 initially and falling back to /proc/self. When
HOST_PROC_MOUNTINFO is not empty, set the root path to the parent
directory of HOST_PROC_MOUNTINFO.
3 years ago
Ville Skyttä 5095c3f51e [disk][linux] recognize more file systems 3 years ago
shirou 49037dd0d8 [disk][linux] add fallback to /proc/self 3 years ago
Matthieu MOREL 4671e649aa
enable revive linter 4 years ago
mmorel-35 1e6b445a8a gofumpt 4 years ago
Matthieu MOREL b673968d5d
enable errorlint linter 4 years ago
shirou d2e27c1712 fix dependabot v2 deletion. 4 years ago
shirou 0969c9436b delete v2 directory, move v3 to top #1078 4 years ago
shirou b39f8bb90e
[v2][disk][linux] apply DiskPartiton change to v2 4 years ago
shirou 1f733a99dc [disk] move without context functions to disk.go. 5 years ago
Aman Karmani 23d63601d1 [disk][linux] flag bind mounts 5 years ago
Ilya Prudnikov 256e00319e implement proposed solution 6 years ago
Ilya Prudnikov 7277cdf050 Fix for track disk stats when running in container 6 years ago
Lomanic e4ec7b275a [disk][linux] Fix #555 for kernels >=2.6.26 6 years ago
Aman Gupta 74d3cea10f Proper fix for unavailable /proc/filesystems 6 years ago
John Floren 93e08ea089 Fixes a problem when using Docker on a host with an encrypted LLVM root. A docker container with a volume mounted from the host will see /dev/mapper in its mount info file, but will not be able to read it. 6 years ago
eshimizu 91b1c81467
Update disk_linux.go 6 years ago
Aman Gupta 34b030b41c
Ignore getFileSystems errors when requesting all partitions 6 years ago
Aman Gupta ea0f864aef ignore /proc/filesystems errors on android 6 years ago
Tony Lambiris 80ceab90aa
Add support for hfsplus file system 6 years ago
Lomanic d7405fd873 [disk][linux] Follow symlinks with filepath.EvalSymlinks for LVM volumes
See #686
6 years ago
Tony Lambiris 8037dc42c8
Add a check for logical volume paths 6 years ago
Lomanic 368a865910 [disk][linux] Fix comment in PartitionsWithContext 6 years ago
Lomanic 0d3a2ac515
[disk][linux] Fix comment in PartitionsWithContext 6 years ago
JHE a08b926ce6 It could be another error than the "self/mountinfo" missing 6 years ago
JHE 06a21ae66a Fix some issue. 7 years ago
JHE a5cb715e64 if mountinfo not found, use mounts 7 years ago
JHE d141349619 if mountinfo not found, use mounts 7 years ago
JHE a45f6d8a03 if mountinfo not found, use mounts 7 years ago
Nico Vinzens 1a7a39a789
Merge branch 'master' into master 7 years ago
Remy Mathieu fda98ebc34 disk: trim the device mapper name.
While reading the value of the file with `ioutil.ReadFile`,
the name is suffixed with a `\n`

Tested on Ubuntu 18.10
7 years ago
Lomanic 8888537497 [disk][linux] Fix #555 Unescape escaped sequences in fstab path in disk.Partitions 7 years ago
Nico Vinzens 1079f31626 change the way we handle the mountinfo lines 7 years ago
Nico Vinzens 23dfe98621 use HostSys to construct device path 7 years ago
Nico Vinzens 813c630e9c replace self/mounts with self/mountinfo 7 years ago
Jaime Soriano Pastor 61902bc2a5 Use HOST_* environment variables for getting disk serial number in Linux 7 years ago
shirou d813235a11 disk[linux]: cast uint64 for build on MIPS
related: #533
7 years ago
Jaime Soriano Pastor f03124bf86 Read disk model and serial from udev data or sysfs on Linux
It reads model and serial data directly from files instead of using
`udevadm` command. This way obtaining the disk serial number doesn't
depend on command execution, and can be also possible even if udev or
udevadm are not available.
7 years ago
shirou 6a55ce0958 [disk]linux: fix Getlabel 7 years ago
Ofek Lev 0f8edaa97e address review 7 years ago
Ofek Lev 35ed9c11c7 [disk][linux] add label based on devicemapper name of disk 7 years ago
shirou 145dca90f7 change to use CommandContext. 7 years ago
shirou cd61c36c4f
Merge branch 'master' into feature/add_context_support 8 years ago
shirou 756e91c8f5 [disk]linux: use basename such as sda1 for IOCounters 8 years ago
shirou 4c73494c78 Add WithContext functions. 8 years ago
Sean Chittenden 635b971c0e
Move from the `syscall` package to the `golang.org/x/sys/{unix,windows}` 8 years ago
Aman Gupta a08587b348 Update disk_linux.go 8 years ago