diff --git a/include/types/peers.h b/include/types/peers.h index 01b84b16e..89962a37b 100644 --- a/include/types/peers.h +++ b/include/types/peers.h @@ -68,6 +68,9 @@ struct peer { unsigned int confirm; /* confirm message counter */ uint32_t rx_hbt; /* received heartbeats counter */ uint32_t tx_hbt; /* transmitted heartbeats counter */ + uint32_t no_hbt; /* no received heartbeat counter */ + uint32_t new_conn; /* new connection after reconnection timeout expiration counter */ + uint32_t proto_err; /* protocol errors counter */ struct appctx *appctx; /* the appctx running it */ struct shared_table *remote_table; struct shared_table *last_local_table; diff --git a/src/peers.c b/src/peers.c index cdc36d3a5..473694501 100644 --- a/src/peers.c +++ b/src/peers.c @@ -2403,6 +2403,8 @@ send_msgs: goto switchstate; } case PEER_SESS_ST_ERRPROTO: { + if (curpeer) + curpeer->proto_err++; if (prev_state == PEER_SESS_ST_WAITMSG) _HA_ATOMIC_SUB(&connected_peers, 1); prev_state = appctx->st0; @@ -2616,6 +2618,7 @@ static struct task *process_peer_sync(struct task * task, void *context, unsigne /* reschedule task for reconnect */ task->expire = tick_first(task->expire, ps->reconnect); + ps->new_conn++; } /* else do nothing */ } /* !ps->appctx */ @@ -2674,6 +2677,7 @@ static struct task *process_peer_sync(struct task * task, void *context, unsigne else { ps->reconnect = tick_add(now_ms, MS_TO_TICKS(50 + random() % 2000)); peer_session_forceshutdown(ps); + ps->no_hbt++; } } else if (tick_is_expired(ps->heartbeat, now_ms)) { @@ -3068,7 +3072,7 @@ static int peers_dump_peer(struct buffer *msg, struct stream_interface *si, stru struct shared_table *st; addr_to_str(&peer->addr, pn, sizeof pn); - chunk_appendf(msg, " %p: id=%s(%s) addr=%s:%d status=%s reconnect=%s confirm=%u tx_hbt=%u rx_hbt=%u\n", + chunk_appendf(msg, " %p: id=%s(%s) addr=%s:%d status=%s reconnect=%s confirm=%u tx_hbt=%u rx_hbt=%u no_hbt=%u new_conn=%u proto_err=%u\n", peer, peer->id, peer->local ? "local" : "remote", pn, get_host_port(&peer->addr), @@ -3077,7 +3081,8 @@ static int peers_dump_peer(struct buffer *msg, struct stream_interface *si, stru tick_is_expired(peer->reconnect, now_ms) ? "" : human_time(TICKS_TO_MS(peer->reconnect - now_ms), TICKS_TO_MS(1000)) : "", - peer->confirm, peer->tx_hbt, peer->rx_hbt); + peer->confirm, peer->tx_hbt, peer->rx_hbt, + peer->no_hbt, peer->new_conn, peer->proto_err); chunk_appendf(&trash, " flags=0x%x", peer->flags);