Commit Graph

36 Commits

Author SHA1 Message Date
itnihao 490dbd4ea4 Add hostinfo Virtualization vmware 2017-03-25 00:19:22 +08: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
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
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
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
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 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 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
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
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 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
Shirou WAKAYAMA cfb473f810 host linux now use godefs. 2014-12-31 22:58:39 +09:00
Shirou WAKAYAMA 13cd195a7e change package name. 2014-12-30 22:09:05 +09:00
Shirou WAKAYAMA a1c1d7b25f fix on Linux. 2014-11-27 10:32:35 +09:00
WAKAYAMA shirou d11680c773 fix bugs on FreeBSD. 2014-11-27 10:25:14 +09:00
Shirou WAKAYAMA a4671fcc2a move subdirectories. refer to issue #24 2014-11-27 10:18:15 +09:00