Skip failing runit services + fix metric names

This commit is contained in:
Johannes 'fish' Ziemke 2013-07-30 16:08:54 +02:00
parent 4c2a270174
commit 9ea37d8b44
1 changed files with 4 additions and 3 deletions

View File

@ -31,14 +31,14 @@ func NewRunitCollector(config config, registry prometheus.Registry) (runitCollec
registry.Register( registry.Register(
"node_service_desired_state", "node_service_desired_state",
"node_exporter: desired status of runit service.", "node_exporter: desired state of runit service.",
prometheus.NilLabels, prometheus.NilLabels,
c.stateDesired, c.stateDesired,
) )
registry.Register( registry.Register(
"node_service_normal_state", "node_service_normal_state",
"node_exporter: status of runit service.", "node_exporter: normal state of runit service.",
prometheus.NilLabels, prometheus.NilLabels,
c.stateNormal, c.stateNormal,
) )
@ -57,7 +57,8 @@ func (c *runitCollector) Update() (updates int, err error) {
for _, service := range services { for _, service := range services {
status, err := service.Status() status, err := service.Status()
if err != nil { if err != nil {
return 0, err debug(c.Name(), "Couldn't get status for %s: %s, skipping...", service.Name, err)
continue
} }
debug(c.Name(), "%s is %d on pid %d for %d seconds", service.Name, status.State, status.Pid, status.Duration) debug(c.Name(), "%s is %d on pid %d for %d seconds", service.Name, status.State, status.Pid, status.Duration)