From ce5c6eed72c896d2b694e70dba4ce67f189d05f7 Mon Sep 17 00:00:00 2001 From: Ben Reedy Date: Mon, 26 Oct 2020 19:05:46 +1000 Subject: [PATCH] Add configuration file documentation Signed-off-by: Ben Reedy --- README.md | 30 ++++++++++++++++++++++++++++++ docs/example_config.yml | 15 +++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 docs/example_config.yml diff --git a/README.md b/README.md index 159fc7cf..af487a03 100644 --- a/README.md +++ b/README.md @@ -136,6 +136,36 @@ The prometheus metrics will be exposed on [localhost:9182](http://localhost:9182 When there are multiple processes with the same name, WMI represents those after the first instance as `process-name#index`. So to get them all, rather than just the first one, the [regular expression](https://en.wikipedia.org/wiki/Regular_expression) must use `.+`. See [process](docs/collector.process.md) for more information. +### Using a configuration file + +YAML configuration files can be specified with the `--config.file` flag. E.G. `.\windows_exporter.exe --config.file=config.yml` + +```yaml +collectors: + enabled: cpu,cs,net,service +collector: + service: + services-where: "Name='windows_exporter'" +log: + level: warn +``` + +An example configuration file can be found [here](docs/example_config.yml). + +#### Configuration file notes + +If the `--config.file` flag is not specified, `windows_exporter` will look for a file located at `%programfiles\windows_exporter\config.yml` by default. If no file is found, CLI flags are processed as per normal. + +Configuration file values can be mixed with CLI flags. E.G. + +`.\windows_exporter.exe --collectors.enabled=cpu,logon` + +```yaml +log: + level: debug +``` + +CLI flags enjoy a higher priority over values specified in the configuration file. ## License diff --git a/docs/example_config.yml b/docs/example_config.yml new file mode 100644 index 00000000..f3a3e186 --- /dev/null +++ b/docs/example_config.yml @@ -0,0 +1,15 @@ +--- +# Note this is not an exhaustive list of all configuration values +collectors: + enabled: cpu,cs,logical_disk,net,os,service,system,textfile +collector: + service: + services-where: Name='windows_exporter' +log: + level: debug +scrape: + timeout-margin: 0.5 +telemetry: + addr: ":9182" + path: /metrics + max-requests: 5