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

New module windows for metricbeat #3758

Merged
merged 18 commits into from
Mar 28, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ https://github.com/elastic/beats/compare/v5.1.1...master[Check the HEAD diff]
- The Docker, Kafka, and Prometheus modules are now Beta, instead of experimental. {pull}3525[3525]
- The HAProxy module is now GA, instead of experimental. {pull}3525[3525]
- Add the ability to collect the environment variables from system processes. {pull}3337[3337]
- Add experimental metricset `perfmon` to Windows module. {pull}3758[3758]
- Add memcached module with stats metricset. {pull}3693[3693]

*Packetbeat*
Expand Down
47 changes: 47 additions & 0 deletions metricbeat/docs/fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ grouped in the following categories:
* <<exported-fields-prometheus>>
* <<exported-fields-redis>>
* <<exported-fields-system>>
* <<exported-fields-windows>>
* <<exported-fields-zookeeper>>

--
Expand Down Expand Up @@ -7518,6 +7519,52 @@ type: keyword
Name of the user running the process.


[[exported-fields-windows]]
== Windows Fields

[]beta Module for Windows



[float]
== windows Fields





[float]
== counters Fields

Grouping of different counters



[float]
=== windows.perfmon.counters.group

type: string

Name of the group. For example `processor` or `disk`



[float]
=== windows.perfmon.counters.collectors.alias

type: string

Short form for the query


[float]
=== windows.perfmon.counters.collectors.query

type: string

The query. For example `\\Processor Information(_Total)\\% Processor Performance`. Backslashes have to be escaped.


[[exported-fields-zookeeper]]
== ZooKeeper Fields

Expand Down
34 changes: 34 additions & 0 deletions metricbeat/docs/modules/windows.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
////
This file is generated! See scripts/docs_collector.py
////

[[metricbeat-module-windows]]
== windows Module

This is the windows Module.


[float]
=== Example Configuration

The Windows module supports the standard configuration options that are described
in <<configuration-metricbeat>>. Here is an example configuration:

[source,yaml]
----
metricbeat.modules:
#- module: windows
# metricsets: ["perfmon"]
# enabled: true
# period: 10s
# perfmon.counters:----

[float]
=== Metricsets

The following metricsets are available:

* <<metricbeat-metricset-windows-perfmon,perfmon>>

include::windows/perfmon.asciidoc[]

19 changes: 19 additions & 0 deletions metricbeat/docs/modules/windows/perfmon.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
////
This file is generated! See scripts/docs_collector.py
////

[[metricbeat-metricset-windows-perfmon]]
include::../../../module/windows/perfmon/_meta/docs.asciidoc[]


==== Fields

For a description of each field in the metricset, see the
<<exported-fields-windows,exported fields>> section.

Here is an example document generated by this metricset:

[source,json]
----
include::../../../module/windows/perfmon/_meta/data.json[]
----
2 changes: 2 additions & 0 deletions metricbeat/docs/modules_list.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ This file is generated! See scripts/docs_collector.py
* <<metricbeat-module-prometheus,Prometheus>>
* <<metricbeat-module-redis,Redis>>
* <<metricbeat-module-system,System>>
* <<metricbeat-module-windows,Windows>>
* <<metricbeat-module-zookeeper,ZooKeeper>>


Expand All @@ -41,4 +42,5 @@ include::modules/postgresql.asciidoc[]
include::modules/prometheus.asciidoc[]
include::modules/redis.asciidoc[]
include::modules/system.asciidoc[]
include::modules/windows.asciidoc[]
include::modules/zookeeper.asciidoc[]
2 changes: 2 additions & 0 deletions metricbeat/include/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ import (
_ "github.com/elastic/beats/metricbeat/module/system/network"
_ "github.com/elastic/beats/metricbeat/module/system/process"
_ "github.com/elastic/beats/metricbeat/module/system/socket"
_ "github.com/elastic/beats/metricbeat/module/windows"
_ "github.com/elastic/beats/metricbeat/module/windows/perfmon"
_ "github.com/elastic/beats/metricbeat/module/zookeeper"
_ "github.com/elastic/beats/metricbeat/module/zookeeper/mntr"
)
6 changes: 6 additions & 0 deletions metricbeat/metricbeat.full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,12 @@ metricbeat.modules:
# Redis AUTH password. Empty by default.
#password: foobared

#------------------------------- Windows Module ------------------------------
#- module: windows
# metricsets: ["perfmon"]
# enabled: true
# period: 10s
# perfmon.counters:
#------------------------------ ZooKeeper Module -----------------------------
#- module: zookeeper
#metricsets: ["mntr"]
Expand Down
6 changes: 6 additions & 0 deletions metricbeat/metricbeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ metricbeat.modules:
period: 10s
processes: ['.*']

#------------------------------- Windows Module ------------------------------
#- module: windows
# metricsets: ["perfmon"]
# enabled: true
# period: 10s
# perfmon.counters:


#================================ General =====================================
Expand Down
5 changes: 5 additions & 0 deletions metricbeat/module/windows/_meta/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#- module: windows
# metricsets: ["perfmon"]
# enabled: true
# period: 10s
# perfmon.counters:
3 changes: 3 additions & 0 deletions metricbeat/module/windows/_meta/docs.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
== windows Module

This is the windows Module.
10 changes: 10 additions & 0 deletions metricbeat/module/windows/_meta/fields.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
- key: windows
title: "Windows"
description: >
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[]beta
Module for Windows
fields:
- name: windows
type: group
description: >
fields:
4 changes: 4 additions & 0 deletions metricbeat/module/windows/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/*
Package windows is a Metricbeat module that contains MetricSets.
*/
package windows
19 changes: 19 additions & 0 deletions metricbeat/module/windows/perfmon/_meta/data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"@timestamp":"2016-05-23T08:05:34.853Z",
"beat":{
"hostname":"beathost",
"name":"beathost"
},
"metricset":{
"host":"localhost",
"module":"mysql",
"name":"status",
"rtt":44269
},
"windows":{
"perfmon":{
"example": "perfmon"
}
},
"type":"metricsets"
}
24 changes: 24 additions & 0 deletions metricbeat/module/windows/perfmon/_meta/docs.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
=== windows perfmon MetricSet

This is the perfmon metricset of the module windows.

[float]
=== Features and configuration

Metricset to collect performance counters.
Example configuration:
```
- module: windows
metricsets: ["perfmon"]
enabled: true
period: 10s
perfmon.counters:
- group: "processor"
collectors:
- alias: "processor_time"
query: '\Processor Information(_Total)\% Processor Time'
- group: "disk"
collectors:
- alias: "bytes_written"
query: '\PhysicalDisk(_Total)\Disk Writes/sec'
```
26 changes: 26 additions & 0 deletions metricbeat/module/windows/perfmon/_meta/fields.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
- name: perfmon
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For dynamic metricsets, this will change so what we nomrally do is just define windows (module) part and leave the rest empty. Check the jmx metricset as an example.

type: group
fields:
- name: counters
type: group
description: >
Grouping of different counters
fields:
- name: group
type: string
description: >
Name of the group. For example `processor` or `disk`

- name: collectors
type: group
fields:
- name: alias
type: string
description: >
Short form for the query

- name: query
type: string
description: >
The query. For example `\\Processor Information(_Total)\\% Processor Performance`. Backslashes have to be escaped.

32 changes: 32 additions & 0 deletions metricbeat/module/windows/perfmon/defs_windows.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// +build ignore

package perfmon

/*
#include <windows.h>
#include <stdio.h>
#include <conio.h>
#include <pdh.h>
#include <pdhmsg.h>
#cgo LDFLAGS: -lpdh
*/
import "C"

const (
ERROR_SUCCESS = C.ERROR_SUCCESS
PDH_STATUS_VALID_DATA = C.PDH_CSTATUS_VALID_DATA
PDH_STATUS_NEW_DATA = C.PDH_CSTATUS_NEW_DATA
PDH_NO_DATA = C.PDH_NO_DATA
PDH_STATUS_NO_OBJECT = C.PDH_CSTATUS_NO_OBJECT
PDH_STATUS_NO_COUNTER = C.PDH_CSTATUS_NO_COUNTER
PDH_STATUS_INVALID_DATA = C.PDH_CSTATUS_INVALID_DATA
PDH_INVALID_HANDLE = C.PDH_INVALID_HANDLE
PDH_INVALID_DATA = C.PDH_INVALID_DATA
PDH_NO_MORE_DATA = C.PDH_NO_MORE_DATA
PDH_CALC_NEGATIVE_DEMONIATOR = C.PDH_CALC_NEGATIVE_DENOMINATOR
PdhFmtDouble = C.PDH_FMT_DOUBLE
PdhFmtLarge = C.PDH_FMT_LARGE
PdhFmtLong = C.PDH_FMT_LONG
)

type PdhCounterValue C.PDH_FMT_COUNTERVALUE
25 changes: 25 additions & 0 deletions metricbeat/module/windows/perfmon/defs_windows_386.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package perfmon

const (
ERROR_SUCCESS = 0x0
PDH_STATUS_VALID_DATA = 0x0
PDH_STATUS_NEW_DATA = 0x1
PDH_NO_DATA = 0x800007d5
PDH_STATUS_NO_OBJECT = 0xc0000bb8
PDH_STATUS_NO_COUNTER = 0xc0000bb9
PDH_STATUS_INVALID_DATA = 0xc0000bba
PDH_INVALID_HANDLE = 0xc0000bbc
PDH_INVALID_DATA = 0xc0000bc6
PDH_NO_MORE_DATA = 0xc0000bcc
PDH_CALC_NEGATIVE_DENOMINATOR = 0x800007d6
PdhFmtDouble = 0x00000200
PdhFmtLarge = 0x00000400
PdhFmtLong = 0x00000100
)

type PdhCounterValue struct {
CStatus uint32
Pad_cgo_0 [4]byte
LongValue int32
Pad_cgo_1 [4]byte
}
25 changes: 25 additions & 0 deletions metricbeat/module/windows/perfmon/defs_windows_amd64.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package perfmon

const (
ERROR_SUCCESS = 0x0
PDH_STATUS_VALID_DATA = 0x0
PDH_STATUS_NEW_DATA = 0x1
PDH_NO_DATA = 0x800007d5
PDH_STATUS_NO_OBJECT = 0xc0000bb8
PDH_STATUS_NO_COUNTER = 0xc0000bb9
PDH_STATUS_INVALID_DATA = 0xc0000bba
PDH_INVALID_HANDLE = 0xc0000bbc
PDH_INVALID_DATA = 0xc0000bc6
PDH_NO_MORE_DATA = 0xc0000bcc
PDH_CALC_NEGATIVE_DENOMINATOR = 0x800007d6
PdhFmtDouble = 0x00000200
PdhFmtLarge = 0x00000400
PdhFmtLong = 0x00000100
)

type PdhCounterValue struct {
CStatus uint32
Pad_cgo_0 [4]byte
LongValue int32
Pad_cgo_1 [4]byte
}
4 changes: 4 additions & 0 deletions metricbeat/module/windows/perfmon/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/*
Package perfmon collect windows performance counters.
*/
package perfmon
Loading