Stats after reload

Hi everyone,
I’m aware this argument has already been discussed many times in this community, however I’ll try to bring it back hoping for your help.
I know the expected behaviour of HA-Proxy is to drop the stats after reloading but I was wondering if there is any way to implement a workaround for this issue.
Nowadays monitoring is everything! Or at least very very important :slight_smile:

Provided that the server-state-file does not save the stats and thus they can’t be loaded from file during a reload, is there anyway to query with socat ‘show stat’ the older workers or is there any other way to monitor them after a reload?

The Telegraf plugin supports multiple local sockets but don’t know how to monitor the older workers sockets, if there is a way to do this.

One shot saving the stats before the reload doesn’t solve the problem since it not provide the awareness of the state of that sessions in time.

Seamless reloads work perfectly but the fact of lossing stats is an issue I would really want to solve.

Version & Configs:

  • HA-Proxy version 2.0.15
  • master-worker
  • nbproc 1
  • stats socket /run/haproxy/stat.sock user haproxy group haproxy mode 660 level admin expose-fd listeners

I will appreciate any advice,

“For Great Justice”

This is a problem that needs solving in your monitoring solution, there is no way around that. You keep focusing on the wrong side of the problem and you will never find a solution.

Haproxy will not ever keep it’s stats.

The problem is indeed this. How to face it with any monitoring solution.

A counter can only increase. If the counter suddenly has a number smaller than before, it means the counter restarted from zero, so the so in your monitoring has to account for that.

This is a math problem, solved in every single monitoring solution out there. If it isn’t in yours, either it doesn’t know what value it is looking at (counter or gauge), or it’s not a monitoring solution.

The different between counters and gauges is crucial of course.

Of course is a gauge not a counter. Leverage the sudden decrease of the value is not the issue.
I’m not interested in keeping trace of total connections over time but in being aware of the current connections handled by the balancer.

How can I be aware of the current connections if I can not query the old workers for the period they are finishing their jobs before leaving.

I’m afraid it will never be possible, but the runtime server options of the data plane api 2.0 solve the problem :slight_smile:

Thank you anyway,

You can query the old workers for stats and debug information in master-worker mode through the master cli:

https://cbonte.github.io/haproxy-dconv/1.9/management.html#9.4