GithubHelp home page GithubHelp logo

yunlzheng / prometheus-rancher-exporter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from infinityworks/prometheus-rancher-exporter

0.0 1.0 0.0 2.49 MB

Exposes Rancher metrics to Prometheus

License: MIT License

Go 100.00%

prometheus-rancher-exporter's Introduction

prometheus-rancher-exporter

Exposes the health of Stacks / Services and Hosts from the Rancher API, to a Prometheus compatible endpoint.

Description

The application can be run in a number of ways, the main consumption is the Docker hub image infinityworksltd/prometheus-rancher-exporter.

The application requires at a minimum, the URL of the Rancher API. If you have authentication enabled on your Rancher server, the application will require a RANCHER_ACCESS_KEY and a RANCHER_SECRET_KEY providing.

If you are running the application in a Rancher managed container, you can make use of Rancher labels to obtain an API key and auto-provision all of this information, details of this can be seen in the Docker Compose section.

If you are using this externally to Rancher, or without the use of the labels to obtain an API key, you can update these values yourself, using environment variables.

Required

  • CATTLE_URL // Either provisioned through labels, or set by the user. Should be in a format similar to http://<YOUR_IP>:8080/v2-beta.

Optional

  • CATTLE_ACCESS_KEY // Rancher API access Key, if supplied this will be used when authentication is enabled.
  • CATTLE_SECRET_KEY // Rancher API secret Key, if supplied this will be used when authentication is enabled.
  • METRICS_PATH // Path under which to expose metrics.
  • LISTEN_ADDRESS // Port on which to expose metrics.
  • HIDE_SYS // If set to true then this hides any of Ranchers internal system services from being shown. *If used, ensure false is encapsulated with quotes e.g. HIDE_SYS="false".
  • LOG_LEVEL // Optional - Set the logging level, defaults to Info

Compatibility

Along with the release of Rancher 1.2, a new API was introduced, the oppertunity was taken to re-write the exporter into Golang, so it's more comparible to the platforms it's interacting with. Testing has focused on the v1 and v2-beta available with Rancher 1.2. The v1 support should in theory work on older versions of Rancher Server but testing has been limited.

If you find any issues, bug reports or PR's are more than welcome.

Install and deploy

Run manually from Docker Hub:

docker run -d -e CATTLE_ACCESS_KEY="XXXXXXXX" -e CATTLE_SECRET_KEY="XXXXXXX" -e CATTLE_URL="http://<YOUR_IP>:8080/v2-beta" -p 9173:9173 infinityworks/prometheus-rancher-exporter

Build a docker image:

docker build -t <image-name> .
docker run -d -e CATTLE_ACCESS_KEY="XXXXXXXX" -e CATTLE_SECRET_KEY="XXXXXXX" -e CATTLE_URL="http://<YOUR_IP>:8080/v2-beta" -p 9173:9173 <image-name>

Docker compose

For users running the container within a Rancher managed environment:

prometheus-rancher-exporter:
    tty: true
    stdin_open: true
    labels:
      io.rancher.container.create_agent: true
      io.rancher.container.agent.role: environment
    expose:
      - 9173:9173
    image: infinityworks/prometheus-rancher-exporter:latest

For users running the container outside a Rancher managed environment:

prometheus-rancher-exporter:
    tty: true
    stdin_open: true
    environment:
      - CATTLE_ACCESS_KEY="xxxx"
      - CATTLE_SECRET_KEY="xxxxxx"
      - CATTLE_URL="http://<YOUR_IP>:8080/v2-beta"
      - HIDE_SYS=true
    expose:
      - 9173:9173
    image: infinityworks/prometheus-rancher-exporter:latest

Metrics

Metrics will be made available on port 9173 by default, or you can pass environment variable LISTEN_ADDRESS to override this. An example printout of the metrics you should expect to see can be found in METRICS.md.

Metadata

Go Report Card GoDoc

prometheus-rancher-exporter's People

Contributors

jamesbarwell avatar johnrengelman avatar jolyonbrown avatar joshbenner avatar olivierba avatar rucknar avatar yunlzheng avatar

Watchers

 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.