Coder Social home page Coder Social logo

earthdaily-analytics / prometheus-ecs-discovery Goto Github PK

View Code? Open in Web Editor NEW

This project forked from teralytics/prometheus-ecs-discovery

0.0 8.0 0.0 46 KB

A Prometheus discoverer that scrapes Amazon ECS and a generates file SD configuration file.

License: Apache License 2.0

Dockerfile 2.31% Go 97.69%

prometheus-ecs-discovery's Introduction

Prometheus Amazon ECS discovery

Prometheus has native Amazon EC2 discovery capabilities, but it does not have the capacity to discover ECS instances that can be scraped by Prometheus. This program is a Prometheus File Service Discovery (file_sd_config) integration that bridges said gap.

Help

Run prometheus-ecs-discovery -? to get information.

The command line parameters that can be used are:

  • -config.scrape-interval (duration): interval at which to scrape the AWS API for ECS service discovery information (default 1m0s)
  • -config.scrape-times (int): how many times to scrape before exiting (0 = infinite)
  • -config.write-to (string): path of file to write ECS service discovery information to (default "ecs_file_sd.yml")

Usage

First, build this program using the usual go get mechanism.

Then, run it as follows:

  • Ensure the program can write to a directory readable by your Prometheus master instance(s).
  • Export the usual AWS_REGION, AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY into the environment of the program, making sure that the keys have access to the EC2 / ECS APIs (IAM policies should include ECS:ListClusters, ECS:ListTasks, ECS:DescribeTask, EC2:DescribeInstances, ECS:DescribeContainerInstances, ECS:DescribeTasks, ECS:DescribeTaskDefinition).
  • Start the program, using the command line option -config.write-to to point the program to the specific folder that your Prometheus master can read from.
  • Add a file_sd_config to your Prometheus master:
scrape_configs:
- job_name: ecs
  file_sd_configs:
    - files:
      - /path/to/ecs_file_sd.yml
      refresh_interval: 10m

To scrape the containers add following docker labels to them:

  • PROMETHEUS_EXPORTER_PORT specify the container port where prometheus scrapes (mandatory)
  • PROMETHEUS_EXPORTER_SERVER_NAME specify the hostname here, per default ip is used (optional)
  • PROMETHEUS_EXPORTER_PATH specify alternative scrape path here (optional)

That's it. You should begin seeing the program scraping the AWS APIs and writing the discovery file (by default it does that every minute, and by default Prometheus will reload the file the minute it is written). After reloading your Prometheus master configuration, this program will begin informing via the discovery file of new targets that Prometheus must scrape.

prometheus-ecs-discovery's People

Contributors

rudd-o avatar chicofranchico avatar angulito avatar vincepii avatar lfranchi avatar maxaf avatar brennoo avatar wachino avatar bsingr avatar houqp avatar

Watchers

James Cloos avatar Wade Robson avatar Ross Lawrie avatar Jordan Heemskerk avatar  avatar Chris Rampersad avatar Julius Cheung avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.