Update docs for newrelic output

This commit is contained in:
Daniel Nelson
2020-05-27 11:52:21 -07:00
parent 580ac61cf7
commit 7b06624885
4 changed files with 32 additions and 29 deletions

View File

@@ -1,22 +1,21 @@
#New Relic output plugin
This plugins writes to New Relic insights.
```
This plugins writes to New Relic Insights using the [Metrics API][].
To use this plugin you must first obtain an [Insights API Key][].
### Configuration
```toml
[[outputs.newrelic]]
## New Relic Insights API key
insights_key = "insights api key"
## New Relic Insights API key
insights_key = "insights api key"
# metric_prefix if defined, prefix's metrics name for easy identification
# metric_prefix = ""
## Prefix to add to add to metric name for easy identification.
# metric_prefix = ""
# harvest timeout, default is 15 seconds
# timeout = "15s"
## Timeout for writes to the New Relic API.
# timeout = "15s"
```
####Parameters
|Parameter Name|Type|Description|
|:-|:-|:-|
| insights_key | Required | Insights API Insert key |
| metric_prefix | Optional | If defined, prefix's metrics name for easy identification |
| timeout | Optional | If defined, changes harvest timeout |
[Metrics API]: https://docs.newrelic.com/docs/data-ingest-apis/get-data-new-relic/metric-api/introduction-metric-api
[Insights API Key]: https://docs.newrelic.com/docs/apis/get-started/intro-apis/types-new-relic-api-keys#user-api-key

View File

@@ -16,14 +16,15 @@ import (
// NewRelic nr structure
type NewRelic struct {
harvestor *telemetry.Harvester
dc *cumulative.DeltaCalculator
InsightsKey string `toml:"insights_key"`
MetricPrefix string `toml:"metric_prefix"`
Timeout internal.Duration `toml:"timeout"`
savedErrors map[int]interface{}
errorCount int
Client http.Client
harvestor *telemetry.Harvester
dc *cumulative.DeltaCalculator
savedErrors map[int]interface{}
errorCount int
Client http.Client `toml:"-"`
}
// Description returns a one-sentence description on the Output
@@ -34,14 +35,14 @@ func (nr *NewRelic) Description() string {
// SampleConfig : return default configuration of the Output
func (nr *NewRelic) SampleConfig() string {
return `
## New Relic Insights API key (required)
insights_key = "insights api key"
## New Relic Insights API key
insights_key = "insights api key"
# metric_prefix if defined, prefix's metrics name for easy identification (optional)
# metric_prefix = ""
# harvest timeout, default is 15 seconds
# timeout = "15s"
## Prefix to add to add to metric name for easy identification.
# metric_prefix = ""
## Timeout for writes to the New Relic API.
# timeout = "15s"
`
}
@@ -77,7 +78,6 @@ func (nr *NewRelic) Connect() error {
// Close any connections to the Output
func (nr *NewRelic) Close() error {
nr.errorCount = 0
nr.Client.CloseIdleConnections()
return nil
@@ -85,7 +85,6 @@ func (nr *NewRelic) Close() error {
// Write takes in group of points to be written to the Output
func (nr *NewRelic) Write(metrics []telegraf.Metric) error {
nr.errorCount = 0
nr.savedErrors = make(map[int]interface{})