From 1f00a357950749cd63fac016e7ca8f470bf7fcd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamila=20Sou=C4=8Dkov=C3=A1?= Date: Sat, 9 Sep 2017 21:21:15 +0200 Subject: [PATCH] fixes + go version bump in __prometheus_exporter (#573) --- cdist/conf/type/__prometheus_exporter/man.rst | 7 +++++ .../conf/type/__prometheus_exporter/manifest | 29 +++++++++---------- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/cdist/conf/type/__prometheus_exporter/man.rst b/cdist/conf/type/__prometheus_exporter/man.rst index f91fe668..3b1ee4d7 100644 --- a/cdist/conf/type/__prometheus_exporter/man.rst +++ b/cdist/conf/type/__prometheus_exporter/man.rst @@ -16,6 +16,13 @@ Daemontools (or something compatible) must be installed (in particular, the comm This type installs and builds the latest version from git, using go get. A recent version of golang as well as build tools (make, g++, etc.) must be available. +Currently supported exporters: + +- node +- blackbox +- ceph + + REQUIRED PARAMETERS ------------------- None diff --git a/cdist/conf/type/__prometheus_exporter/manifest b/cdist/conf/type/__prometheus_exporter/manifest index 3d8f460c..ae4ed94a 100644 --- a/cdist/conf/type/__prometheus_exporter/manifest +++ b/cdist/conf/type/__prometheus_exporter/manifest @@ -10,41 +10,40 @@ __user prometheus --system case $exporter in node) TEXTFILES=/service/node-exporter/textfiles # path for the textfiles collector + __directory $TEXTFILES --parents --mode 777 + require="$require __golang_from_vendor" __go_get github.com/prometheus/node_exporter port=9100 run="setuidgid prometheus $GOBIN/node_exporter -web.listen-address :$port -collector.textfile.directory=$TEXTFILES" - - require="__golang_from_vendor" __go_get github.com/prometheus/node_exporter - __directory $TEXTFILES --parents --mode 777 ;; blackbox) - port=9115 - run="setuidgid prometheus $GOBIN/blackbox_exporter -config.file=/service/blackbox-exporter/blackbox.yml" - - require="__daemontools_service/blackbox-exporter __user/prometheus" __config_file "/service/blackbox-exporter/blackbox.yml" \ + require="$require __daemontools_service/${exporter}-exporter __user/prometheus" __config_file "/service/${exporter}-exporter/blackbox.yml" \ --source $__type/files/blackbox.yml \ --group prometheus --mode 640 \ - --onchange "svc -h /service/blackbox-exporter" - require="__golang_from_vendor" __go_get github.com/prometheus/blackbox_exporter + --onchange "svc -h /service/${exporter}-exporter" + require="$require __golang_from_vendor" __go_get github.com/prometheus/blackbox_exporter + + port=9115 + run="setuidgid prometheus $GOBIN/blackbox_exporter -config.file=/service/${exporter}-exporter/blackbox.yml" ;; ceph) + __package librados-dev # dependency of ceph_exporter + require="$require __golang_from_vendor __package/librados-dev" __go_get github.com/digitalocean/ceph_exporter + port=9128 run="setuidgid ceph $GOBIN/ceph_exporter -ceph.config /etc/ceph/ceph.conf -telemetry.addr :$port" - - __package librados-dev # dependency of ceph_exporter - require="__golang_from_vendor __package/librados-dev" __go_get github.com/digitalocean/ceph_exporter ;; *) - echo "Unknown exporter: $exporter." >&2 + echo "Unsupported exporter: $exporter." >&2 exit 1 ;; esac -require="__daemontools" __daemontools_service ${exporter}-exporter --run "$run" +require="$require __daemontools" __daemontools_service ${exporter}-exporter --run "$run" if [ -f "$__object/parameter/add-consul-service" ]; then __consul_service ${exporter}-exporter --port $port --check-http "http://localhost:$port/metrics" --check-interval 10s fi #__daemontools --install-init-script __daemontools -__golang_from_vendor --version 1.8.1 # required for many exporters +__golang_from_vendor --version 1.9 # required for many exporters