Skip to main content

Hello everyone,

I’m encountering an issue with a custom notification script in Centreon, and I’m hoping someone here has seen this before or might have some ideas on how to resolve it.

The Setup:

  • I’m running a custom notification script that integrates Centreon with an OTRS system. The script sends a cURL request to the OTRS API to check if there is an existing open ticket before creating a new one.
  • The script works perfectly when executed manually from the command line. It sends the request, gets a response from the API, and creates or acknowledges the ticket correctly.
  • The script also logs debug information to /tmp/debug-notif-otrs.log.

 

>2024-10-09 11:22:09] DEBUG: Début script de notif
i2024-10-09 11:22:09] DEBUG: Construction du payload à envoyer à l'API
'2024-10-09 11:22:09] DEBUG: Sending request to OTRS API with payload: {"UserLogin":"WS_OTRS","Password":"XXXXXXX","QueueIDs":194,"StateType":"open","Title":"SLD-NAF\/Memory*"}
y2024-10-09 11:22:10] DEBUG: Received response from OTRS API: {}
:2024-10-09 11:22:10] DEBUG: No OTRS ticket found.
u2024-10-09 11:22:10] DEBUG: No ticket found, proceeding with notification email.

The Problem:

  • When the script is triggered automatically by Centreon as part of the normal service alerting process (i.e., when a service goes into a critical state), it times out during the API call to OTRS.

  • In the debug logs, the script starts, builds the payload for the API request, but then stops after sending the request—it never logs any response from the OTRS API. Here’s an example from the log:

u2024-10-09 13:38:59] DEBUG: Début script de notif
2024-10-09 13:38:59] DEBUG: Construction du payload à envoyer à l'API
e2024-10-09 13:38:59] DEBUG: Sending request to OTRS API with payload: {"UserLogin":"WS_OTRS","Password":"XXXXXXX","QueueIDs":194,"StateType":"open","Title":"SLD-NAF\/Cpu*"}
  • No further logs appear after this point when the script is triggered by Centreon.

  • I’ve tried adding CURLOPT_VERBOSE to capture detailed cURL logs, but they don’t seem to provide further insights. No errors are logged, and I’ve also added error checking for cURL (curl_errno() and curl_error()), but no errors are reported.

 

Any suggestions on what might be causing this behavior or how to troubleshoot further would be greatly appreciated!

Thanks in advance for any help!

Hi,
I found the solution. It was a proxy problem. 
Run by CLI, the script used the normal environnement variables but launched by Centreon, it didn’t. I had to put the proxy definition in the script and it worked.

Cheers,
Thierry.


Reply