Hi all,

I'd like to propose for discussion an improvement to the feedback
delivered by HAProxy over the stats socket.

Currently the feedback of stats socket commands is inconsistent and it
can be difficult for external tools issuing socket commands to discern
whether the command was successful or not.
In case of commands that are intended to provide information, a wide
variety of text can be returned with no easy way to distinguish error
messages from expected feedback. Commands that aren't intended to
provide information (i.e. set server) can return a newline or a variety
of feedback text when successful, and when unsuccessful they return a
different variety of feedback text.

I propose to:
- keep unmodified the feedback messages of successful commands intended
to provide information (i.e. show stat) so that no change is needed to
external tools parsing successful output
- keep unmodified the feedback of successful commands that return just a
newline
- modify feedback in all other cases to include a prefix of message
severity corresponding to syslog severity level

The addition of a severity at the start of a feedback message would make
it easy for external tools to disregard debug, info and notice messages
and assume socket command was successful (messages with no prefix can be
considered info by default), and identify warning, err, crit, alert and
emerg messages as indicating a socket command was unsuccessful.

Examples

Current behavior:

=> set server bck1/srv1 state maint
<= "\n"

=> set server bck1/srv1 addr 127.0.0.1 port 8080
<= "no need to change the addr, port changed from '80' to '8080' by
'stats socket command'\n\n"

=> set server bck1/srv2 state maint
<= "No such backend.\n\n"

Patched behavior:

=> set server bck1/srv1 state maint
<= "\n"

=> set server bck1/srv1 addr 127.0.0.1 port 8080
<= "NOTICE: no need to change the addr, port changed from '80' to '8080'
by 'stats socket command'\n\n"

=> set server bck1/srv2 state maint
<= "ERR: No such backend.\n\n"


Should there be no objections to the proposal I will submit a patch for
review.

Best regards,
Andjelko

-- 
Andjelko Iharos
Senior Architect, HAProxy Technologies, Inc.
haproxy.com The World's #1 Deployed Load Balancer

Reply via email to