Skip to content

Commit

Permalink
chore: clean up all markdown lint errors in second half of docs direc…
Browse files Browse the repository at this point in the history
  • Loading branch information
powersj authored Nov 24, 2021
1 parent d5d1f31 commit 97826bd
Show file tree
Hide file tree
Showing 17 changed files with 173 additions and 113 deletions.
74 changes: 37 additions & 37 deletions docs/PROCESSORS.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
### Processor Plugins
# Processor Plugins

This section is for developers who want to create a new processor plugin.

### Processor Plugin Guidelines
## Processor Plugin Guidelines

* A processor must conform to the [telegraf.Processor][] interface.
* Processors should call `processors.Add` in their `init` function to register
Expand All @@ -12,61 +12,61 @@ This section is for developers who want to create a new processor plugin.
* The `SampleConfig` function should return valid toml that describes how the
processor can be configured. This is include in the output of `telegraf
config`.
- The `SampleConfig` function should return valid toml that describes how the
* The `SampleConfig` function should return valid toml that describes how the
plugin can be configured. This is included in `telegraf config`. Please
consult the [Sample Config][] page for the latest style guidelines.
* The `Description` function should say in one line what this processor does.
- Follow the recommended [Code Style][].
* Follow the recommended [Code Style][].

### Processor Plugin Example
## Processor Plugin Example

```go
package printer

// printer.go

import (
"fmt"
"fmt"

"github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/plugins/processors"
"github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/plugins/processors"
)

type Printer struct {
Log telegraf.Logger `toml:"-"`
Log telegraf.Logger `toml:"-"`
}

var sampleConfig = `
`

func (p *Printer) SampleConfig() string {
return sampleConfig
return sampleConfig
}

func (p *Printer) Description() string {
return "Print all metrics that pass through this filter."
return "Print all metrics that pass through this filter."
}

// Init is for setup, and validating config.
func (p *Printer) Init() error {
return nil
return nil
}

func (p *Printer) Apply(in ...telegraf.Metric) []telegraf.Metric {
for _, metric := range in {
fmt.Println(metric.String())
}
return in
for _, metric := range in {
fmt.Println(metric.String())
}
return in
}

func init() {
processors.Add("printer", func() telegraf.Processor {
return &Printer{}
})
processors.Add("printer", func() telegraf.Processor {
return &Printer{}
})
}
```

### Streaming Processors
## Streaming Processors

Streaming processors are a new processor type available to you. They are
particularly useful to implement processor types that use background processes
Expand All @@ -84,38 +84,38 @@ Some differences from classic Processors:
* Processors should call `processors.AddStreaming` in their `init` function to register
themselves. See below for a quick example.

### Streaming Processor Example
## Streaming Processor Example

```go
package printer

// printer.go

import (
"fmt"
"fmt"

"github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/plugins/processors"
"github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/plugins/processors"
)

type Printer struct {
Log telegraf.Logger `toml:"-"`
Log telegraf.Logger `toml:"-"`
}

var sampleConfig = `
`

func (p *Printer) SampleConfig() string {
return sampleConfig
return sampleConfig
}

func (p *Printer) Description() string {
return "Print all metrics that pass through this filter."
return "Print all metrics that pass through this filter."
}

// Init is for setup, and validating config.
func (p *Printer) Init() error {
return nil
return nil
}

// Start is called once when the plugin starts; it is only called once per
Expand All @@ -135,13 +135,13 @@ func (p *Printer) Start(acc telegraf.Accumulator) error {
// Metrics you don't want to pass downstream should have metric.Drop() called,
// rather than simply omitting the acc.AddMetric() call
func (p *Printer) Add(metric telegraf.Metric, acc telegraf.Accumulator) error {
// print!
fmt.Println(metric.String())
// pass the metric downstream, or metric.Drop() it.
// Metric will be dropped if this function returns an error.
acc.AddMetric(metric)
// print!
fmt.Println(metric.String())
// pass the metric downstream, or metric.Drop() it.
// Metric will be dropped if this function returns an error.
acc.AddMetric(metric)

return nil
return nil
}

// Stop gives you an opportunity to gracefully shut down the processor.
Expand All @@ -154,9 +154,9 @@ func (p *Printer) Stop() error {
}

func init() {
processors.AddStreaming("printer", func() telegraf.StreamingProcessor {
return &Printer{}
})
processors.AddStreaming("printer", func() telegraf.StreamingProcessor {
return &Printer{}
})
}
```

Expand Down
3 changes: 1 addition & 2 deletions docs/PROFILING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ By default, the profiling is turned off.

To enable profiling you need to specify address to config parameter `pprof-addr`, for example:

```
```shell
telegraf --config telegraf.conf --pprof-addr localhost:6060
```

Expand All @@ -21,4 +21,3 @@ or to look at a 30-second CPU profile:
`go tool pprof http://localhost:6060/debug/pprof/profile?seconds=30`

To view all available profiles, open `http://localhost:6060/debug/pprof/` in your browser.

2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@
[profiling]: /docs/PROFILING.md
[winsvc]: /docs/WINDOWS_SERVICE.md
[faq]: /docs/FAQ.md
[nightlies]: /docs/NIGHTLIES.md
[nightlies]: /docs/NIGHTLIES.md
9 changes: 8 additions & 1 deletion docs/SQL_DRIVERS_INPUT.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ might change between versions. Please check the driver documentation for availab

database | driver | aliases | example DSN | comment
---------------------| ------------------------------------------------------| --------------- | -------------------------------------------------------------------------------------- | -------
CockroachDB | [cockroach](https://github.com/jackc/pgx) | postgres<br>pgx | see _postgres_ driver | uses PostgresQL driver
CockroachDB | [cockroach](https://github.com/jackc/pgx) | postgres or pgx | see _postgres_ driver | uses PostgresQL driver
MariaDB | [maria](https://github.com/go-sql-driver/mysql) | mysql | see _mysql_ driver | uses MySQL driver
Microsoft SQL Server | [sqlserver](https://github.com/denisenkom/go-mssqldb) | mssql | `username:password@host/instance?param1=value&param2=value` | uses newer _sqlserver_ driver
MySQL | [mysql](https://github.com/go-sql-driver/mysql) | | `[username[:password]@][protocol[(address)]]/dbname[?param1=value1&...&paramN=valueN]` | see [driver docs](https://github.com/go-sql-driver/mysql) for more information
Expand All @@ -16,28 +16,35 @@ TiDB | [tidb](https://github.com/go-sql-driver/mysql) | m
## Comments

### Driver aliases

Some database drivers are supported though another driver (e.g. CockroachDB). For other databases we provide a more
obvious name (e.g. postgres) compared to the driver name. For all of those drivers you might use an _alias_ name
during configuration.

### Example data-source-name DSN

The given examples are just that, so please check the driver documentation for the exact format
and available options and parameters. Please note that the format of a DSN might also change
between driver version.

### Type conversions

Telegraf relies on type conversion of the database driver and/or the golang sql framework. In case you find
any problem, please open an issue!

## Help

If nothing seems to work, you might find help in the telegraf forum or in the chat.

### The documentation is wrong

Please open an issue or even better send a pull-request!

### I found a bug

Please open an issue or even better send a pull-request!

### My database is not supported

We currently cannot support CGO drivers in telegraf! Please check if a **pure Go** driver for the [golang sql framework](https://golang.org/pkg/database/sql/) exists.
If you found such a driver, please let us know by opening an issue or even better by sending a pull-request!
23 changes: 12 additions & 11 deletions docs/TEMPLATE_PATTERN.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ Template patterns are a mini language that describes how a dot delimited
string should be mapped to and from [metrics][].

A template has the form:
```

```text
"host.mytag.mytag.measurement.measurement.field*"
```

Expand All @@ -25,9 +26,9 @@ can also be specified multiple times.
**NOTE:** `measurement` must be specified in your template.
**NOTE:** `field*` cannot be used in conjunction with `measurement*`.

### Examples
## Examples

#### Measurement & Tag Templates
### Measurement & Tag Templates

The most basic template is to specify a single transformation to apply to all
incoming metrics. So the following template:
Expand All @@ -40,7 +41,7 @@ templates = [

would result in the following Graphite -> Telegraf transformation.

```
```text
us.west.cpu.load 100
=> cpu.load,region=us.west value=100
```
Expand All @@ -55,7 +56,7 @@ templates = [
]
```

#### Field Templates
### Field Templates

The field keyword tells Telegraf to give the metric that field name.
So the following template:
Expand All @@ -69,7 +70,7 @@ templates = [

would result in the following Graphite -> Telegraf transformation.

```
```text
cpu.usage.idle.percent.eu-east 100
=> cpu_usage,region=eu-east idle_percent=100
```
Expand All @@ -86,12 +87,12 @@ templates = [

which would result in the following Graphite -> Telegraf transformation.

```
```text
cpu.usage.eu-east.idle.percentage 100
=> cpu_usage,region=eu-east idle_percentage=100
```

#### Filter Templates
### Filter Templates

Users can also filter the template(s) to use based on the name of the bucket,
using glob matching, like so:
Expand All @@ -105,15 +106,15 @@ templates = [

which would result in the following transformation:

```
```text
cpu.load.eu-east 100
=> cpu_load,region=eu-east value=100
mem.cached.localhost 256
=> mem_cached,host=localhost value=256
```

#### Adding Tags
### Adding Tags

Additional tags can be added to a metric that don't exist on the received metric.
You can add additional tags by specifying them after the pattern.
Expand All @@ -128,7 +129,7 @@ templates = [

would result in the following Graphite -> Telegraf transformation.

```
```text
cpu.usage.idle.eu-east 100
=> cpu_usage,region=eu-east,datacenter=1a idle=100
```
Expand Down
39 changes: 21 additions & 18 deletions docs/TLS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ possible, plugins will provide the standard settings described below. With the
exception of the advanced configuration available TLS settings will be
documented in the sample configuration.

### Client Configuration
## Client Configuration

For client TLS support we have the following options:

```toml
## Root certificates for verifying server certificates encoded in PEM format.
# tls_ca = "/etc/telegraf/ca.pem"
Expand Down Expand Up @@ -52,23 +53,23 @@ for the interest of brevity.
## Define list of allowed ciphers suites. If not defined the default ciphers
## supported by Go will be used.
## ex: tls_cipher_suites = [
## "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305",
## "TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305",
## "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256",
## "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256",
## "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384",
## "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384",
## "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256",
## "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA",
## "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256",
## "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA",
## "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA",
## "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA",
## "TLS_RSA_WITH_AES_128_GCM_SHA256",
## "TLS_RSA_WITH_AES_256_GCM_SHA384",
## "TLS_RSA_WITH_AES_128_CBC_SHA256",
## "TLS_RSA_WITH_AES_128_CBC_SHA",
## "TLS_RSA_WITH_AES_256_CBC_SHA"
## "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305",
## "TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305",
## "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256",
## "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256",
## "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384",
## "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384",
## "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256",
## "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA",
## "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256",
## "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA",
## "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA",
## "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA",
## "TLS_RSA_WITH_AES_128_GCM_SHA256",
## "TLS_RSA_WITH_AES_256_GCM_SHA384",
## "TLS_RSA_WITH_AES_128_CBC_SHA256",
## "TLS_RSA_WITH_AES_128_CBC_SHA",
## "TLS_RSA_WITH_AES_256_CBC_SHA"
## ]
# tls_cipher_suites = []

Expand All @@ -80,6 +81,7 @@ for the interest of brevity.
```

Cipher suites for use with `tls_cipher_suites`:

- `TLS_RSA_WITH_RC4_128_SHA`
- `TLS_RSA_WITH_3DES_EDE_CBC_SHA`
- `TLS_RSA_WITH_AES_128_CBC_SHA`
Expand Down Expand Up @@ -107,6 +109,7 @@ Cipher suites for use with `tls_cipher_suites`:
- `TLS_CHACHA20_POLY1305_SHA256`

TLS versions for use with `tls_min_version` or `tls_max_version`:

- `TLS10`
- `TLS11`
- `TLS12`
Expand Down
Loading

0 comments on commit 97826bd

Please sign in to comment.