sni / lmd

Livestatus Multitool Daemon - Create livestatus federation from multiple sources
https://labs.consol.de/omd/packages/lmd/
GNU General Public License v3.0
42 stars 31 forks source link

is Listen only supported in the first config file? #115

Closed klaernie closed 3 years ago

klaernie commented 3 years ago

Is it intended behaviour, that the Listen config directive is only loaded from the first config file found?

In a recent setup I planned to use the thruk-managed lmd, and inject an additional TCP Livestatus listener via Thruks's lmd_core_config option. But I found that lmd was not opening the socket I specified in the additional config file, only the socket specified in the config file maintained by Thruk.

For my installation I worked around that by using lmd_options = -o Listen=0.0.0.0:3333 in Thruk, which opened the TCP listener as I hoped.

Looking at the testcase in lmd/main_test.go:TestMainConfig() it looks like this is intended behaviour, but I might read that wrong since I'm not really go-literate.

sni commented 3 years ago

That's not how it should work. In fact, the test case you mentioned ensures that Listen = options from multiple files will be merged. When started with all 3 test config files here: https://github.com/sni/lmd/blob/master/lmd/main_test.go#L308-L309 The test makes sure there are 2 listeners in the end. When parsing the config, all listeners are merged here: https://github.com/sni/lmd/blob/master/lmd/config.go#L151 What's not supported is having multiple Listeners separated in one file. In this case you have to extend the list of Listeners like: Listen = ["/tmp/live.sock", "127.0.0.1:3333"]

klaernie commented 2 years ago

So, after being quite puzzled, I finally understood my mistake: I mistyped my path, so the glob could never match any files. Really stupid mistake, sorry for bothering you.