fluent-plugin-growthforecast
GrowthForecastOutput
Fluentd plugin to output numbers(metrics) to 'GrowthForecast', metrics drawing tool over HTTP.
About GrowthForecast, see:
- Github: https://github.com/kazeburo/growthforecast
- Product site (japanese): http://kazeburo.github.com/GrowthForecast/
- Japanese blog post by @kazeburo: http://blog.nomadscafe.jp/2011/12/growthforecast.html
GrowthForecast is very simple and powerful tool to draw graphs what we want, with GrowthForecastOutput and Fluentd.
Requirements
| fluent-plugin-growthforecast | fluentd | ruby |
|---|---|---|
| >= 1.0.0 | >= v0.14.0 | >= 2.1 |
| < 1.0.0 | < v0.14.0 | >= 1.9 |
Configuration
For messages such as: tag:metrics {"field1":300, "field2":20, "field3diff":-30}
Configuration example for graphs in growthforecast with POST api url 'http://growthforecast.local/api/service1/metrics1/metrics_FIELDNAME'.
<match metrics>
@type growthforecast
gfapi_url http://growthforecast.local/api/
service service1
section metrics1
name_keys field1,field2,field3diff
</match>
With this configuration, out_growthforecast posts urls below.
http://growthforecast.local/api/service1/metrics1/metrics_field1
http://growthforecast.local/api/service1/metrics1/metrics_field2
http://growthforecast.local/api/service1/metrics1/metrics_field3diff
If you want to use tags for section or service in GrowthForecast, use tag_for options and remove_prefix (and not to set the section or service that the value of 'tag_for' used to.).
<match metrics.**>
@type growthforecast
gfapi_url http://growthforecast.local/api/
service service1
name_keys field1,field2,field3diff
tag_for section # or 'name_prefix'(default) or 'ignore' or 'service'
remove_prefix metrics
</match>
mode option available with gauge(default), count, modified, just same as mode of GrowthForecast POST parameter.
name_key_pattern REGEXP available instead of name_keys like this:
<match metrics.**>
@type growthforecast
gfapi_url http://growthforecast.local/api/
service service1
tag_for section # or 'name_prefix'(default) or 'ignore' or 'service'
remove_prefix metrics
name_key_pattern ^(field|key)\d+$
</match>
This configuration matches only with metrics.field1, metrics.key20, .... and doesn't match with metrics.field or metrics.foo.
If you want to customise for more flexible graph path, use graph_path option with ${tag} and ${key_name} placeholders.
<match test.service1>
@type growthforecast
gfapi_url http://growthforecast.local/api/
graph_path ${tag}/metrics1/${tag}_${key_name}
name_keys field1,field2,field3diff
remove_prefix test
</match>
With this configuration, out_growthforecast posts urls below.
http://growthforecast.local/api/service1/metrics1/service1_field1
http://growthforecast.local/api/service1/metrics1/service1_field2
http://growthforecast.local/api/service1/metrics1/service1_field3diff
If your GrowthForecast protected with basic authentication, specify authentication option:
<match metrics.**>
@type growthforecast
gfapi_url http://growthforecast.protected.anywhere.example.com/api/
service yourservice
tag_for section
name_keys fieldname
authentication basic
username yourusername
password secret!
</match>
Version v0.2.0 or later, this plugin uses HTTP connection keep-alive for a batch emitted events. To disable this, specify keepalive option:
<match metrics.**>
@type growthforecast
gfapi_url http://growthforecast.protected.anywhere.example.com/api/
service yourservice
tag_for section
name_keys fieldname
keepalive no
</match>
Parameters
-
gfapi_url (required)
The URL of a GrowthForecast API endpoint like
http://growth.forecast.local/api/. -
graph_path
The graph path for GrowthForecast API endpoint with the order of service, section, graph_name.
-
tag_for
Either of
name_prefix,section,service, orignore. Default isname_prefix.-
name_prefixuses the tag name as a graph_name prefix. -
sectionuses the tag name as a section_name. -
serviceuses the tag name as a service_name. -
ignoreuses the tag name for nothing.
-
-
remove_prefix
The prefix string which will be removed from the tag. This option would be useful using with the
tag_foroption. -
service
The service_name of graphs to create.
-
section
The section_name of graphs to create.
-
name_keys
Specify field names of the input record. Separate by , (comma). The values of these fields are posted as numbers, and names of thease fields are used as parts of grame_names. Either of
name_keysorname_key_patternis required. -
name_key_pattern
Specify the field names of the input record by a regular expression. The values of these fields are posted as numbers, and names of thease fields are used as parts of grame_names. Either of
name_keysorname_key_patternis required. -
graphs
You may use this option to specify graph names correspond to each of
name_keys. Separate by , (comma). The number of graph names must be same with the number ofname_keys. -
mode
The graph mode (either of
gauge,count, ormodified). Just same asmodeof GrowthForecast POST parameter. Default isgauge. -
keepalive
Use a keepalive HTTP connection. Default is false.
NOTE: To effectively use this, you may need to give a parameter
max_keepalive_reqs(default: 1) to Starlet ingrowthforecast.pl. -
background_post
Post to GrowthForecast in background thread, without retries for failures (Default: false)
-
timeout
Read/Write timeout seconds (Default: 60)
-
retry
Do retry for HTTP request failures, or not. This feature will be set as false for
background_post yesautomatically. (Default: true) -
ssl
Use SSL (https) or not. Default is false.
-
verify_ssl
Do SSL verification or not. Default is false (ignore the SSL verification).
-
authentication
Specify
basicif your GrowthForecast protected with basic authentication. Default is 'none' (no authentication). -
username
The username for authentication.
-
password
The password for authentication.
-
enable_float_number
Post a floating number rather than an interger number. Default is false.
NOTE: You need to run your GrowthForecast with
--enable-float-numberoption, supported by GrowthForecast v0.70 or later.
TODO
- patches welcome!
Copyright
- Copyright (c) 2012- TAGOMORI Satoshi (tagomoris)
- License
- Apache License, Version 2.0