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

in_windows_exporter_metrics: Add descriptions for service collector. #1140

Merged
merged 30 commits into from
Jul 13, 2023
Merged
Changes from 4 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
9ece6e2
in_windows_exporter_metrics: Add descriptions for service collector.
cosmo0920 Jun 22, 2023
ad2830e
Update pipeline/inputs/windows-exporter-metrics.md
cosmo0920 Jun 26, 2023
9411809
in_windows_exporter_metrics: Unify the description of exclude parameter
cosmo0920 Jun 26, 2023
a2b7e0d
in_windows_exporter_metrics: Use upper case for where keyword
cosmo0920 Jun 26, 2023
d124200
USe upper case WHERE
cosmo0920 Jun 26, 2023
e3ce17d
Fix English for WHERE clause description
cosmo0920 Jun 26, 2023
1dcbc57
Fix description for we.service.where
cosmo0920 Jun 26, 2023
5c1f083
Fix description for filtering with WHERE clause
cosmo0920 Jun 26, 2023
8bc179f
Use correct title style
cosmo0920 Jun 26, 2023
aeb3bbd
Remove a needless sentence
cosmo0920 Jun 26, 2023
cce5e8d
Add for example to show description of example for we.service.where
cosmo0920 Jun 26, 2023
a8e35f5
Use natural English for showing the example result of we.service.where
cosmo0920 Jun 26, 2023
30ae2bf
Use concreate sentence to describe the example circumstance
cosmo0920 Jun 26, 2023
04b84aa
Avoid confusable sentence style
cosmo0920 Jun 26, 2023
e3cdef2
Remove a needless "the"
cosmo0920 Jun 26, 2023
2f75baa
Organize sentence structure for translating into LIKE operator
cosmo0920 Jun 26, 2023
f35b95d
Use the correct from of verb for 3rd person
cosmo0920 Jun 26, 2023
3d173a7
Use will instead of should
cosmo0920 Jun 26, 2023
e18c8ed
Use will instead of should because of always occurring things
cosmo0920 Jun 26, 2023
1d13920
Use the correct form of verb for 3rd person
cosmo0920 Jun 26, 2023
3f5ef0a
Use will instead of should
cosmo0920 Jun 26, 2023
454e022
in_windows_exporter_metrics: Use the correct parameter
cosmo0920 Jun 26, 2023
3f742c5
in_windows_exporter_metrics: Describe more concreate prerequisites
cosmo0920 Jun 26, 2023
37cc46d
Remove a needless "the"
cosmo0920 Jun 26, 2023
ca0af4c
Organize the description of how to be translated into LIKE operator w…
cosmo0920 Jun 26, 2023
0b0b338
Use will instead of should
cosmo0920 Jun 26, 2023
efc16eb
in_windows_exporter_metrics: Remove a garbage line
cosmo0920 Jun 26, 2023
82e0308
Use the more concreate description to describe application order of t…
cosmo0920 Jun 26, 2023
ab2aab3
Revise a description for service collector.
cosmo0920 Jun 26, 2023
efab53f
in_windows_exporter_metrics: Add an example when specified three of s…
cosmo0920 Jun 26, 2023
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
93 changes: 89 additions & 4 deletions pipeline/inputs/windows-exporter-metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,17 @@ The initial release of Windows Exporter Metrics contains a single collector avai
**Important note:** Metrics collected with Windows Exporter Metrics flow through a separate pipeline from logs and current filters do not operate on top of metrics.


## Configuration
## Configuration

| Key | Description | Default |
| --------------- | ---------------------------------------------------------------------- | --------- |
| scrape\_interval | The rate at which metrics are collected from the host operating system | 5 seconds |
| we.logical\_disk.allow\_disk\_regex | Specify the regex for logical disk metrics to allow collection of. Collect all by default. | "/.+/" |
| we.logical\_disk.deny\_disk\_regex | Specify the regex for logical disk metrics to prevent collection of/ignore. Allow all by default. | `NULL` |
|we.net.allow\_nic\_regex | Specify the regex for network metrics captured by the name of the NIC, by default captures all NICs but to exclude adjust the regex. | "/.+/" |
| we.service.where | Specify the where clause for retrieving service metrics. | `NULL` |
cosmo0920 marked this conversation as resolved.
Show resolved Hide resolved
| we.service.include | Specify the key value pairs for the include condition for the WHERE clause of service metrics. | `NULL` |
| we.service.exclude | Specify the key value pairs for the exclude condition for the WHERE clause of service metrics. | `NULL` |
| collector.cpu.scrape\_interval | The rate in seconds at which cpu metrics are collected from the host operating system. If a value greater than 0 is used then it overrides the global default otherwise the global default is used. | 0 seconds |
| collector.net.scrape\_interval | The rate in seconds at which net metrics are collected from the host operating system. If a value greater than 0 is used then it overrides the global default otherwise the global default is used. | 0 seconds |
| collector.logical_disk.scrape\_interval | The rate in seconds at which logical\_disk metrics are collected from the host operating system. If a value greater than 0 is used then it overrides the global default otherwise the global default is used. | 0 seconds |
Expand All @@ -30,7 +33,8 @@ The initial release of Windows Exporter Metrics contains a single collector avai
| collector.cpu\_info.scrape\_interval | The rate in seconds at which cpu\_info metrics are collected from the host operating system. If a value greater than 0 is used then it overrides the global default otherwise the global default is used. | 0 seconds |
| collector.logon.scrape\_interval | The rate in seconds at which logon metrics are collected from the host operating system. If a value greater than 0 is used then it overrides the global default otherwise the global default is used. | 0 seconds |
| collector.system.scrape\_interval | The rate in seconds at which system metrics are collected from the host operating system. If a value greater than 0 is used then it overrides the global default otherwise the global default is used. | 0 seconds |
| metrics | To specify which metrics are collected from the host operating system. | `"cpu,cpu_info,os,net,logical_disk,cs,thermalzone,logon,system"` |
| collector.service.scrape\_interval | The rate in seconds at which service metrics are collected from the host operating system. If a value greater than 0 is used then it overrides the global default otherwise the global default is used. | 0 seconds |
| metrics | To specify which metrics are collected from the host operating system. | `"cpu,cpu_info,os,net,logical_disk,cs,thermalzone,logon,system,service"` |

## Collectors available

Expand All @@ -49,6 +53,7 @@ The following table describes the available collectors as part of this plugin. A
| cpu\_info | Exposes cpu\_info statistics. | Windows | v2.0.8 |
| logon | Exposes logon statistics. | Windows | v2.0.8 |
| system | Exposes system statistics. | Windows | v2.0.8 |
| service | Exposes system statistics. | Windows | v2.1.6 |

## Getting Started

Expand Down Expand Up @@ -81,7 +86,7 @@ In the following configuration file, the input plugin _windows_exporter_metrics
host 0.0.0.0
port 2021


```

You can test the expose of the metrics by using _curl:_
Expand All @@ -90,9 +95,89 @@ You can test the expose of the metrics by using _curl:_
curl http://127.0.0.1:2021/metrics
```

### Service where clause

Windows service collector will retrieve entire service information in the local box.
cosmo0920 marked this conversation as resolved.
Show resolved Hide resolved
`we.service.where`, `we.service.include`, and `we.service.exclude` can operate to reduce the volume of the service metrics.
cosmo0920 marked this conversation as resolved.
Show resolved Hide resolved

To reduce the amount of this metrics, users have to use WHERE clause.
cosmo0920 marked this conversation as resolved.
Show resolved Hide resolved
This syntax is defined in [the WMI Query Language(WQL)](https://learn.microsoft.com/en-us/windows/win32/wmisdk/wql-sql-for-wmi).

Here is how these parameters should work:

#### we.service.where

`we.service.where` is just handled as normal where clause.
cosmo0920 marked this conversation as resolved.
Show resolved Hide resolved
When a user specify the parameter as follows:
cosmo0920 marked this conversation as resolved.
Show resolved Hide resolved

```
we.service.where Status!='OK'
```

The WMI query should be called as:
cosmo0920 marked this conversation as resolved.
Show resolved Hide resolved
```
SELECT * FROM Win32_Service WHERE Status!='OK'
```

Then, WMI mechanism should return the information which has not OK status in this example.
cosmo0920 marked this conversation as resolved.
Show resolved Hide resolved

### we.service.include

`we.service.include` is interpreted into where clause.
cosmo0920 marked this conversation as resolved.
Show resolved Hide resolved
If the multiple key-value pairs are specified, the values will be concatenated with `OR`.
cosmo0920 marked this conversation as resolved.
Show resolved Hide resolved
Also, the values contain `%` character, `LIKE` operator should be used in the transrated clause instead of `=` operator.
cosmo0920 marked this conversation as resolved.
Show resolved Hide resolved
When a user specify the parameter as follows:
cosmo0920 marked this conversation as resolved.
Show resolved Hide resolved

```python
we.service.include {"Name":"docker","Name":"%Svc%", "Name":"%Service"}
```

The parameter should be interpreted as:
cosmo0920 marked this conversation as resolved.
Show resolved Hide resolved
```
(Name='docker' OR Name LIKE '%Svc%' OR Name LIKE '%Service')
```

The WMI query should be called with the translated parameter as:
cosmo0920 marked this conversation as resolved.
Show resolved Hide resolved

```
SELECT * FROM Win32_Service WHERE (Name='docker' OR Name LIKE '%Svc%' OR Name LIKE '%Service')
```

### we.service.exclude

`we.service.where` is interpreted into where clause.
cosmo0920 marked this conversation as resolved.
Show resolved Hide resolved
If the multiple key-value pairs are specified, the values will be concatenated with `AND`.
cosmo0920 marked this conversation as resolved.
Show resolved Hide resolved
Also, the values contain `%` character, `LIKE` operator should be used in the translated clause instead of `!=` operator.
cosmo0920 marked this conversation as resolved.
Show resolved Hide resolved
When a user specify the parameter as follows:
cosmo0920 marked this conversation as resolved.
Show resolved Hide resolved

```python
we.service.exclude {"Name":"UdkUserSvc%","Name":"webthreatdefusersvc%","Name":"XboxNetApiSvc"}
```

The parameter should be interpreted as:
cosmo0920 marked this conversation as resolved.
Show resolved Hide resolved
```
(NOT Name LIKE 'UdkUserSvc%' AND NOT Name LIKE 'webthreatdefusersvc%' AND Name!='XboxNetApiSvc')
```

The WMI query should be called with the translated parameter as:
cosmo0920 marked this conversation as resolved.
Show resolved Hide resolved

```
SELECT * FROM Win32_Service WHERE (NOT Name LIKE 'UdkUserSvc%' AND NOT Name LIKE 'webthreatdefusersvc%' AND Name!='XboxNetApiSvc')
```

### advanced usages
cosmo0920 marked this conversation as resolved.
Show resolved Hide resolved

`we.service.where`, `we.service.include`, and `we.service.exclude` can be used in the same time.
cosmo0920 marked this conversation as resolved.
Show resolved Hide resolved
However, these parameters are prioritized as follows:
cosmo0920 marked this conversation as resolved.
Show resolved Hide resolved

1. `we.service.include` translated and applied into the where clause in the service collector
1. `we.service.exclude` translated and applied into the where clause in the service collector
1. If the `we.service.include` is applied, translated `we.service.include` and `we.service.exclude` conditions are concatenated with `AND`.
1. `we.service.where` is just handled as-is into the where clause in the service collector .
1. If either of the above parameters is applied, the clause will be applied with `AND (` _the value of `we.service.where`_ `)`.

cosmo0920 marked this conversation as resolved.
Show resolved Hide resolved
## Enhancement Requests

Our current plugin implements a sub-set of the available collectors in the original Prometheus Windows Exporter, if you would like that we prioritize a specific collector please open a Github issue by using the following template:\
\
\- [in_windows_exporter_metrics](https://github.com/fluent/fluent-bit/issues/new?assignees=\&labels=\&template=feature_request.md\&title=in_windows_exporter_metrics:%20add%20ABC%20collector)