From d18f1f7a77ec4326a65d359c9b16218118779ec7 Mon Sep 17 00:00:00 2001 From: Thomas Boerger Date: Mon, 24 Sep 2018 16:41:53 +0200 Subject: [PATCH] Add list of labels and example to readme --- README.md | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/README.md b/README.md index e977dd8..a70d2cb 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,50 @@ This project provides a server to automatically discover nodes within your Hetzn You can download prebuilt binaries from our [GitHub releases](https://github.com/promhippie/prometheus-hcloud-sd/releases), or you can use our Docker images published on [Docker Hub](https://hub.docker.com/r/promhippie/prometheus-hcloud-sd/tags/). +## Integration + +### Available labels + +The following list of meta labels can be used to relabel your scrape results entirely. Hopefully the names are self-explaining, that's why I have skipped a description for each label. + +* `__meta_hcloud_name` +* `__meta_hcloud_status` +* `__meta_hcloud_public_ipv4` +* `__meta_hcloud_public_ipv6` +* `__meta_hcloud_type` +* `__meta_hcloud_cores` +* `__meta_hcloud_memory` +* `__meta_hcloud_disk` +* `__meta_hcloud_storage` +* `__meta_hcloud_cpu` +* `__meta_hcloud_datacenter` +* `__meta_hcloud_location` +* `__meta_hcloud_city` +* `__meta_hcloud_country` +* `__meta_hcloud_image_name` +* `__meta_hcloud_image_type` +* `__meta_hcloud_os_flavor` +* `__meta_hcloud_os_version` + +### Prometheus config + +Here you get a snippet for the Prometheus `scrape_config` that configures Prometheus to scrape `node_exporter` assuming that it is deployed on all your servers. + +``` +- job_name: node + file_sd_configs: + - files: [ "/etc/prometheus/hcloud.json" ] + relabel_configs: + - source_labels: [__meta_hcloud_public_ipv4] + replacement: "${1}:9100" + target_label: __address__ + - source_labels: [__meta_hcloud_datacenter] + target_label: datacenter + - source_labels: [__meta_hcloud_name] + target_label: instance +``` + + ## Development Make sure you have a working Go environment, for further reference or a guide take a look at the [install instructions](http://golang.org/doc/install.html). This project requires Go >= v1.8.