This adds a new 'noroom' status to the Prometheus metric 'srv_state'. It helps identify servers that have exceeded their maxconn limit and cannot accept new connections. --- addons/promex/service-prometheus.c | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/addons/promex/service-prometheus.c b/addons/promex/service-prometheus.c index 7b61683dd..4551009d5 100644 --- a/addons/promex/service-prometheus.c +++ b/addons/promex/service-prometheus.c @@ -380,6 +380,7 @@ enum promex_srv_state { PROMEX_SRV_STATE_UP, PROMEX_SRV_STATE_MAINT, PROMEX_SRV_STATE_DRAIN, + PROMEX_SRV_STATE_NOROOM, PROMEX_SRV_STATE_NOLB, PROMEX_SRV_STATE_COUNT /* must be last */ @@ -390,10 +391,13 @@ const struct ist promex_srv_st[PROMEX_SRV_STATE_COUNT] = { [PROMEX_SRV_STATE_UP] = IST("UP"), [PROMEX_SRV_STATE_MAINT] = IST("MAINT"), [PROMEX_SRV_STATE_DRAIN] = IST("DRAIN"), + [PROMEX_SRV_STATE_NOROOM] = IST("NOROOM"), [PROMEX_SRV_STATE_NOLB] = IST("NOLB"), }; /* Return the server status. */ + + enum promex_srv_state promex_srv_status(struct server *sv) { int state = PROMEX_SRV_STATE_DOWN; @@ -402,6 +406,9 @@ enum promex_srv_state promex_srv_status(struct server *sv) state = PROMEX_SRV_STATE_UP; if (sv->cur_admin & SRV_ADMF_DRAIN) state = PROMEX_SRV_STATE_DRAIN; + if (!server_has_room(sv)) + state = PROMEX_SRV_STATE_NOROOM; + } else if (sv->cur_state == SRV_ST_STOPPING) state = PROMEX_SRV_STATE_NOLB; -- 2.25.1