sni / Thruk

Thruk is a multibackend monitoring webinterface for Naemon, Nagios, Icinga and Shinken using the Livestatus API.
http://www.thruk.org
Other
408 stars 148 forks source link

Livestatus mismatch with Icinga in versions v3.06-2+ #1301

Closed OffbeatFocus closed 1 year ago

OffbeatFocus commented 1 year ago

Describe the bug Thruk API throws Error 500 after upgrading to Version v3.06-2 (or newer) when accessing objects via API endpoint, e.g. /thruk/r/services/hostname/servicename with backend Icinga.

Error message:

{
  "code": 500,
  "description": "452: internal livestatus error - Error: Column 'comments_info' does not exist in table 'services'.\n\nStacktrace:\n 0# __cxa_throw in /usr/lib64/icinga2/sbin/icinga2\n 1# void boost::exception_detail::throw_exception_<std::invalid_argument>(std::invalid_argument const&, char const*, char const*, int) in /usr/lib64/icinga2/sbin/icinga2\n 2# icinga::Table::GetColumn(icinga::String const&) const in /usr/lib64/icinga2/sbin/icinga2\n 3# icinga::LivestatusQuery::ExecuteGetHelper(boost::intrusive_ptr<icinga::Stream> const&) in /usr/lib64/icinga2/sbin/icinga2\n 4# icinga::LivestatusQuery::Execute(boost::intrusive_ptr<icinga::Stream> const&) in /usr/lib64/icinga2/sbin/icinga2\n 5# icinga::LivestatusListener::ClientHandler(boost::intrusive_ptr<icinga::Socket> const&) in /usr/lib64/icinga2/sbin/icinga2\n 6# bool icinga::ThreadPool::Post<std::function<void ()> >(std::function<void ()>, icinga::SchedulerPolicy)::{lambda()#1}::operator()() const in /usr/lib64/icinga2/sbin/icinga2\n 7# 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) in /usr/lib64/icinga2/sbin/icinga2\n 8# boost::asio::detail::scheduler::do_run_one(boost::asio::detail::conditionally_enabled_mutex::scoped_lock&, boost::asio::detail::scheduler_thread_info&, boost::system::error_code const&) in /usr/lib64/icinga2/sbin/icinga2\n 9# boost::asio::detail::scheduler::run(boost::system::error_code&) in /usr/lib64/icinga2/sbin/icinga2\n10# boost::asio::detail::posix_thread::func<boost::asio::thread_pool::thread_function>::run() in /usr/lib64/icinga2/sbin/icinga2\n11# boost_asio_detail_posix_thread_function in /usr/lib64/icinga2/sbin/icinga2\n12# 0x00007F83D88A9EA5 in /lib64/libpthread.so.0\n13# clone in /lib64/libc.so.6 at /usr/share/thruk/lib/Thruk/Backend/Manager.pm line 1600.\n",
  "failed": true,
  "message": "error during request"
}

Thruk Version v3.06-2 (or newer)

To Reproduce Steps to reproduce the behavior:

  1. Have current version of Icinga
  2. Install & Configure Thruk v3.06-2 (or newer)
  3. Try accessing object data via API endpoints (/thruk/r/hosts or /thruk/r/services)
  4. See error

Expected behavior API endpoints expose object data in json format without throwing error message

Screenshots not applicable

Desktop (please complete the following information): irrelevant

Additional context The bug is caused by commit a3bc662 Reversing this commit via patch -R fixes the issue (but also removes the new features of course)

I don't know what the feature provides, but Icinga's official Appendix says the livestatus column's name is comments_with_info, instead of comments_info which would explain the error message at least.

Icinga Version: 2.14.0-1.el7 (but it happens in 2.13.6 too)

sni commented 1 year ago

Thanks, should be fine again with the next release. There is indeed no comments_info column in icinga, that's a virtual column added by Thruk to provide a flat string with the comments for example to put it into a grafana table which cannot display nested structures.