Solved

Problems with running bash script as notification command

  • 14 March 2023
  • 1 reply
  • 242 views

Badge +2

Hello guys,

 

Im using Centreon version 22.10.7. I want to use bash script as a command for sending notifications. The script basically takes notification info as argument, creates HTML and then sends this document using muttt via postfix.

 

As per my understanding notification commands are issued by the centreon-engine user. So I made sure the script is located in directory which is accesible by this user (/usr/lib/centreon/plugins/) and gave  chmod +x and 777 permission to the script itself.

 

When I log in to ssh using centreon-engine user and use the command it works perfectly fine.

 

The setup in the web GUI look like this:

 

Is there something Im missing? Been trying to solve it the whole day.. please help

 

Thanks in advance for any kind of lead :-)

 

icon

Best answer by z123 16 March 2023, 15:11

View original

1 reply

Badge +2

I solved my issue. In the script I was giving positional arguments which Centreon did not accept for some reason. After rewriting the script using flags (for example “-h 192.168.1.1”) it started to work. This article helped a lot https://www.baeldung.com/linux/use-command-line-arguments-in-bash-script. Cheers!

Reply