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

incomplete data with Icinga2 with lmd and thruk #95

Closed Shorty110 closed 3 years ago

Shorty110 commented 4 years ago

Hi, I try to use lmd to access livestatus from two icinga2 instances. It works partly, but the data is not sorted and incomplete in some thruk tabs.

I have a hostgroup "all-hosts" in icinga, which returns all hosts when clicking the "Host Groups" Tab in "Current Status". When I click "Hosts" in "Current Status", not all hosts are shown. Same thing for "Services", not all hosts and not all services for each host is returned.

Any advise?

I had to use the workaround from issue #92 to get any data at all.

Thruk Version 2.32-3 Icinga2 Version: 2.11.2-1 LMD Version: lmd - version 1.7.1 (Build: )

/etc/thruk/thruk_local.conf:

<Component Thruk::Backend>
    <peer>
        name    = Icinga2 HA Cluster
        type    = livestatus
        <options>
            peer   = ip1:6558
            peer   = ip2:6558
        </options>
    </peer>
</Component>

shown_inline_pnp = 1

logcache = mysql://thruk:<pw>@<db-ip>:3306/thruk_logs
logcache_fetchlogs_command = IDO_DB_HOST=<db-ip> IDO_DB_PORT=3306 IDO_DB_USER=icinga IDO_DB_PW=<db-pw> IDO_DB_NAME=icinga /usr/share/thruk/support/icinga2_ido_fetchlogs.sh mysql

/etc/thruk/thruk_local.d/lmd.conf:

use_lmd_core=1
lmd_core_bin=/opt/local/go/bin/lmd

Thank you, Christoph

Shorty110 commented 4 years ago

Hi, I just noticed I'm not on the latest lmd version but the issue persists even with version 1.8.1.

sni commented 4 years ago

right, there is no fix for this issue. It would be nice to convince the icinga people to send a version string which can be used to identify icinga2, ex.: 2.10-icinga2

Shorty110 commented 4 years ago

Hi, is there any workaround? E.g. to tell thruk/lmd in the config it deals with icinga2?

Also, I just noted that when I disable lmd and only run icinga2 on one node also not all hosts/services are displayed.

Thank you, Christoph

sni commented 4 years ago

meanwhile, since this seems to take a while. I added optional flags, which will be passed from thruk to lmd in bb430d7403d056fd8854871af0acb3904ba8d45d.

You can set a backend to type icinga2 with this configuration:

<Component Thruk::Backend>
    <peer>
        name    = icinga
        id      = abcd
        type    = livestatus
        <options>
            peer = 127.0.0.3:60557
        </options>
        <lmd_options>
            flags = ['Icinga2']
        </lmd_options>
    </peer>

You will need latest LMD from today and Thruk >= 2.34.

tengatoise commented 3 years ago

Hi Sven,

Tested this on our environment but we are unable to connect to the icinga backend.

Thruk Version: thruk-2.38-2 OS: rhel7 Thruk: 2.38-2 LMD: lmd - version 1.9.1 (Build: , go1.15.2) Backend: icinga2-2.11.4-1.el7.icinga.x86_64

thruk_local.conf

<Component Thruk::Backend>
    <peer>
        name    = MASTER-PROD
        id      = 36a9e
        type    = livestatus
        section = Icinga
        <options>
            peer          = 172.26.66.30:6558
        </options>
        <lmd_options>
            flags = ['Icinga2']
        </lmd_options>

    </peer>
</Component>

This is the error we got from Thruk.

Details:
MASTER-PROD: peer is down: [MASTER-PROD] bad response code: 452
Request: GET contacts
ResponseHeader: fixed16
OutputFormat: json
Columns: alias can_submit_commands custom_variable_names custom_variable_values email host_notification_period host_notifications_enabled name pager service_notification_period service_notifications_enabled
KeepAlive: on

Response: Error: Column 'custom_variable_names' does not exist in table 'contacts'.

(0) icinga2: icinga::Table::GetColumn(icinga::String const&) const (+0x250) [0xbb7eb0]
(1) icinga2: icinga::LivestatusQuery::ExecuteGetHelper(boost::intrusive_ptr<icinga::Stream> const&) (+0x12c2) [0xbb92b2]
(2) icinga2: icinga::LivestatusQuery::Execute(boost::intrusive_ptr<icinga::Stream> const&) (+0xb3) [0xbb9c13]
(3) icinga2: icinga::LivestatusListener::ClientHandler(boost::intrusive_ptr<icinga::Socket> const&) (+0x182) [0xbb9f42]
(4) /usr/lib64/icinga2/sbin/icinga2() [0x8ff113]
(5) icinga2: boost::asio::detail::executor_op<boost::asio::detail::work_dispatcher<bool icinga::ThreadPool::Post<std::function<void ()> >(std::function<void ()>, icinga::SchedulerPolicy)::{lambda()#1}>, std::allocator<void>, boost::asio::detail::scheduler_operation>::do_complete(void*, std::allocator<void>*, boost::system::error_code const&, unsigned long) (+0x106) [0xbf7bf6]
(6) /usr/lib64/icinga2/sbin/icinga2() [0x630df1]
(7) /usr/lib64/icinga2/sbin/icinga2() [0x631142]
(8) icinga2: boost_asio_detail_posix_thread_function (+0xf) [0x82104f]
(9) libpthread.so.0: <unknown function> (+0x7ea5) [0x7f87c2c86ea5]
(10) libc.so.6: clone (+0x6d) [0x7f87c29af96d]

(172.26.66.30:6558)
sni commented 3 years ago

the custom_variable_names column needs to be converted into a optional column, just haven't found time to investigate which cores support that column and which not.

sni commented 3 years ago

commit 95f988b850baa8dfb8855c8eeb29a7928b5b21e8 should fix the issue with the new columns.