Project

ECSD

0.0
No release in over a year
Generate ec2 yaml config files to allow ECS cluster to be discovered by prometheus monitoring service
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 1.294
 Project Readme

ECSD

Simple service for generate ec2_sd config files (one file per cluster) to allow ECS cluster to be discovered by prometheus monitoring service.

Warning! Tested only with EC2 cluster model. Working with fargate cluster model is not guaranteed

Getting started

First create AWS IAM user with roles for describe and list.

Then add gem to your service:

gem 'ECSD', '~> 1.0.1'

Or install directly:

$ gem install ECSD

To start discover ECS cluster define config:

require 'ECSD'

ECSD.config do |c|
  c.clusters = %w[cluster_name]
  c.region = 'region'
  c.credentials = { AWS_ACCESS_KEY_ID: 'ID', AWS_SECRET_ACCESS_KEY: 'SECRET' }
  c.options = { 
    export_path: '/dir/path/to/export/folder',
    timeout: 101
  }
  c.logger = Logger.new($stdout)
end
  • clusters - array of cluster names to discover. Same name as ECS cluster
  • region - AWS region name where ECS cluster deployed
  • credentials - AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY from your IAM user
  • options
    • export_path - path to export config folder. Default is #{service root}/export
    • timeout - time in seconds between cluster discovery cycles.
  • logger - define your logger or default logger will be set

Then start discover:

ECSD.start

By default ECSD continuously discovering defined clusters and save templates into corresponded files.

Also it's possible to start only one cycle discover:

ECSD.start(cycle: false)

Contributing

Fork the project and send pull requests.