collectd-haproxy
collectd-haproxy copied to clipboard
Add Python 3 support
This MR:
- encodes/decodes strings to/from bytes when talking to the HAProxy socket
- tweaks the
try
…except
syntax
both of which make the plugin work under Python 3.
This addresses the following logged exceptions:
Unhandled python exception in importing module: SyntaxError: invalid syntax
Unhandled python exception in read callback: TypeError: a bytes-like object is required, not 'str'
Unhandled python exception in read callback: TypeError: must be str, not bytes
Disclaimer: my Python skills are very limited, but this fixed it for me.