1
0
mirror of https://github.com/shirou/gopsutil.git synced 2025-04-26 13:48:59 +08:00

108 Commits

Author SHA1 Message Date
shirou
ab0d977709 [sensors] move Temperatures from host to sensors. 2024-05-28 22:27:17 +09:00
shirou
bc060cc227 add SPDX License, remove old build tag, and replace import 2024-05-28 22:27:17 +09:00
Bryce Kahle
b0d976c49b
ensure host platform are files and have contents
In a containerized deployment, it is common to mount several files from /etc. Within the container, those files will be created regardless if they exist on the host or not. In those instances, the existing code would erroneously return empty platform information.
2024-01-18 10:21:42 -08:00
shirou
b10acd4894 [host]: add EnableBootTimeCache function 2024-01-11 00:49:11 +09:00
Ville Skyttä
362fa4b9c4 Avoid repeated regexp compilations 2023-12-21 09:51:14 +02:00
Xie Weineng
0de2d14a7c add deepin and uos distro 2023-12-13 09:54:52 +08:00
shirou
0665cafa1b chore: replace deprecated ioutil package to os and io 2023-09-08 17:05:14 +00:00
shirou
3748c19402 [host][linux]: remove double quote from lsb release info
fix: #1502
2023-08-13 12:01:01 +00:00
Antoine Toulme
38b94668ea allow to pass context values to override environment variables 2023-06-02 01:31:05 -07:00
Matthieu MOREL
1fb1e3e3e6 ci(lint): correct gci linter
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2023-04-04 18:07:22 +00:00
Josh Powers
e7c6b6991d
fix: moves common.Warnings to common OS files
This allows all OS types to unwrap the Warnings from errors, and not
just linux in host or windows in disk.

fixes: #1429
2023-03-15 06:39:08 -06:00
Jacob Young
02660eaf7c
Update host/host_linux.go
Use a raw string instead of escaped quotes.

Co-authored-by: shirou <shirou.faw@gmail.com>
2023-03-10 09:41:18 -05:00
Jacob Young
43566581f0 Recognize Cumulus Linux distro
Add Cumulus Linux and Kylin to debian family
2023-02-24 13:59:01 -05:00
shirou
e563e6394e
Merge pull request #1356 from N1neSun/patch-1
fix some kylin linux bug
2023-02-12 16:46:43 +09:00
Tobias Klauser
f9a5834e0e
host: use unix.ByteSliceToString
Use ByteSliceToString provided in golang.org/x/sys/unix to convert
\0-terminated byte slices to strings.
2022-12-07 13:14:45 +01:00
shirou
5473fd114d [disk][host]: change to use type alias. 2022-11-30 23:23:31 +00:00
shirou
4ac7e99c6a [disk][host]: move back Warnings from internal to disk and host.
fix #1377
2022-11-19 11:37:38 +00:00
Antoine Toulme
dbc0f20fe3 code review 2022-10-03 13:55:14 -07:00
N1neSun
add9158d4e fix some kylin linux bug 2022-09-23 16:23:47 +08:00
shirou
5610fbc5d5 fix(host,linux): Check if path exists and is nonempty before reading host files 2022-07-15 12:25:44 +00:00
yueyt
15354cbdee add neokylin host info on linux 2022-07-05 17:19:18 +08:00
Ville Skyttä
f7e1f36418 refactor: remove unnecessary exec.LookPath calls
Executing the command does the lookup if needed and returns the same
error when not found, no need to do it separately.
2022-03-04 18:56:33 +02:00
Lammert Hellinga
001699bed7 Let almalinux be part of the rhel family 2022-01-19 22:37:51 +01:00
mmorel-35
1e6b445a8a gofumpt 2021-12-22 21:54:41 +00:00
shirou
0969c9436b delete v2 directory, move v3 to top #1078 2021-11-30 23:47:59 +00:00
odinje
a3e22baec0 Ensure rhel platform family for Rocky Linux 2021-07-21 23:04:09 +02:00
Mykola Terelia
84e8e51bf9 Added missing distributions to the suse platform family 2021-03-16 18:16:30 +02:00
shirou
6c9f3bdcae [host][linux] Change to use unix.SysInfo_t to get Uptime in Linux 2020-09-19 11:12:05 +09:00
Sergey Vinogradov
5209442b3c Refactor "host" package 2020-09-11 18:54:53 +03:00
shirou
a81cf97fce
Merge pull request #861 from Lomanic/issue391
[host][linux] Fix #391 retrieve sensors temps on OSes lacking hwmon
2020-05-01 22:02:23 +09:00
Tim Gross
c69ef749eb fix host.Info() panic if /etc/debian_version is empty
The ReadLines helper function doesn't guarantee that the length of
lines is non-zero or that the lines have contents. Most callers
include a check for length but this was missing for version
fingerprinting on Debian if `/etc/debian_version` was empty, leading
to a panic.
2020-01-17 14:23:27 -05:00
Lomanic
c58a1e8ec7 [host][linux] Fix #391 retrieve sensors temps on OSes lacking hwmon 2019-08-18 20:48:31 +02:00
Aman Gupta
62a406ec1b
Trim null bytes from kernel version 2019-08-12 13:30:54 -07:00
shirou
8a5bcfdb53
Merge pull request #739 from Lomanic/issue738
[host][linux] Fix #738 use uname syscall to get version in KernelVersion()
2019-08-11 21:57:14 +09:00
Lomanic
4bf185067d [host] Fix #737 add KernelArch field in InfoStat struct returning 'uname -m' result 2019-08-08 23:11:41 +02:00
Lomanic
8c28c3ba17 [host][linux] Fix #738 use uname syscall to get version in KernelVersion() 2019-08-03 18:36:36 +02:00
Lomanic
9219f16f03 [host][linux] Fix #340 return Solus OS as from the "solus" PlatformFamily in Info() 2019-07-11 22:18:40 +02:00
shirou
7c2ac48f84
Merge branch 'master' into td-remove-cycle 2019-06-01 11:26:59 +09:00
shirou
3d9d5e60ef
Merge pull request #688 from asnowfox/master
use /proc/buc/pci/devices to identify a VM is a guest
2019-06-01 11:18:40 +09:00
shirou
d8686bcd5c
Merge pull request #675 from marcv81/fix_665_v2
Fix for #665
2019-06-01 10:28:14 +09:00
Lomanic
3af6e1ffe7 [host][linux] Properly handle double quotes in /etc/os-release in PlatformInformation 2019-05-31 18:04:45 +02:00
Arturo Reuschenbach Puncernau
2a0b67d19c added sles to the suse platform family 2019-05-24 11:33:07 +02:00
Tyler Dixon
a02925055c Remove cycle between process and host packages
gopsutil is a transitive dependency of another project that I am integrating
into an internal build system. We target multiple platforms and as a part
of the build system for the large internal repo, we calculate the build
graph used to determine what targets have changed and need to be build /
tested as a single DAG for all platforms.

gopsutil currently does not form a DAG if linux and any other platform are
considered at the same time. linux is the only platform where the process
package imports the host package.

To remove this cycle, the relevant methods have been moved to internal/common
with the linux build tag and are consumed the host and process packages.
2019-05-22 17:45:50 -07:00
litong
6dfd8d56bb Merge branch 'master' of https://github.com/asnowfox/gopsutil 2019-05-22 11:02:14 +08:00
litong
119f26c1df use bus/pci/devices to identify a vm guest 2019-05-22 11:01:09 +08:00
Snow Fox
0cad0faa11
Merge pull request #1 from shirou/master
merge master
2019-05-22 10:46:50 +08:00
litong
12005ab922 use /proc/bus/pci/devices to idenetify a kvm guest 2019-05-06 07:18:49 +08:00
Segflow
86c7289ccc Fix: use filename in exec.LookPath instead of full path
exec.LookPath searches for the file in the $PATH, which mean giving it an absolute path is against it's own purposes.
2019-05-05 20:45:07 +01:00
Marc
174b31f146 Fix for #665
Remains backward compatible.

When encountering non-fatal errors SensorsTemperatures() returns the
temperatures for all the sensor we could read successfully. In that
case the custom error contains a list of all the non-fatal errors
encountered.

Example usage:

	_, err := SensorsTemperatures()
	if err != nil {
		warns, ok := err.(*Warnings)
		if ok {
			fmt.Printf("%v\n", err)
			for i, w := range warns.List {
				fmt.Printf("Warning %v: %v\n", i+1, w)
			}
		} else {
			t.Errorf("%v", err)
		}
	}
2019-04-26 23:15:23 +08:00
mingrammer
017c9f9cbc Fix typos 2019-03-18 02:52:26 +09:00