Repository is archived
No commit activity in last 3 years
No release in over 3 years
Pull statistics from Amazon CloudWatch into Graphite
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

~> 1.13
>= 1.19.0, ~> 1.19
>= 0.1.3, ~> 0.1
>= 1.1.10, ~> 1.1
~> 0.1
 Project Readme

AWS CloudwatchToGraphite Ruby Gem

This application will fetch a list of AWS CloudWatch metrics using the Fog library to connect to the Amazon APIs. It can parse a list of metric definitions in either JSON or YAML formats. It will take the results and submit them to a Graphite server of your choosing.

Gem Version Build Status Code Climate Coverage Status Dependency Status

Usage

Usage: cloudwatch_to_graphite [OPTIONS]

  -a, --access-key=KEY             AWS Access Key (Falls back to ENV['AWS_ACCESS_KEY_ID'])
  -s, --secret-key=KEY             AWS Secret Access Key (Falls back to ENV['AWS_SECRET_ACCESS_KEY'])
  -j, --json-metrics=FILE          Path to JSON metrics file
  -y, --yaml-metrics=FILE          Path to YAML metrics file
  -p, --protocol=udp               TCP or UDP (Default: udp)
  -r, --region=us-east-1           AWS Region (Default: us-east-1)
  -g, --graphite-server=host       Graphite Server (Default: localhost)
  -P, --graphite-port=port         Graphite Port (Default: 2003)
  -c, --carbon-prefix              Carbon Prefix (Default: cloudwatch)
  -l, --logfile=prefix             Log file (Default: stderr)
  -v, --verbose                    Increase verbosity
  -V, --version                    Print version and exit
  -h, --help                       help

JSON Metrics Definition File

{
  "metrics": [
    {
      "namespace": "AWS/ELB",
      "metricname": "RequestCount",
      "statistics": [ "Average", "Minimum", "Maximum" ],
      "dimensions": [{
        "name":"LoadBalancerName",
        "value":"MyLoadBalancer"
      }]
    },
    {
      "namespace": "AWS/EC2",
      "metricname": "CPUUtilization",
      "statistics": [ "Average", "Minimum", "Maximum" ],
      "dimensions": [{
        "name":"InstanceId",
        "value":"i-abc123456"
      }]
    }
  ]
}

YAML Metrics Definition File

---
metrics:
-
  namespace: AWS/ELB
  metricname: RequestCount
  statistics:
    - Average
    - Minimum
    - Maximum
  dimensions:
    -
      name: LoadBalancerName
      value: MyLoadBalancer
-
  namespace: AWS/EC2
  metricname: CPUUtilization
  statistics:
    - Average
    - Minimum
    - Maximum
  dimensions:
    -
      name: InstanceId
      value: i-abc123456

Contributing

  • Find something you would like to work on.
  • Fork the project and do your work in a topic branch.
    • Make sure your changes will work on both Ruby 2.2 and Ruby 2.3
  • Add tests to prove your code works and run all the tests using bundle exec rake.
  • Rebase your branch against zsprackett/cloudwatchtographite to make sure everything is up to date.
  • Commit your changes and send a pull request.

Author

S. Zachariah Sprackett

Copyright

(The MIT License)

Copyright (c) 2013-2016 zsprackett (S. Zachariah Sprackett)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.