Solved

[Broker] Lua script could not be compiled

  • 14 February 2023
  • 8 replies
  • 317 views

Badge +1

Hi

I use Centreon IT-100 Edition, 22.10.5, on a standalone Linux Debian 11.

I would like to be able to use the stream connector to send my alerts in Opsgenie.

So I followed the documentation here: https://docs.centreon.com/docs/21.10/integrations/event-management/sc-opsgenie/ but nothing is sent to Opsgenie.

I double checked my configuration: parameter of the connector, api key value, permission in Opsgenie, access to api url, etc. but all is good.

I tried to execute the lua script and no output appeared (normal) so I think all is good for Lua in my system.

Here are the lua packages installed:

~$ apt list lua* --installed
Listing... Done
lua-curl/stable,now 0.3.0-9.2 amd64 [installed]
lua-socket/stable,now 3.0~rc1+git+ac3201d-4 amd64 [installed]
lua5.1/stable,now 5.1.5-8.1+b3 amd64 [installed]

Then I tried to elevate the logging level to debug for [core] and [lua] in central-broker-master configuration and I saw these messages (filtered) :

~$ sudo systemctl restart cbd
~$ tail -f /var/log/centreon-broker/central-broker-master.log | grep lua
...
[2023-02-14T00:23:44.101+01:00] [core] [info] modules: attempt to load module '/usr/share/centreon/lib/centreon-broker/70-lua.so'
[2023-02-14T00:23:44.102+01:00] [core] [debug] modules: checking initialization routine (symbol 'broker_module_init') in '/usr/share/centreon/lib/centreon-broker/70-lua.so'
[2023-02-14T00:23:44.104+01:00] [core] [debug] modules: checking deinitialization routine (symbol 'broker_module_deinit') in '/usr/share/centreon/lib/centreon-broker/70-lua.so'
[2023-02-14T00:23:44.104+01:00] [core] [debug] modules: checking module version (symbol 'broker_module_version') in '/usr/share/centreon/lib/centreon-broker/70-lua.so'
[2023-02-14T00:23:44.104+01:00] [core] [debug] modules: running initialization routine of '/usr/share/centreon/lib/centreon-broker/70-lua.so'
[2023-02-14T00:23:44.104+01:00] [lua] [info] lua: module for Centreon Broker 22.10.0
[2023-02-14T00:23:44.104+01:00] [core] [info] protocols: registering protocol ('lua' (layers 1-7)
[2023-02-14T00:23:47.073+01:00] [lua] [debug] lua: initializing the Lua virtual machine
[2023-02-14T00:23:47.074+01:00] [core] [error] failover: global error: lua: '/usr/share/centreon-broker/lua/opsgenie.lua' could not be compiled
[2023-02-14T00:24:02.077+01:00] [lua] [debug] lua: initializing the Lua virtual machine
[2023-02-14T00:24:02.078+01:00] [core] [error] failover: global error: lua: '/usr/share/centreon-broker/lua/opsgenie.lua' could not be compiled
...

I searched for a long time and found nothing about this.

Does anyone have any idea what the problem is?

icon

Best answer by gespada 7 March 2023, 08:49

View original

8 replies

Badge +1

Hello.

Does anyone really have any idea how to help me solve this problem?

It surprises me, given the quality of the answers we can find here!

Please, help!

Userlevel 4
Badge +14

Hello,

You followed this How To :

It's most complete then the official documentation.

Stream Connectors is not really flexible/easy to implement. A Time i implemented a Stream Connectors for an Hypervison application Microfocus Operations Bridge Manager (The SC HP OMi or OpsCx) with the two editors and it was not really easy.

Also you have 2 versions now. Maybe with your Centreon release you do use the version 2 with your Centreon Collect.

You could download the version 2 here : https://github.com/psamecentreon/centreon-stream-connector-scripts/tree/feat-sc-add-refacto-opsgenie-event-v2

(Be carefull it's not merged)

The version 2 come with lua module written by Centreon and enhance the possibility of the SC.

I don't understand in your case, the failover step on the log file.

But according your error of compilation could you just do this command to check if the script is OK and post it :

lua /usr/share/centreon-broker/lua/opsgenie.lua

and indicate your version of lua also ?

Userlevel 4
Badge +14

Here are the lua packages installed:

~$ apt list lua* --installed
Listing... Done
lua-curl/stable,now 0.3.0-9.2 amd64 [installed]
lua-socket/stable,now 3.0~rc1+git+ac3201d-4 amd64 [installed]
lua5.1/stable,now 5.1.5-8.1+b3 amd64 [installed]

 

~$ sudo systemctl restart cbd
~$ tail -f /var/log/centreon-broker/central-broker-master.log | grep lua
...
[2023-02-14T00:23:44.101+01:00] [core] [info] modules: attempt to load module '/usr/share/centreon/lib/centreon-broker/70-lua.so'
[2023-02-14T00:23:44.102+01:00] [core] [debug] modules: checking initialization routine (symbol 'broker_module_init') in '/usr/share/centreon/lib/centreon-broker/70-lua.so'
[2023-02-14T00:23:44.104+01:00] [core] [debug] modules: checking deinitialization routine (symbol 'broker_module_deinit') in '/usr/share/centreon/lib/centreon-broker/70-lua.so'
[2023-02-14T00:23:44.104+01:00] [core] [debug] modules: checking module version (symbol 'broker_module_version') in '/usr/share/centreon/lib/centreon-broker/70-lua.so'
[2023-02-14T00:23:44.104+01:00] [core] [debug] modules: running initialization routine of '/usr/share/centreon/lib/centreon-broker/70-lua.so'
[2023-02-14T00:23:44.104+01:00] [lua] [info] lua: module for Centreon Broker 22.10.0
[2023-02-14T00:23:44.104+01:00] [core] [info] protocols: registering protocol ('lua' (layers 1-7)
[2023-02-14T00:23:47.073+01:00] [lua] [debug] lua: initializing the Lua virtual machine
[2023-02-14T00:23:47.074+01:00] [core] [error] failover: global error: lua: '/usr/share/centreon-broker/lua/opsgenie.lua' could not be compiled
[2023-02-14T00:24:02.077+01:00] [lua] [debug] lua: initializing the Lua virtual machine
[2023-02-14T00:24:02.078+01:00] [core] [error] failover: global error: lua: '/usr/share/centreon-broker/lua/opsgenie.lua' could not be compiled
...

 

Could you update your Lua Module (Rocks) with LUARocks, so install the LUARocks previously ?

https://luarocks.org/modules/moteus/lua-curl

When i implement the SC, using LUARocks to manage dependencies was recommeded

Maybe the Lua-cURL is outdated..

Badge +1

Hello.

Thank’s for your replies @gespada.

I tried the version 2 of the script but without success, still the same error.

When I execute the script in a shell, there is no error (no output).

Luarocks is already installed and Lua-cURL is the last stable version:

~$ luarocks --version
/usr/bin/luarocks 2.4.2
LuaRocks main command-line interface

~$ luarocks list

Installed rocks:
----------------

lua-curl
0.3.13-1 (installed) - /usr/local/lib/luarocks/rocks

By searching the net, I found this issue, very closed of mine: https://github.com/centreon/centreon-stream-connector-scripts/issues/1 but it’s not exactly my case and I don’t know how to check wich library the broker is trying to use.

Userlevel 4
Badge +14

Hello,

You run manually the SC with the user centreon-broker ?

You have the good rights, like indicated here :

https://docs.centreon.com/docs/integrations/event-management/sc-opsgenie/#in-centreon


chmod 644 /usr/share/centreon-broker/lua/opsgenie.lua

Badge +1

Hello @gespada 

Yes at your 2 questions.

I think it’s a conflict with Lua in my system and the Lua module in Centreon broker but I don’t know what to do or check.

Did you look at the link I shared in my last reply?

Userlevel 4
Badge +14

Hello,

Yes i've seen your link.

And it's probably the same behavior like this also https://github.com/centreon/centreon-stream-connector-scripts/issues/132

Maybe i'm wrong, but for Debian i could see that :

https://github.com/centreon/centreon-collect/blob/develop/packaging/debian/control

https://packages.debian.org/fr/sid/liblua5.3-dev

Could you try with a 5.3 of Lua ?

Because from my understand with the RHEL 7 based the lua version must do it 5.1

Maybe with a RHEL 8 based it's a 5.3 also i don't check it, RPM packaging don't provide this info https://github.com/centreon/centreon-collect/blob/dev-22.10.x/packaging/rpm/centreon-collect.spec

Regards

Badge +1

Hello @gespada 

You pointed me in the good direction!

After cleaning-up current installation of Lua library on my system, including luarocks, and installation of liblua5.3 and liblua5.3-dev packages, everything gone be allright!

Well, now the connector doesn’t seem to work properly (no alert is sent to Opsgenie) but that’s another story!

Thank you very much

Regards

 

Reply