Commit Graph

171 Commits (fc7e5e7af6052e36e83e5539148015ed2c09d8f9)

Author SHA1 Message Date
Aman Gupta 25be4d08fe
Trim null bytes from kernel arch 6 years ago
Aman Gupta 62a406ec1b
Trim null bytes from kernel version 6 years ago
shirou 8a5bcfdb53
Merge pull request #739 from Lomanic/issue738
[host][linux] Fix #738 use uname syscall to get version in KernelVersion()
6 years ago
Lomanic 4bf185067d [host] Fix #737 add KernelArch field in InfoStat struct returning 'uname -m' result 6 years ago
Lomanic 98c779765f [host] go-fmt and propagate context on Windows in Info() 6 years ago
Lomanic 8c28c3ba17 [host][linux] Fix #738 use uname syscall to get version in KernelVersion() 6 years ago
Lomanic 9219f16f03 [host][linux] Fix #340 return Solus OS as from the "solus" PlatformFamily in Info() 6 years ago
WAKAYAMA shirou 669b2710bf [freebsd]host: change freebsd struct for 386 and arm. 6 years ago
WAKAYAMA shirou 2fd3f03f84 [freebsd][host]: fix Users() return start secs. 6 years ago
shirou a83baef6e4
Merge pull request #698 from picatz/fix-platformFamily-on-macOS
Update host_darwin.go
6 years ago
shirou 7c2ac48f84
Merge branch 'master' into td-remove-cycle 6 years ago
shirou 3d9d5e60ef
Merge pull request #688 from asnowfox/master
use /proc/buc/pci/devices to identify a VM is a guest
6 years ago
shirou d8686bcd5c
Merge pull request #675 from marcv81/fix_665_v2
Fix for #665
6 years ago
Kent 'picat' Gruber e507f44421 Update host_darwin.go
Copy+pasta got me again! 🍝

No new variable on the left of `:=` 😂
6 years ago
Kent 'picat' Gruber d13ba02ef0 Update host_darwin.go
The /System/Library/CoreServices/ServerVersion.plist exists on macOS servers , but not on a workstation such as my laptop. The actual terminoly is mostly borrowed from the windows equivalent as @Lomanic suggested. In theory, this should make interpreting the results from the two platforms a bit more consistent.

Note: The macOS server application can be installed on almost any macOS workstation to make it a server that can manage other apple devices.
6 years ago
Lomanic 3af6e1ffe7 [host][linux] Properly handle double quotes in /etc/os-release in PlatformInformation 6 years ago
Arturo Reuschenbach Puncernau 2a0b67d19c added sles to the suse platform family 6 years ago
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.
6 years ago
litong 6dfd8d56bb Merge branch 'master' of https://github.com/asnowfox/gopsutil 6 years ago
litong 119f26c1df use bus/pci/devices to identify a vm guest 6 years ago
Snow Fox 0cad0faa11
Merge pull request #1 from shirou/master
merge master
6 years ago
litong 12005ab922 use /proc/bus/pci/devices to idenetify a kvm guest 6 years ago
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.
6 years ago
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)
		}
	}
6 years ago
mingrammer 017c9f9cbc Fix typos 6 years ago
Lomanic 27ec6a0789 [host][linux] Remove call to sysctl binary in host/host_linux.go #639 6 years ago
Lomanic 7e9e36b568 [host][openbsd] Remove calls to sysctl binary in host/host_openbsd.go #639 6 years ago
Lomanic d110536e10 [host][darwin] Remove calls to sysctl binary in host/host_darwin.go #639 6 years ago
Lomanic 738b966ed1 [host][darwin] Use unix.Sysctl to get kernel version and platform name 6 years ago
Lomanic 8294f67566 [host][openbsd] Remove external calls to uname in PlatformInformation() 6 years ago
Pierre Souchay 890eb80501 Better comments for fallback on /etc/machine-id 6 years ago
Pierre Souchay be2b25a7c6 Have a real fixed HostID on Linux
On Linux, most golang programs do not run as root (or at least, they should not),
by default, the kernels uses strict permissions, so most userland programs cannot
read `/sys/class/dmi/id/product_uuid`. However, programs such as Consul are relying
on it to get fixed IDs, instead they have a different ID on each boot.

We propose to use `/etc/machine-id` as fallback https://www.freedesktop.org/software/systemd/man/machine-id.html

In order to fix this, this patch does the following:
 - if `/sys/class/dmi/id/product_uuid` can be read, use it for HostID
 - else if `/etc/machine-id` exists and has 32 chars, use it and add '-' to have the same format as product_uuid
 - finally, if notthing works, use the `kernel.random.boot_id`

This will greatly increase the number of programs having correct behaviour when
those rely on having a fixed HostID.

This will fix the following issues:
 - https://github.com/shirou/gopsutil/issues/350
 - https://github.com/hashicorp/consul/issues/4741
6 years ago
Lomanic 18b2744df2 [host][darwin] Fix #574, use 'uname -r' in KernelVersion() 7 years ago
Ozair Jr 0bab9611d2 Adding Slackware platform information 7 years ago
Lomanic bb518e9c4e [host][windows] Remove exported wmi type from #550 7 years ago
pytimer 62fcd00c4d [host] Implement windows temperature use wmi 7 years ago
shirou 4923bd298a host: remove empty virtualzation check.
related to #547
There is an architecture which supports no virtualization.
7 years ago
Lomanic 6c4f577e6e
Merge branch 'master' into winapihost 7 years ago
Michal Rostecki 0225d9ddcc host: Check for error object 7 years ago
Lomanic 61e2d92d95 [host][windows] Query registry via golang.org/x/sys/windows instead of golang.org/x/sys/windows/registry
See https://github.com/shirou/gopsutil/pull/312#issuecomment-277422612
7 years ago
Lomanic d8a6a50129 Revert "[host][windows] Refactor code to query registry via golang.org/x/sys/windows/registry"
This reverts commit c729bbd6a8.
7 years ago
Lomanic c729bbd6a8 [host][windows] Refactor code to query registry via golang.org/x/sys/windows/registry 7 years ago
Lomanic eb11fd6e2f [host][windows] Completely remove slow wmi calls to retrieve OS version, use registry and RtlGetVersion 7 years ago
Lomanic df331c7615 [host][windows] Use win32 API to get host's uptime instead of (slow) wmi 7 years ago
shirou c95755e4bc [host]darwin: remove GPL code 7 years ago
Maddie Zhan 8c8eeb32d3 [host] linux/mips: mips64le definition from mipsle
Same as commit fc04d2d, but for mips64le from mipsle definition.
It would be nice if anyone can check with the correctness, since the
qemu environment for mips64/mips64le can't run Go properly due to this
issue: https://github.com/golang/go/issues/15416
7 years ago
shirou cd915bdc31
Merge pull request #508 from shirou/issue507
[host] Fix docker uptime parsing (fix #507)
7 years ago
Lomanic 1b47825dcb [host] Fix docker uptime parsing (fix #507) 7 years ago
shirou fc04d2dd9a [host]linux/mips: copy mips64 definition from mips.
It just copy from mips, so it may be corrupt, but I can not check it.
If something wrong, please open an issue.
7 years ago
shirou 145dca90f7 change to use CommandContext. 7 years ago