{"id":13528198,"url":"https://github.com/bbc/news-gem-cloudwatch-sender","last_synced_at":"2025-07-12T12:04:22.967Z","repository":{"id":31942104,"uuid":"35511770","full_name":"bbc/news-gem-cloudwatch-sender","owner":"bbc","description":"Send metrics to InfluxDB from Cloudwatch","archived":false,"fork":false,"pushed_at":"2016-06-14T22:31:41.000Z","size":375,"stargazers_count":53,"open_issues_count":9,"forks_count":9,"subscribers_count":26,"default_branch":"master","last_synced_at":"2024-10-20T09:48:38.417Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bbc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-05-12T20:45:42.000Z","updated_at":"2020-10-19T19:50:04.000Z","dependencies_parsed_at":"2022-09-04T03:00:39.212Z","dependency_job_id":null,"html_url":"https://github.com/bbc/news-gem-cloudwatch-sender","commit_stats":null,"previous_names":["bbc-news/cloudwatch-sender"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbc%2Fnews-gem-cloudwatch-sender","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbc%2Fnews-gem-cloudwatch-sender/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbc%2Fnews-gem-cloudwatch-sender/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbc%2Fnews-gem-cloudwatch-sender/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bbc","download_url":"https://codeload.github.com/bbc/news-gem-cloudwatch-sender/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247547593,"owners_count":20956582,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T06:02:17.703Z","updated_at":"2025-04-06T20:31:41.137Z","avatar_url":"https://github.com/bbc.png","language":"Ruby","funding_links":[],"categories":["Ruby"],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003ecloudwatch-sender\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://rubygems.org/gems/cloudwatch-sender\"\u003e\u003cimg src=\"https://img.shields.io/gem/v/cloudwatch-sender.svg?style=flat-square\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  Retrieves metrics from \u003cb\u003eCloudwatch\u003c/b\u003e and sends them to \u003cb\u003eInfluxDB\u003c/b\u003e/\u003cb\u003eGraphite\u003c/b\u003e.\n\u003c/p\u003e\n\n## What is this?\n\nAllows you to send **EC2**, **SQS** and **custom** metrics from Cloudwatch to InfluxDB or Graphite. EC2 metrics are gathered via EC2 tags instead of EC2 Instance IDs, making the tool far more dynamic.\n\n## Installation\n\nAdd this line to your Gemfile:\n\n```ruby\ngem \"cloudwatch-sender\"\n```\n\nThen execute:\n\n```\nbundle\n```\n\nOr install it yourself:\n\n```\ngem install cloudwatch-sender\n```\n\n## Usage\n\n### Command Line\n\n```sh\ncloudwatch-sender send_metrics /path/to/config.yaml --region=eu-west-1 --access-key-id=$AWS_ACCESS_KEY --secret-access-key= $AWS_SECRET_KEY\n```\n\nIf you would like to stream metrics to your endpoint at a set interval, use `continuous`:\n\n```sh\ncloudwatch-sender continuous /path/to/config.yaml --region=eu-west-1 $INTERVAL --access-key-id=$AWS_ACCESS_KEY --secret-access-key= $AWS_SECRET_KEY\n```\n\n**Note** - the default `$INTERVAL` is 60 seconds.\n\n```sh\ncloudwatch-sender continuous /path/to/config.yaml --region=eu-west-1 $INTERVAL --provider=iam\n```\n\n### Programmatically\n\n```ruby\nrequire \"cloudwatch/sender/cli\"\n\nloop do\n  Cloudwatch::Sender::CLI.new.send_metrics(config_path = './configs/default.yml', { 'region' =\u003e 'eu-west-1', 'provider' =\u003e 'iam'})\n  sleep 120\nend\n```\n\n```ruby\nrequire \"cloudwatch/sender/cli\"\n\nCloudwatch::Sender::CLI.new.continuous(config_path = './configs/default.yml', 60, { 'region' =\u003e 'eu-west-1', 'provider' =\u003e 'iam'})\n```\n\n## Configs\n\nThe gem is powered via a YAML config file, see [example.yaml](https://github.com/BBC-News/cloudwatch-sender/blob/master/configs/example.yaml) for an example.\n\n**Note**: take into account how often metrics update for each AWS product:\n\n- **EC2** - every 60 seconds.\n- **SQS** - every 5 minutes.\n- **Custom** - every 60 seconds.\n\n## How it works\n\nThe gem extracts metrics for a given set of EC2 instances based on an EC2 tag key/value. For example:\n\n```yaml\nec2_tag_key:   ProjectName\nec2_tag_value: bbc_news\n```\n\nAs seen in the example above a tag relates to a single project. Thus if that key/value is called, it returns all the instances attached to that project - which is what the gem then uses to gather metrics on each instance.\n\nThe gem collects EC2 metrics for the previous 3 minutes and SQS metrics for the previous 20 minutes. Thus running the gem every 60 seconds for EC2 and every 5 minutes for SQS will provide sufficient data. This allows for the gem to remain unaffected by network/database issues.\n\n## Why make this?\n\nWe found the existing tools heavily rely upon AWS variables which often become out-of-date, e.g. EC2 Instance ID. This becomes a problem when a component is being regularly re-built and deployed. Thus we made the decision to base cloudwatch-sender on a broder set of criteria, such as EC2 tags.\n\n## TODO\n\nSee [open issues](https://github.com/BBC-News/cloudwatch-sender/issues?utf8=%E2%9C%93\u0026q=is%3Aopen+is%3Aissue+label%3Ato-do).\n\n## License\n\nStandard MIT License, see included [license file](https://github.com/BBC-News/cloudwatch-sender/blob/master/LICENSE.txt).\n\n## Authors\n\n- [David Blooman](http://twitter.com/dblooman)\n- [Charlie Revett](http://twitter.com/charlierevett)\n\n## Contributing\n\n1. [Fork it!](https://github.com/bbc-news/cloudwatch-sender/fork)\n2. Create your feature branch: `git checkout -b my-new-feature`\n3. Commit your changes: `git commit -am \"Add some feature\"`\n4. Push to the branch: `git push origin my-new-feature`\n5. Create a new [Pull Request](https://github.com/BBC-News/cloudwatch-sender/compare).\n\nPlease feel free to raise an [issue](https://github.com/BBC-News/cloudwatch-sender/issues/new) if you find a bug or have a feature request.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbbc%2Fnews-gem-cloudwatch-sender","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbbc%2Fnews-gem-cloudwatch-sender","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbbc%2Fnews-gem-cloudwatch-sender/lists"}