/prometheus-cloudstack-discovery

CloudStack service discovery for Prometheus

Primary LanguageGoMIT LicenseMIT

Prometheus CloudStack Service Discovery

Build Status

prometheus-cloudstack-discovery generates target groups by querying the CloudSTack API. This is to be used in conjunction with Prometheus's custom service discovery feature.

Example

$ prometheus-cloudstack-discovery
[
  {
    "targets": ["172.22.2.57:9100"],
    "labels": {"job": "cadvisor"}
  }
]

Install

First install the binary

$ go get github.com/tsuru/prometheus-cloudstack-discovery

Then configure a [file based service discovery] 1 target group in your prometheus.yml config:

scrape_configs:
  - job_name: my_cloudstack_service

    file_sd_configs:
    - names: ['tgroups/*.json']

You can then setup a crontab job to update the target groups every minute:

* * * * * cd /path/to/prometheus/dir && prometheus-cloudstack-discovery --dest=tgroups/cloudstack.json