1
0
mirror of https://github.com/shirou/gopsutil.git synced 2025-05-10 19:29:14 +08:00

75 Commits

Author SHA1 Message Date
Alexey Galkin
2287b035c8 Add new test 'TestHostGuid'
For issue: https://github.com/shirou/gopsutil/issues/322
2017-03-03 16:28:49 +04:00
tycho garen
22c56d292e close open files 2017-02-22 08:46:23 -05:00
Sean Chittenden
36f5033d97
Unconditionally lowercase the HostID from all supported platforms. 2017-02-06 16:10:46 -08:00
Sean Chittenden
650c4d595f
Use HKLM/SOFTWARE\Microsoft\Cryptography's MachineGuid registry key to enable HostID support on Windows. 2017-02-02 16:08:58 -08:00
Cameron Sparr
a213bf5e6d
run go fmt ./... 2017-02-01 23:05:29 +00:00
Sean Chittenden
955821b5ab
Add Go-native structs for Darwin/386 and FreeBSD/arm 2017-01-31 22:56:31 -08:00
Sam Kleinman
488c56586b add platform compatibility 2017-01-27 20:35:58 -05:00
shirou
a2257218e1 Merge pull request #289 from DataDog/conor/cache-boot-time
Cache the boot time after first query.
2016-12-21 14:15:45 +09:00
Marco Pfatschbacher
b4846b445b Add support for OpenBSD/amd64
This code is based on the FreeBSD version
and implements roughly the same feature set.
2016-11-24 22:30:29 +01:00
Conor Branagan
5afd6f21c9 Cache the boot time after first query.
When fetching stats on all processes at once there's a non-trivial amount of
time spent in the `BootTime` call. But since this value should never change
during a live process, we can use a cached version for all subsequent calls.
2016-10-13 11:24:29 -04:00
Shirou WAKAYAMA
b9067179ef [host]darwin: change to use sw_vers to get platform version 2016-09-12 08:07:12 +09:00
shirou
a8e24d70f9 Merge pull request #247 from lfittl/fallback-for-unsupported-architectures
Add fallback code for all unsupported operating systems
2016-08-27 00:58:16 +09:00
Lukas Fittl
da9fa1162b Add fallback code for all unsupported operating systems.
This enables using gopsutil in a codebase that gets built on other OSes
than the ones supported. Instead of a build failure as before, due to
the build tags, gopsutil will now throw an "not implemented" runtime
error.

Fixes #234.
2016-08-22 15:31:26 -07:00
Lukas Fittl
13aedadcde Add separate kernelVersion field to host information.
This is mostly intended for Linux, where we are returning the OS version
in the PlatformVersion field, which seems reasonable. Often it is still
useful to know which Linux kernel is running.

For FreeBSD and Darwin the kernel version matches the platform version,
since they previously used the kernel version for the platform version.

For Windows the kernel version is empty, since there is no clear way
to determine it.
2016-08-22 14:15:30 -07:00
Sean Chittenden
d490d634ca
On Linux, attempt to read from /sys/class/dmi/id/product_uuid first
before falling back to kernel.random.boot_id.

`/sys/class/dmi/id/product_uuid` is still managed by permissions, so
for root-run processes where `/sys/class/dmi/id/product_uuid` is
available, the host's UUID will be used instead, otherwise the UUID
from kernel.random.boot_id will be used instead.
2016-08-11 01:29:46 -07:00
Sean Chittenden
59094cd5b7
Add HostID to the Host InfoStat struct returned from host.Info().
On supported hosts the value returned is a UUID (case preserving
from the value of the underlying OS).

For Linux this is generated once, randomly per boot.  For FreeBSD and
Darwin this is a more durable value that should persist across reboots.
2016-08-11 00:51:07 -07:00
Sean Chittenden
4f79984afe
Remove redefined import name for common. 2016-07-11 14:27:50 -04:00
Sean Chittenden
a3f57b1314
Resolve cyclic import and create a common helper func, NumProcs() 2016-07-11 14:05:30 -04:00
Sean Chittenden
fcd296ea11
Merge branch 'master' of github.com:shirou/gopsutil 2016-07-11 01:15:11 -05:00
Sean Chittenden
69f7f8eaeb
Update host.Info() to return the number of processes on all platforms.
Fixes: #227
2016-07-10 23:47:29 -05:00
Shirou WAKAYAMA
dd9b50926c [host]linux: add coreos to Info() and Virtualization(). 2016-06-13 17:22:02 +09:00
WAKAYAMA Shirou
53406b2832 [host]Windows: BootTime and Uptime are reversed on Windows. 2016-06-12 23:20:51 +09:00
Shirou WAKAYAMA
e9afb36ccf [host] linux: detect docker and rkt correctly 2016-06-06 23:50:19 +09:00
Shirou WAKAYAMA
c0d1185809 [host]linux: add alpine linux to detect host.Info(). 2016-06-06 22:57:17 +09:00
Shirou WAKAYAMA
57f6aebc7e add Timeout to invoke command and use common.Invoke refs: #201 2016-05-20 17:59:41 +09:00
Johannes 'fish' Ziemke
2a69690d62 Add type definitions for arm64 and ppc64le 2016-04-28 23:16:55 +02:00
WAKAYAMA shirou
e864f2a037 [disk]freebsd: update 386. 2016-04-23 23:43:00 +09:00
WAKAYAMA shirou
01832c6a58 [host]freebsd: add freebsd_386. 2016-04-23 23:18:18 +09:00
WAKAYAMA shirou
d9e994bec8 [host]freebsd: update freebsd_amd64 2016-04-23 23:10:23 +09:00
Shirou WAKAYAMA
ce98590a35 [host]linux: forgot to add sizeOfUtmp. 2016-04-23 22:18:34 +09:00
Shirou WAKAYAMA
15ff7e19df [host]linux: fix i386 and gofmt. 2016-04-23 21:34:27 +09:00
Shirou WAKAYAMA
b1df5a912c [host]linux: type file changed. 2016-04-23 21:21:24 +09:00
Shirou WAKAYAMA
0787e8ba3e [host]linux-arm: update type_liux.go. Test will fail. 2016-04-10 10:07:35 +00:00
Shirou WAKAYAMA
bce9212def fix build bugs. 2016-04-01 22:22:03 +09:00
Shirou WAKAYAMA
d21ed2b40d search path via exec.LookPath before actual invoke. 2016-04-01 22:13:05 +09:00
Shirou WAKAYAMA
4bb84648bf JSON representation is renamed to fit Google JSON style, camelCase. 2016-03-23 10:52:46 +09:00
Shirou WAKAYAMA
ea152ea901 [BREAKING CHANGE] rename functions to pass golint. ex) net.NetIOCounters -> net.IOCounters 2016-03-22 23:09:12 +09:00
Shirou WAKAYAMA
fa3e1cc196 [common]linux: add HostEtc to switch '/etc' See #175. 2016-03-13 23:42:06 +09:00
Robin Burchell
55cacb4730 host_darwin: Use a named constant for USER_PROCESS.
Matches the host_linux change.
2016-02-02 15:23:34 +01:00
Robin Burchell
3fc7bc1ef7 host_linux: Skip everything that isn't a normal process.
host_darwin does the same filtering. Not doing this gives us some rather strange
entries that likely aren't what we want.

Before:
    {"user":"reboot","terminal":"~","host":"3.10.0-327.4.5.el7.x86_64","started":1454378260}
    {"user":"LOGIN","terminal":"ttyS0","host":"","started":1454378270}
    {"user":"LOGIN","terminal":"tty1","host":"","started":1454378270}
    {"user":"runlevel","terminal":"~","host":"3.10.0-327.4.5.el7.x86_64","started":1454378276}
    {"user":"root","terminal":"pts/0","host":"vpn","started":1454404513}

After:
    {"user":"root","terminal":"pts/0","host":"vpn","started":1454404513}
2016-02-02 15:23:32 +01:00
Paul Querna
008f2b4e18 Get Arch Linux Version from LSB 2016-01-11 10:53:01 -08:00
WAKAYAMA shirou
54a6c186c1 host[freebsd]: BREAKING CHANGE. Boottime() should return uint64 same as other. 2015-11-24 09:48:05 +09:00
Shirou WAKAYAMA
0afd653fab host[all]: fix #114 String() issue. 2015-11-24 09:30:17 +09:00
Cameron Sparr
444ee723c3 Fix HostInfo.Uptime, which has been returning boot time
Also adding a HostInfo.BootTime field for holding the boot time
2015-11-23 13:18:59 -07:00
Shirou WAKAYAMA
7288e9a5af common[all]: add internal 2015-10-20 00:04:57 +09:00
Daniel Theophanes
0af895258e common: rename package common to internal/common. Add ENV helper funcs.
Package common wasn't used for public functions. Place it in an
internal directory to prevent other packages from using.

Remove the distributed references to "HOST_PROC" and "HOST_SYS"
consts and combine into a common function. This also helps so that
if a env var is defined with a trailing slash all will continue to
work as expected.

Fixes #100
2015-10-18 20:40:01 -07:00
Jonathan Chauncey
0461c50666 chore(*): Fixes #94
Added the ability to fetch an alternative location for /proc via an
environment variable. If the env var is not set it will return /proc as
the default value.
2015-10-17 11:34:41 -06:00
Nick Galbreath
99d93f93b2 shirou/gopsutil#90 make hostinfo more robust 2015-10-13 13:02:02 -07:00
Shirou WAKAYAMA
3303647209 host[linux]: fix utmp struct on arm. 2015-10-01 17:21:37 +09:00
mayowa
bf16d0a6a7 modified PlatformVersion and PlatformFamily string to (somewhat) match the output from sysinfo 2015-08-28 07:39:20 +01:00