Giter Club home page Giter Club logo

prometheus-ecs-sd's Introduction

A service discovery for the ECS cloud platform compatible with Prometheus.

How it works

This service gets the list of servers from the Aliyun API and generates a file which is compatible with the Prometheus file_sd mechanism.

Pre-requisites

You need your Aliyun access key/secret key (token). You can create this token in the console.

Installing it

Download the binary from the Releases page.

Running it

usage: sd adapter usage --config.file=ecs_sd_config.yml [<flags>]

Tool to generate Prometheus file_sd target files for Aliyun Ecs.

Flags:
  -h, --help                    Show context-sensitive help (also try --help-long and --help-man).
      --output.file="ecs.json"  The output filename for file_sd compatible file.
      --config.file="ecs_sd_config.yml"       The ecs sd config file.
      --web.listen-address=":9465"
                                The listen address.
      --version                 Show application version.

Integration with Prometheus

Here is a Prometheus scrape_config snippet that configures Prometheus to scrape node_exporter assuming that it is deployed on all your Ecs servers.

- job_name: node

  # Assuming that prometheus and prometheus-ecs-sd are started from the same directory.
  file_sd_configs:
  - files: [ "./ecs.json" ]

  # The relabeling does the following:
  # - overwrite the scrape address with the node_exporter's port.
  # - strip leading commas from the tags label.
  # - save the region label (par1/ams1).
  # - overwrite the instance label with the server's name.
  relabel_configs:
  - source_labels: [__meta_ecs_private_ip]
    replacement: "${1}:9100"
    target_label: __address__
  - source_labels: [__meta_ecs_tag_groupId]
    regex: ",(.+),"
    target_label: tags
  - source_labels: [__meta_ecs_region_id]
    target_label: region
  - source_labels: [__meta_ecs_instance_name]
    target_label: instance

The following meta labels are available on targets during relabeling:

  • __meta_instance_name
  • __meta_instance_id
  • __meta_instance_type
  • __meta_private_ip
  • __meta_public_ip
  • __meta_ecs_tag_xxx
  • __meta_ecs_region_id: the identifier of the zone (region).

Contributing

PRs and issues are welcome.

License

Apache License 2.0, see LICENSE.

prometheus-ecs-sd's People

Contributors

seanly avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

prometheus-ecs-sd's Issues

awesome project!

作者你好,请教下refresh_internal 是怎样使用的呢?我设置了30s,但是配置没有刷新,该怎么去分析下呢?

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.