Closed johnrengelman closed 7 years ago
Interesting, thanks for the PR. Could you explain a little more?
Is the host 'State' field not covering a host in a reconnecting state? I ask because it's one of the possible states exposed by the API. Not sure how the Rancher API knows what state the agent is in, if it's not connected, apologies if i'm being slow here.
Also, is this for V1 or V2 of the API? I'm 70% sure i tested this with v2-beta, could be wrong though.
This is v1. When a Host is "reconnecting" if you look at the API, the host.state
field is active
but host.agentState
is reconnecting
.
You can test this by stopping the rancher-agent
container on the host machine.
Also, I don't believe reconnecting
is a valid state for host.state
here are the common state - https://github.com/rancher/cattle/blob/master/code/iaas/model/src/main/java/io/cattle/platform/core/constants/CommonStatesConstants.java
and host specific - https://github.com/rancher/cattle/blob/master/code/iaas/model/src/main/java/io/cattle/platform/core/constants/HostConstants.java#L31
You also don't have reconnecting
as a state for hostState
- https://github.com/infinityworksltd/prometheus-rancher-exporter/blob/master/rancher_exporter.go#L33
Can't argue with the code! Okay, let me test this, should get time tomorrow and merge if all looks good.
LGTM, merging.
v0.22.52 just built fine on the Hub and is available for use, updated release notes. Thanks @johnrengelman
The agent state is what is set when a host connects/disconnects from the Rancher server.
Currently if a host is in the "reconnecting" state per the Rancher UI, this is not exposed via the metrics.