cookbook 'opentsdb_handler', '= 0.1.0'
opentsdb_handler (2) Versions 0.1.0 Follow0
Installs/Configures opentsdb_handler
cookbook 'opentsdb_handler', '= 0.1.0', :supermarket
knife supermarket install opentsdb_handler
knife supermarket download opentsdb_handler
opentsdb_handler Cookbook
This cookbook sets up a handler that reports to OpenTSDB at the end of a chef run
Requirements
The only requirement is the chef_handler cookbook
Attributes
<table>
<tr>
<th>Key</th>
<th>Type</th>
<th>Description</th>
<th>Default</th>
</tr>
<tr>
<td><tt>['opentsdb_handler']['metrics']</tt></td>
<td>Hash</td>
<td>this is where each metric to be sent is defined as { unique_name => metric_hash }</td>
<td><tt>{}</tt></td>
</tr>
<tr>
<td><tt>['opentsdb_handler']['metric'][unique_name]['name']</tt></td>
<td>String</td>
<td>Metric name</td>
<td><tt>None</tt></td>
</tr>
<tr>
<td><tt>['opentsdb_handler']['metrics'][unique_name]['value']</tt></td>
<td>Hash</td>
<td>Value of metric</td>
<td><tt>None</tt></td>
</tr>
<tr>
<td><tt>['opentsdb_handler']['metrics'][unique_name]['tags']</tt></td>
<td>Hash</td>
<td>Key => Value hash of tags for the metric.</td>
<td><tt>{'hostname' => Socket.gethostname}(IN HANDLER SCRIPT)</tt></td>
</tr>
<tr>
<td><tt>['opentsdb_handler'][handler_name]['run_status_tag']</tt></td>
<td>Boolean</td>
<td>Will add run_status=0|1 (success, failure respectively) tag if true</td>
<td><tt>false</tt></td>
</tr>
<tr>
<td><tt>['opentsdb_handler']['run_status']['elapsed_time'|'start_time'|'end_time']</tt></td>
<td>Boolean</td>
<td>Will send a metric of the chef.elapsed_time (or start_time or end_time) if true. Change tags on ['handlers']['elapsed_time']['tags']</td>
<td><tt>false</tt></td>
</tr>
<tr>
<td><tt>['opentsdb_handler']['hostname']</tt></td>
<td>opentsdb</td>
<td>Hostname of OpenTSDB server</td>
<td><tt>opentsdb (IN HANDLER SCRIPT)</tt></td>
</tr>
<tr>
<td><tt>['opentsdb_handler']['port']</tt></td>
<td>Integer</td>
<td>Port of OpenTSDB server</td>
<td><tt>4242 (IN HANDLER SCRIPT)</tt></td>
</tr>
<tr>
<td><tt>['opentsdb_handler']['timeout']</tt></td>
<td>Integer</td>
<td>Timeout before failing to send to metric</td>
<td><tt>10 (IN HANDLER SCRIPT)</tt></td>
</tr>
</table>
Usage
opentsdb_handler::default
Include opentsdb_handler
in your node's run_list
and add the following attributes:
node.default['opentsdb_hander']['metrics']['flying_puppy_metric']['name'] = 'flying_puppy.metric' node.default['opentsdb_hander']['metrics']['flying_puppy_metric']['value'] = 10 # Optional node.default['opentsdb_hander']['metrics]['flying_puppy_metric']['tags'] = {"breed" => "corgi"}
You can add as many metrics to this hash as you want. The timestamp will be created at the start of the handler.
Contributing
- Fork the repository on Github
bundle install
- Make changes
- Test your changes Testing
Testing
Integration tests are run with test-kitchen, kitchen-vagrant, and [serverspec](serverspec.org) for integration testing. You can take a look at [.kitchen.yml] for how tests are set up. Run with:
rake kitchen:all
Unit testing is run with ChefSpec
Linting is done with foodcritic and rubocop
Run unit and linting with:
rake test
License and Authors
Authors: michael.wood@optimizely.com
Dependent cookbooks
chef_handler ~> 1.2.0 |
Contingent cookbooks
There are no cookbooks that are contingent upon this one.
opentsdb_handler CHANGELOG
This file is used to list changes made in each version of the opentsdb_handler cookbook.
0.1.0
- [mi-wood] - Initial release of opentsdb_handler
Check the Markdown Syntax Guide for help with Markdown.
The Github Flavored Markdown page describes the differences between markdown on github and standard markdown.
Foodcritic Metric
0.1.0 passed this metric
0.1.0 passed this metric