https://github.com/optimizely/chef_opentsdb_handler
Chef handler for sending metrics to OpentTSDB
https://github.com/optimizely/chef_opentsdb_handler
Last synced: 10 months ago
JSON representation
Chef handler for sending metrics to OpentTSDB
- Host: GitHub
- URL: https://github.com/optimizely/chef_opentsdb_handler
- Owner: optimizely
- License: mit
- Archived: true
- Created: 2015-10-20T19:39:44.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-10-27T17:52:32.000Z (over 10 years ago)
- Last Synced: 2025-03-01T12:17:28.930Z (about 1 year ago)
- Language: Ruby
- Size: 130 KB
- Stars: 0
- Watchers: 135
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
opentsdb_handler Cookbook
==============================
This cookbook sets up a handler that reports to [OpenTSDB](http://opentsdb.net/) at the end of a chef run
Requirements
------------
The only requirement is the chef_handler cookbook
Attributes
----------
Key
Type
Description
Default
['opentsdb_handler']['metrics']
Hash
this is where each metric to be sent is defined as { unique_name => metric_hash }
{}
['opentsdb_handler']['metric'][unique_name]['name']
String
Metric name
None
['opentsdb_handler']['metrics'][unique_name]['value']
Hash
Value of metric
None
['opentsdb_handler']['metrics'][unique_name]['tags']
Hash
Key => Value hash of tags for the metric.
{'hostname' => Socket.gethostname}(IN HANDLER SCRIPT)
['opentsdb_handler'][handler_name]['run_status_tag']
Boolean
Will add run_status=0|1 (success, failure respectively) tag if true
false
['opentsdb_handler']['run_status']['elapsed_time'|'start_time'|'end_time']
Boolean
Will send a metric of the chef.elapsed_time (or start_time or end_time) if true. Change tags on ['handlers']['elapsed_time']['tags']
false
['opentsdb_handler']['hostname']
opentsdb
Hostname of OpenTSDB server
opentsdb (IN HANDLER SCRIPT)
['opentsdb_handler']['port']
Integer
Port of OpenTSDB server
4242 (IN HANDLER SCRIPT)
['opentsdb_handler']['timeout']
Integer
Timeout before failing to send to metric
10 (IN HANDLER SCRIPT)
Usage
-----
#### opentsdb_handler::default
Include `opentsdb_handler` in your node's `run_list` and add the following attributes:
```ruby
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
------------
1. Fork the repository on Github
2. `bundle install`
3. Make changes
4. Test your changes [Testing](#Testing)
Testing
-------
Integration tests are run with [test-kitchen](https://github.com/test-kitchen/test-kitchen), [kitchen-vagrant](https://github.com/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](https://github.com/sethvargo/chefspec)
Linting is done with [foodcritic](https://acrmp.github.io/foodcritic/) and [rubocop](https://github.com/bbatsov/rubocop)
Run unit and linting with:
```
rake test
```
License and Authors
-------------------
Authors: michael.wood@optimizely.com