Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update gosigar windows code to use gosigar/sys/windows package #55

Merged
merged 1 commit into from
Oct 28, 2016

Conversation

andrewkroh
Copy link
Member

  • Fixes ProcStatus.PPID value is wrong on Windows #53 (ProcStatus.PPID value is wrong on Windows). The code was incorrectly using CreateToolhelp32Snapshot + Process32First. This could have been fixed, but it would have required iterating over each process until finding the PPID of process we were interested it. Instead the code has been changed to use NtQueryInformationProcess to get the PPID given a process token.
  • Fixes Get the cpu usage per core in Windows #6 (Get the cpu usage per core in Windows). I used NtQuerySystemInformation to collect the timing information on a per CPU basis.
  • Adds OS version checks to the functions that make certain WMI calls. The Win32_Process data is only available on Vista and newer. On XP and Win2003, these methods will return ErrNotImplemented. This will help address Server 2003 - PID’s not recognized - Topbeat beats#1704.
  • Implements Uptime.Get for Windows.
  • Implements Swap.Get for Windows based on page file metrics.
  • Removes cgo usage for Windows.
  • Adds support to github.com/gosigar/sys/windows for querying and enabling privileges in a process token. This will help in addressing [TopBeat 1.2.3.] Can't access PID, even with correct rights. beats#1897.

- Fixes elastic#53 (ProcStatus.PPID value is wrong on Windows). The code was incorrectly using `CreateToolhelp32Snapshot` + `Process32First`. This could have been fixed, but it would have required iterating over each process until finding the PPID of process we were interested it. Instead the code has been changed to use `NtQueryInformationProcess` to get the PPID given a process token.
- Fixes elastic#6 (Get the cpu usage per core in Windows). I used `NtQuerySystemInformation` to collect the timing information on a per CPU basis.
- Adds OS version checks to the functions that make certain WMI calls. The `Win32_Process` data is only available on Vista and newer. On XP and Win2003, these methods will return `ErrNotImplemented`. This will help address elastic/beats#1704.
- Implements `Uptime.Get` for Windows.
- Implements `Swap.Get` for Windows based on page file metrics.
- Removes cgo usage for Windows.
- Adds support to `github.com/gosigar/sys/windows` for querying and enabling privileges in a process token. This will help in addressing elastic/beats#1897.
@andrewkroh andrewkroh force-pushed the feature/sigar-windows-refactor branch from 6838318 to 5c03d42 Compare October 27, 2016 23:30
@codecov-io
Copy link

codecov-io commented Oct 27, 2016

Current coverage is 62.33% (diff: 65.97%)

Merging #55 into master will increase coverage by 0.43%

@@             master        #55   diff @@
==========================================
  Files            22         23     +1   
  Lines          2139       2299   +160   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits           1324       1433   +109   
- Misses          642        658    +16   
- Partials        173        208    +35   

Powered by Codecov. Last update a78543b...5c03d42

@ruflin
Copy link

ruflin commented Oct 28, 2016

Wow, quite a cleanup. LGTM.

@ruflin ruflin merged commit 0ba14c2 into elastic:master Oct 28, 2016
@monicasarbu
Copy link

Reference the gosigar changes in #54

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ProcStatus.PPID value is wrong on Windows Get the cpu usage per core in Windows
4 participants