Commit Graph

98 Commits

Author SHA1 Message Date
shawnps befc2c3d92 call Fatal if length of Users() is 0 2017-11-08 13:29:49 +09:00
Daniel Nelson df2f1a8dd1
Add HOST_VAR envvar and use to locate utmp on Linux. 2017-10-16 14:53:14 -07:00
Steven Hartland 6450c60b61 Eliminate use of sysctl command on FreeBSD
In order to improve performance and help prevent crashes due to the outstanding fork crash bug:
https://github.com/golang/go/issues/15658

Replace string parsed values from the sysctl command with native reads of sysctl values using unix.SysctlRaw and unix.SysctlUint32.

This also merges OpenBSD and FreeBSD load implementations which are identical.
2017-10-05 08:45:56 +01:00
Yoshio HANAWA a889bcce1a Add type definitions for mips and mipsle 2017-08-27 02:36:33 +09:00
WAKAYAMA Shirou 114c78c777 [host]: add not implemented methods. 2017-08-03 11:08:35 +09:00
WAKAYAMA Shirou 9c5b318e0d [host] windows: define Virtualization() 2017-08-03 10:14:20 +09:00
Sean Chittenden 42a72cbfae
Add HostID support to the `solaris` build target. 2017-07-31 20:04:43 -07:00
Sean Chittenden 635b971c0e
Move from the `syscall` package to the `golang.org/x/sys/{unix,windows}` 2017-06-02 13:51:00 -07:00
Frank Schroeder a9e803ef6a
Fix data race in host.BootTime 2017-06-01 18:11:14 +02:00
Shirou WAKAYAMA cdcb9bb2ed [linux] host: fix typo 2017-04-22 17:06:35 +09:00
WAKAYAMA Shirou 25d50d5bc3 [linux]host: change to use filepath.Join 2017-04-22 17:02:33 +09:00
WAKAYAMA Shirou dfbb3e40da fix build bugs. 2017-04-10 22:24:36 +09:00
Shirou WAKAYAMA fee973abda [linux]host: fix HostTempreture func 2017-04-10 22:06:37 +09:00
shirou 8e36fe6d8f Merge pull request #334 from dotpy3/macos-linux-temperatures
Added temperatures sensors for macOS and Linux
2017-04-10 21:54:07 +09:00
WAKAYAMA Shirou e49a95f3d5 [host]darwin: PlatformInformation has been 5 values other is 4. 2017-04-06 22:17:56 +09:00
itnihao 490dbd4ea4 Add hostinfo Virtualization vmware 2017-03-25 00:19:22 +08:00
Eric Gourlaouen 22aefb460a Replaced sys by HostSys
Added TemperatureStat string test
2017-03-20 19:01:28 +01:00
Eric Gourlaouen 8b08ca5fdc added temperatures 2017-03-19 02:08:19 +01:00
WAKAYAMA Shirou f8ef680a47 error strings change to lowercase 2017-03-15 22:43:20 +09:00
James Nugent 408005be94 host: Add Solaris support for Info, {Boot,Up}time
This commit adds support for Info(), BootTime() and Uptime() in package
Host. It uses no cgo, preferring to parse the output of `kstat -p`
instead.

Thanks go to @gfrey for the parsing logic for `/etc/release` and `uname`.
2017-03-14 16:05:17 -05:00
shirou 23f4b7eb14 Merge pull request #323 from molecul/patch-2
Fix for getMachineGuid() return value
2017-03-03 22:53:34 +09:00
Shirou WAKAYAMA 85d3530ae8 fix test. 2017-03-03 22:35:18 +09:00
Alexey Galkin b1f19a76c7 Fix for getMachineGuid() return value
getMachineGuid() function return a empty value in x86 windows builds.
Issue: https://github.com/shirou/gopsutil/issues/322
2017-03-03 16:30:53 +04:00
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