Update README.md

This commit is contained in:
marknmel 2016-03-14 12:10:25 -04:00
parent 2fbcb5c6d8
commit d3d351d3c6
1 changed files with 31 additions and 22 deletions

View File

@ -3,24 +3,11 @@
The exec plugin can execute arbitrary commands which output: The exec plugin can execute arbitrary commands which output:
* JSON * JSON
* InfluxDB [line-protocol](https://docs.influxdata.com/influxdb/v0.9/write_protocols/line/) * InfluxDB [line-protocol](https://docs.influxdata.com/influxdb/v0.10/write_protocols/line/)
* Graphite [graphite-protocol](http://graphite.readthedocs.org/en/latest/feeding-carbon.html) * Graphite [graphite-protocol](http://graphite.readthedocs.org/en/latest/feeding-carbon.html)
> Graphite understands messages with this format:
> ``` ### Example 1 - JSON
metric_path value timestamp\n
```
> __metric_path__ is the metric namespace that you want to populate.
> __value__ is the value that you want to assign to the metric at this time.
> __timestamp__ is the unix epoch time.
If using JSON, only numeric values are parsed and turned into floats. Booleans
and strings will be ignored.
### Configuration ### Configuration
@ -64,8 +51,6 @@ Other options for modifying the measurement names are:
name_prefix = "prefix_" name_prefix = "prefix_"
``` ```
### Example 1
Let's say that we have the above configuration, and mycollector outputs the Let's say that we have the above configuration, and mycollector outputs the
following JSON: following JSON:
@ -86,9 +71,12 @@ The collected metrics will be stored as fields under the measurement
exec_mycollector a=0.5,b_c=0.1,b_d=5 1452815002357578567 exec_mycollector a=0.5,b_c=0.1,b_d=5 1452815002357578567
``` ```
### Example 2 ### Example 2 - Influx Line-Protocol
Now let's say we have the following configuration: In this example an application called ```/usr/bin/line_protocol_collector```
and a script called ```/tmp/test2.sh``` are configured for ```[[inputs.exec]]```
#### Configuration
``` ```
[[inputs.exec]] [[inputs.exec]]
@ -103,7 +91,7 @@ Now let's say we have the following configuration:
data_format = "influx" data_format = "influx"
``` ```
And line_protocol_collector outputs the following line protocol: The line_protocol_collector application outputs the following line protocol:
``` ```
cpu,cpu=cpu0,host=foo,datacenter=us-east usage_idle=99,usage_busy=1 cpu,cpu=cpu0,host=foo,datacenter=us-east usage_idle=99,usage_busy=1
@ -118,9 +106,10 @@ cpu,cpu=cpu6,host=foo,datacenter=us-east usage_idle=99,usage_busy=1
You will get data in InfluxDB exactly as it is defined above, You will get data in InfluxDB exactly as it is defined above,
tags are cpu=cpuN, host=foo, and datacenter=us-east with fields usage_idle tags are cpu=cpuN, host=foo, and datacenter=us-east with fields usage_idle
and usage_busy. They will receive a timestamp at collection time. and usage_busy. They will receive a timestamp at collection time.
Each line must end in \n, just as the Influx line protocol does.
### Example 3 ### Example 3 - Graphite
We can also change the data_format to "graphite" to use the metrics collecting scripts such as (compatible with graphite): We can also change the data_format to "graphite" to use the metrics collecting scripts such as (compatible with graphite):
@ -178,3 +167,23 @@ The templates configuration will be used to parse the graphite metrics to suppor
More detail information about templates, please refer to [The graphite Input] (https://github.com/influxdata/influxdb/blob/master/services/graphite/README.md) More detail information about templates, please refer to [The graphite Input] (https://github.com/influxdata/influxdb/blob/master/services/graphite/README.md)
> Graphite understands messages with this format:
> ```
metric_path value timestamp\n
```
> __metric_path__ is the metric namespace that you want to populate.
> __value__ is the value that you want to assign to the metric at this time.
> __timestamp__ is the unix epoch time.
If using JSON, only numeric values are parsed and turned into floats. Booleans
and strings will be ignored.