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

61 Commits

Author SHA1 Message Date
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
mayowa
ee43e655c2 implemented GetPlatformInfo and refactored HostInfo() to use it 2015-08-25 23:27:25 -07:00
mayowa
56d70ecc5e implemented HostStatInfo.Platform* for windows 2015-08-25 23:03:25 -07:00
WAKAYAMA shirou
abb4086531 host[freebsd]: change to use utmpx for 9.0 or later. 2015-08-15 01:20:56 +09:00
Shirou WAKAYAMA
ba88128af1 host_linux: change some virtualization check StringsContains to StringsHas.` 2015-07-21 15:42:27 +09:00
Shirou WAKAYAMA
b5ffc220a6 common: Rename StringContains to StringsContains and add StringsHas. 2015-07-21 15:25:04 +09:00
Shirou WAKAYAMA
3bd9ace228 [linux] fix Host.BootTime(). It was seconds from Booted, not from epoch. 2015-06-19 12:00:04 +09:00
Fabian Ruff
91a97374c4 Add SuSe platform detection 2015-06-18 11:52:49 +02:00
WAKAYAMA shirou
64357f04e7 use StackExchange/wmi instead of invoking wmic process.
Note: This may not work on some old Windows XP.
2015-04-20 00:05:31 +09:00
WAKAYAMA Shirou
5f8b99aa65 windows: GetWmic returns [][]string where string split by "," 2015-03-20 22:48:58 +09:00
Shirou WAKAYAMA
8f05d68a09 host: forget to convert to uint64. 2015-03-12 09:25:32 +09:00
Shirou WAKAYAMA
515398a6f6 host: Boottime return type was wrong on darwin #40 2015-03-12 09:24:27 +09:00
WAKAYAMA Shirou
4b0f5a03dc host: use wmic OS instead of calling GetTickCount on Windows. 2015-02-15 22:26:18 +09:00
若山史郎
f2435bc8de host: skip if utmp.Type is not USERPROCESS (defined in utmpx.h) 2015-02-14 23:08:05 +09:00
若山史郎
a5d366a70c host: Users() on darwin works. but Started is not correct. 2015-02-14 23:04:17 +09:00