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

Compatibility with older livestatus releases - `Table 'hosts' has no column 'event_handler'` #116

Closed llange closed 3 years ago

llange commented 3 years ago

Hello,

On some installations I'm stuck with and older release of livestatus (1.1.12p6 - the check_mk one, for Nagios3). The column event_handler was added to the hoststable some releases after (I believe in 1.2.0).

LMD tries to access this column at startup, and the error Table 'hosts' has no column 'event_handler' prevents a further use of these backends.

Would it be possible to handle this special -legacy- case ?

sni commented 3 years ago

the easiest workaround is probably to remove this column from lmd and rebuild it. Just uncomment this line: https://github.com/sni/lmd/blob/master/lmd/objects.go#L278 There might be more unknown columns.

llange commented 3 years ago

I'll certainly try that approach, thanks, and list the other columns if any.

Is there any drawbacks in removing this column ? Loss of functionality ?

If so, as I have many other backends (more recent) on the same installation, I think it could be good to have a more "dynamic" detection (via Livestatus version for example) so that newer backends have the full capabilities.

sni commented 3 years ago

There is a dynamic approach as well. Just have a look at that file. There is one based on the backend type, like naemon, icinga... and there is one based on a "GET tables" query to get all available tables and their columns.

llange commented 3 years ago

I just pushed PR #117 implemented as you suggested. It "works for me", for both older and newer livestatus releases.

Tell me if any changes are needed.