centreon / centreon-stream-connector-scripts

Scripts for Centreon Stream Connector
15 stars 22 forks source link

add pcall in the flush_payload method #229

Closed tanguyvda closed 1 month ago

tanguyvda commented 1 month ago

properly log curl errors (or any weird errors coming from the send_data method that is called by the flush_method in the sc_flush.lua module)

whithout this patch, broker would display a meaningless error in its own log file. The stream connector log file wasn't letting you know that something was wrong.

Now broker won't log any error message and a beautiful error will displayed in your stream connector log file such as

Fri Aug 23 10:59:25 2024: ERROR: [EventQueue:send_data]: HTTP POST request FAILED, return code is 403. Message is: Code: 516. DB::Exception: centreon: Authentication failed: password is incorrect, or there is no user with such name. (AUTHENTICATION_FAILED) (version 24.8.1.2203 (official build))