From 9039a425d0972307673e1364d3877085af7b7fce Mon Sep 17 00:00:00 2001 From: Johannes 'fish' Ziemke Date: Mon, 19 Dec 2016 13:10:38 +0100 Subject: [PATCH] Add runit service dir flag --- collector/runit.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/collector/runit.go b/collector/runit.go index 02d10abb..2dc6e126 100644 --- a/collector/runit.go +++ b/collector/runit.go @@ -16,11 +16,18 @@ package collector import ( + "flag" + "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/common/log" "github.com/soundcloud/go-runit/runit" ) +var runitServiceDir = flag.String( + "collector.runit.servicecdir", + "/etc/service", + "Path to runit service directory.") + type runitCollector struct { state, stateDesired, stateNormal, stateTimestamp *prometheus.GaugeVec } @@ -81,7 +88,7 @@ func NewRunitCollector() (Collector, error) { } func (c *runitCollector) Update(ch chan<- prometheus.Metric) error { - services, err := runit.GetServices("/etc/service") + services, err := runit.GetServices(*runitServiceDir) if err != nil { return err }