infinityworks / prometheus-rancher-exporter

Exposes Rancher metrics to Prometheus
MIT License
99 stars 47 forks source link

Handle all stack health states #32

Closed vberetti closed 6 years ago

vberetti commented 7 years ago

Rancher healthState values can have be healthy, unhealthy, initializing or degraded. https://github.com/rancher/cattle/blob/master/modules/model/src/main/java/io/cattle/platform/core/constants/HealthcheckConstants.java Currently, the _rancher_stack_healthstatus display only healthy, unhealthy values.

Rucknar commented 6 years ago

Apologies @vberetti i missed this one, just having a look now. I got the health-states directly from the Rancher codebase. The states you've mentioned i believe only exist for the 'state' of a service. As in, upgrading isn't a health state, it's a state... Make sense? I'll have a poke around the rancher codebase but that's how it was when i last inspected it.

vberetti commented 6 years ago

Hi, to reproduce it, you can stop one service inside a stack, then no health metric for this stack is exposed. The health stack appears as "degraded" in Rancher. "degraded" is its health state just as healthy or unhealthy is. Below the extract of the Rancher source code for health state :

public static final String HEALTH_STATE_HEALTHY = "healthy";
public static final String HEALTH_STATE_UNHEALTHY = "unhealthy";
public static final String HEALTH_STATE_INITIALIZING = "initializing";
public static final String HEALTH_STATE_DEGRADED = "degraded";
Rucknar commented 6 years ago

@vberetti Looks like those are new states. Bit confusing as to what the difference between 'degraded' and 'unhealthy' is. Also, 'initialising' is a state recorded in the service state its-self.

I'll see if Rancher have any thoughts...

Rucknar commented 6 years ago

@vberetti merged and available on the hub as latest and infinityworks/prometheus-rancher-exporter:v0.22.93

Thanks for the heads up