lists.checkmk.com
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
List overview
Download
Checkmk git commits
November 2017
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
checkmk-commits@lists.checkmk.com
10 participants
325 discussions
Start a n
N
ew thread
Unify contact collumn implementations.
by Sven Panne
Module: check_mk Branch: master Commit: bcd0516f4a053f0cbb4332132d1be90dd108baf6 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=bcd0516f4a053f…
Author: Sven Panne <sp(a)mathias-kettner.de> Date: Mon Nov 6 13:35:37 2017 +0100 Unify contact collumn implementations. Change-Id: I3b4225626638c71054db0eef81271634c8f8ac89 --- livestatus/src/HostContactsColumn.cc | 16 +++++++++++++++- livestatus/src/ServiceContactsColumn.cc | 16 +++++++++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/livestatus/src/HostContactsColumn.cc b/livestatus/src/HostContactsColumn.cc index 5abb163..e57695d 100644 --- a/livestatus/src/HostContactsColumn.cc +++ b/livestatus/src/HostContactsColumn.cc @@ -23,13 +23,26 @@ // Boston, MA 02110-1301 USA. #include "HostContactsColumn.h" -#include <unordered_set> #include "Row.h" + +#ifdef CMC +#include "ContactList.h" +#include "Object.h" +#include "cmc.h" +#else +#include <unordered_set> #include "nagios.h" +#endif std::vector<std::string> HostContactsColumn::getValue( Row row, const contact* /*auth_user*/, std::chrono::seconds /*timezone_offset*/) const { +#ifdef CMC + if (auto object = columnData<Object>(row)) { + return object->_contact_list->contactNames(); + } + return {}; +#else std::unordered_set<std::string> names; if (auto hst = columnData<host>(row)) { for (auto cm = hst->contacts; cm != nullptr; cm = cm->next) { @@ -43,4 +56,5 @@ std::vector<std::string> HostContactsColumn::getValue( } } return std::vector<std::string>(names.begin(), names.end()); +#endif } diff --git a/livestatus/src/ServiceContactsColumn.cc b/livestatus/src/ServiceContactsColumn.cc index 2a9dd48..5f7f55d 100644 --- a/livestatus/src/ServiceContactsColumn.cc +++ b/livestatus/src/ServiceContactsColumn.cc @@ -23,13 +23,26 @@ // Boston, MA 02110-1301 USA. #include "ServiceContactsColumn.h" -#include <unordered_set> #include "Row.h" + +#ifdef CMC +#include "ContactList.h" +#include "Object.h" +#include "cmc.h" +#else +#include <unordered_set> #include "nagios.h" +#endif std::vector<std::string> ServiceContactsColumn::getValue( Row row, const contact* /*auth_user*/, std::chrono::seconds /*timezone_offset*/) const { +#ifdef CMC + if (auto object = columnData<Object>(row)) { + return object->_contact_list->contactNames(); + } + return {}; +#else std::unordered_set<std::string> names; if (auto svc = columnData<service>(row)) { for (auto cm = svc->contacts; cm != nullptr; cm = cm->next) { @@ -43,4 +56,5 @@ std::vector<std::string> ServiceContactsColumn::getValue( } } return std::vector<std::string>(names.begin(), names.end()); +#endif }
7 years
1
0
0
0
Unify ServiceListStateColumn implementations.
by Sven Panne
Module: check_mk Branch: master Commit: e04e203ee60d400e74b44992ae98977ae36e0c2e URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=e04e203ee60d40…
Author: Sven Panne <sp(a)mathias-kettner.de> Date: Mon Nov 6 12:05:43 2017 +0100 Unify ServiceListStateColumn implementations. Change-Id: I82056524a5da93689767e2a1546bca302c8d0f7b --- livestatus/src/ServiceListStateColumn.cc | 44 +++++++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 6 deletions(-) diff --git a/livestatus/src/ServiceListStateColumn.cc b/livestatus/src/ServiceListStateColumn.cc index 6014341..2fe98b7 100644 --- a/livestatus/src/ServiceListStateColumn.cc +++ b/livestatus/src/ServiceListStateColumn.cc @@ -25,23 +25,46 @@ #include "ServiceListStateColumn.h" #include "LogEntry.h" #include "Row.h" + +#ifdef CMC +#include <memory> +#include "Service.h" +#include "State.h" +#else #include "auth.h" +#endif int32_t ServiceListStateColumn::getValue(Row row, const contact *auth_user) const { +#ifdef CMC + if (auto p = columnData<Host::services_t>(row)) { + return getValueFromServices(_mc, _logictype, p, auth_user); + } + return 0; +#else servicesmember *mem = nullptr; if (auto p = columnData<servicesmember *>(row)) { mem = *p; } return getValueFromServices(_mc, _logictype, mem, auth_user); +#endif } // static int32_t ServiceListStateColumn::getValueFromServices(MonitoringCore *mc, Type logictype, - servicesmember *mem, + service_list mem, const contact *auth_user) { int32_t result = 0; +#ifdef CMC + if (mem != nullptr) { + for (const auto &svc : *mem) { + if (auth_user == nullptr || svc->hasContact(mc, auth_user)) { + update(logictype, svc.get(), result); + } + } + } +#else for (; mem != nullptr; mem = mem->next) { service *svc = mem->service_ptr; if (auth_user == nullptr || @@ -49,19 +72,29 @@ int32_t ServiceListStateColumn::getValueFromServices(MonitoringCore *mc, update(logictype, svc, result); } } +#endif return result; } // static void ServiceListStateColumn::update(Type logictype, service *svc, int32_t &result) { +#ifdef CMC + uint32_t last_hard_state = svc->state()->_last_hard_state; + uint32_t current_state = svc->state()->_current_state; + bool has_been_checked = svc->state()->_has_been_checked; +#else + int last_hard_state = svc->last_hard_state; + int current_state = svc->current_state; + bool has_been_checked = svc->has_been_checked != 0; +#endif int service_state; Type lt; if (static_cast<int>(logictype) >= 60) { - service_state = svc->last_hard_state; + service_state = last_hard_state; lt = static_cast<Type>(static_cast<int>(logictype) - 64); } else { - service_state = svc->current_state; + service_state = current_state; lt = logictype; } switch (lt) { @@ -75,13 +108,12 @@ void ServiceListStateColumn::update(Type logictype, service *svc, result++; break; case Type::num_pending: - if (svc->has_been_checked == 0) { + if (!has_been_checked) { result++; } break; default: - if (svc->has_been_checked != 0 && - service_state == static_cast<int>(lt)) { + if (has_been_checked && service_state == static_cast<int>(lt)) { result++; } break;
7 years
1
0
0
0
Unify ContactGroupsMemberColumn implementations.
by Sven Panne
Module: check_mk Branch: master Commit: 3b1ae0196f7b4f50bef1be853866027898614efa URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3b1ae0196f7b4f…
Author: Sven Panne <sp(a)mathias-kettner.de> Date: Mon Nov 6 11:28:04 2017 +0100 Unify ContactGroupsMemberColumn implementations. Change-Id: I48f6b69aca4f9fe8ac2eb6df8224c504063b0bc4 --- livestatus/src/ContactGroupsMemberColumn.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/livestatus/src/ContactGroupsMemberColumn.cc b/livestatus/src/ContactGroupsMemberColumn.cc index b5a737b..31918f6 100644 --- a/livestatus/src/ContactGroupsMemberColumn.cc +++ b/livestatus/src/ContactGroupsMemberColumn.cc @@ -24,11 +24,22 @@ #include "ContactGroupsMemberColumn.h" #include "Row.h" + +#ifdef CMC +#include "ContactGroup.h" +#else #include "nagios.h" +#endif std::vector<std::string> ContactGroupsMemberColumn::getValue( Row row, const contact* /*auth_user*/, std::chrono::seconds /*timezone_offset*/) const { +#ifdef CMC + if (auto cg = columnData<ContactGroup>(row)) { + return cg->contactNames(); + } + return {}; +#else std::vector<std::string> names; if (auto cg = columnData<contactgroup>(row)) { for (auto cm = cg->members; cm != nullptr; cm = cm->next) { @@ -36,4 +47,5 @@ std::vector<std::string> ContactGroupsMemberColumn::getValue( } } return names; +#endif }
7 years
1
0
0
0
Unify HostListStateColumn implementations.
by Sven Panne
Module: check_mk Branch: master Commit: 39fb3adc31a9f3386c3ef1a189b56a79489ff477 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=39fb3adc31a9f3…
Author: Sven Panne <sp(a)mathias-kettner.de> Date: Mon Nov 6 11:35:10 2017 +0100 Unify HostListStateColumn implementations. Change-Id: I126301ab2b74fe800a8a5c9dfe3ba39d631131f5 --- livestatus/src/HostListStateColumn.cc | 40 +++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 7 deletions(-) diff --git a/livestatus/src/HostListStateColumn.cc b/livestatus/src/HostListStateColumn.cc index a91576d..f7a63cc 100644 --- a/livestatus/src/HostListStateColumn.cc +++ b/livestatus/src/HostListStateColumn.cc @@ -25,10 +25,26 @@ #include "HostListStateColumn.h" #include "LogEntry.h" #include "Row.h" + +#ifdef CMC +#include <unordered_set> +#include "Host.h" +#include "State.h" +#else #include "auth.h" +#endif int32_t HostListStateColumn::getValue(Row row, const contact *auth_user) const { int32_t result = 0; +#ifdef CMC + if (auto p = columnData<std::unordered_set<Host *>>(row)) { + for (auto hst : *p) { + if (auth_user == nullptr || hst->hasContact(_mc, auth_user)) { + update(hst, auth_user, result); + } + } + } +#else if (auto p = columnData<hostsmember *>(row)) { for (hostsmember *mem = *p; mem != nullptr; mem = mem->next) { host *hst = mem->host_ptr; @@ -38,11 +54,21 @@ int32_t HostListStateColumn::getValue(Row row, const contact *auth_user) const { } } } +#endif return result; } void HostListStateColumn::update(host *hst, const contact *auth_user, int32_t &result) const { +#ifdef CMC + ServiceListStateColumn::service_list services = &hst->_services; + bool has_been_checked = hst->state()->_has_been_checked; + int current_state = static_cast<int>(hst->state()->_current_state); +#else + ServiceListStateColumn::service_list services = hst->services; + bool has_been_checked = hst->has_been_checked != 0; + int current_state = hst->current_state; +#endif switch (_logictype) { case Type::num_svc_pending: case Type::num_svc_ok: @@ -52,13 +78,13 @@ void HostListStateColumn::update(host *hst, const contact *auth_user, case Type::num_svc: result += ServiceListStateColumn::getValueFromServices( _mc, static_cast<ServiceListStateColumn::Type>(_logictype), - hst->services, auth_user); + services, auth_user); break; case Type::worst_svc_state: { int state = ServiceListStateColumn::getValueFromServices( _mc, static_cast<ServiceListStateColumn::Type>(_logictype), - hst->services, auth_user); + services, auth_user); if (worse(static_cast<ServiceState>(state), static_cast<ServiceState>(result))) { result = state; @@ -69,8 +95,8 @@ void HostListStateColumn::update(host *hst, const contact *auth_user, case Type::num_hst_up: case Type::num_hst_down: case Type::num_hst_unreach: - if (hst->has_been_checked != 0 && - hst->current_state == + if (has_been_checked && + current_state == static_cast<int>(_logictype) - static_cast<int>(Type::num_hst_up)) { result++; @@ -78,7 +104,7 @@ void HostListStateColumn::update(host *hst, const contact *auth_user, break; case Type::num_hst_pending: - if (hst->has_been_checked == 0) { + if (!has_been_checked) { result++; } break; @@ -88,9 +114,9 @@ void HostListStateColumn::update(host *hst, const contact *auth_user, break; case Type::worst_hst_state: - if (worse(static_cast<HostState>(hst->current_state), + if (worse(static_cast<HostState>(current_state), static_cast<HostState>(result))) { - result = hst->current_state; + result = current_state; } break; case Type::num_svc_hard_ok:
7 years
1
0
0
0
Unify ContactGroupsColumn implementations.
by Sven Panne
Module: check_mk Branch: master Commit: 5f1be83408d7a24ec7f6791715431fb128c1d346 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=5f1be83408d7a2…
Author: Sven Panne <sp(a)mathias-kettner.de> Date: Mon Nov 6 10:55:27 2017 +0100 Unify ContactGroupsColumn implementations. Change-Id: I114d2e347d02d2531b7b1ee11d818460fcec2e17 --- livestatus/src/ContactGroupsColumn.cc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/livestatus/src/ContactGroupsColumn.cc b/livestatus/src/ContactGroupsColumn.cc index da62745..c66e898 100644 --- a/livestatus/src/ContactGroupsColumn.cc +++ b/livestatus/src/ContactGroupsColumn.cc @@ -24,16 +24,31 @@ #include "ContactGroupsColumn.h" #include "Row.h" + +#ifdef CMC +#include "ContactList.h" +#include "Object.h" +#include "cmc.h" +#else #include "nagios.h" +#endif std::vector<std::string> ContactGroupsColumn::getValue( Row row, const contact * /*auth_user*/, std::chrono::seconds /*timezone_offset*/) const { std::vector<std::string> names; +#ifdef CMC + if (auto object = columnData<Object>(row)) { + for (const auto &name : object->_contact_list->groupNames()) { + names.push_back(name); + } + } +#else if (auto p = columnData<contactgroupsmember *>(row)) { for (auto cgm = *p; cgm != nullptr; cgm = cgm->next) { names.emplace_back(cgm->group_ptr->group_name); } } +#endif return names; }
7 years
1
0
0
0
Unify TimeperiodColumn implementations.
by Sven Panne
Module: check_mk Branch: master Commit: 91600043ceec1910e35b89996460ab536303dd84 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=91600043ceec19…
Author: Sven Panne <sp(a)mathias-kettner.de> Date: Mon Nov 6 10:45:37 2017 +0100 Unify TimeperiodColumn implementations. Change-Id: I3138e352537e2a30483b6c2974310d54212d2156 --- livestatus/src/TimeperiodColumn.cc | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/livestatus/src/TimeperiodColumn.cc b/livestatus/src/TimeperiodColumn.cc index 5488d27..6986acd 100644 --- a/livestatus/src/TimeperiodColumn.cc +++ b/livestatus/src/TimeperiodColumn.cc @@ -24,10 +24,13 @@ #include "TimeperiodColumn.h" #include "Row.h" + +#ifdef CMC +#include "Timeperiod.h" +#else #include "TimeperiodsCache.h" #include "nagios.h" - -extern TimeperiodsCache* g_timeperiods_cache; +#endif TimeperiodColumn::TimeperiodColumn(const std::string& name, const std::string& description, @@ -38,9 +41,16 @@ TimeperiodColumn::TimeperiodColumn(const std::string& name, int32_t TimeperiodColumn::getValue(Row row, const contact* /* auth_user */) const { +#ifdef CMC + if (auto tp = columnData<Timeperiod>(row)) { + return tp->isActive() ? 1 : 0; + } +#else + extern TimeperiodsCache* g_timeperiods_cache; if (auto tp = columnData<timeperiod>(row)) { return g_timeperiods_cache->inTimeperiod(tp) ? 1 : 0; } - // no timeperiod set -> Nagios assumes 24X7 +#endif + // no timeperiod set -> assume 24X7 return 0; }
7 years
1
0
0
0
Unify MetricsColumn implementations.
by Sven Panne
Module: check_mk Branch: master Commit: 4a25a3f6f75eb34d8a5198de3cd5057f3fa2549d URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=4a25a3f6f75eb3…
Author: Sven Panne <sp(a)mathias-kettner.de> Date: Mon Nov 6 10:50:30 2017 +0100 Unify MetricsColumn implementations. Change-Id: I1da8f8f8d8924e31f98a83e513116d073c61ab0f --- livestatus/src/MetricsColumn.cc | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/livestatus/src/MetricsColumn.cc b/livestatus/src/MetricsColumn.cc index c2c11da..c347b54 100644 --- a/livestatus/src/MetricsColumn.cc +++ b/livestatus/src/MetricsColumn.cc @@ -25,9 +25,35 @@ #include "MetricsColumn.h" #include "Row.h" +#ifdef CMC +#include <algorithm> +#include <iterator> +#include "Core.h" +#include "Metric.h" +#include "MonitoringCore.h" +#include "Object.h" +#include "RRDBackend.h" +#include "RRDInfoCache.h" +#include "State.h" +#include "cmc.h" +#endif + std::vector<std::string> MetricsColumn::getValue( - Row /*row*/, const contact* /*auth_user*/, + Row row, const contact * /*auth_user*/, std::chrono::seconds /*timezone_offset*/) const { + std::vector<std::string> metrics; +#ifdef CMC + if (auto object = columnData<Object>(row)) { + if (object->isEnabled(State::Enable::performance_data)) { + auto names = _mc->impl<Core>()->_rrd_backend.infoFor(object)._names; + std::transform( + names.begin(), names.end(), std::back_inserter(metrics), + [](const Metric::MangledName &name) { return name.string(); }); + } + } +#else (void)_mc; - return {}; + (void)row; +#endif + return metrics; }
7 years
1
0
0
0
IWYU fix.
by Sven Panne
Module: check_mk Branch: master Commit: e2fe7600b51d7bfdeaab9bf532132a140367a2ad URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=e2fe7600b51d7b…
Author: Sven Panne <sp(a)mathias-kettner.de> Date: Mon Nov 6 10:25:43 2017 +0100 IWYU fix. Change-Id: I97454c22e489d7a675ee9d23d53f9e5f88378f8f --- livestatus/src/RendererBrokenCSV.h | 1 - 1 file changed, 1 deletion(-) diff --git a/livestatus/src/RendererBrokenCSV.h b/livestatus/src/RendererBrokenCSV.h index 64dc709..053da52 100644 --- a/livestatus/src/RendererBrokenCSV.h +++ b/livestatus/src/RendererBrokenCSV.h @@ -26,7 +26,6 @@ #define RendererBrokenCSV_h #include "config.h" // IWYU pragma: keep -#include <chrono> #include <iosfwd> #include <string> #include <vector>
7 years
1
0
0
0
Fix for use of active_check_service_descripton in class AutomationActiveCheck
by Tom Baerwinkel
Module: check_mk Branch: master Commit: 559bb357d902f7859efc1a711af3d198e87ae403 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=559bb357d902f7…
Author: Tom Baerwinkel <tb(a)mathias-kettner.de> Date: Mon Nov 6 10:16:09 2017 +0100 Fix for use of active_check_service_descripton in class AutomationActiveCheck Change-Id: Ia5d37c8e3fad3824d02163b9db00d51b490adb10 --- cmk_base/automations/check_mk.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmk_base/automations/check_mk.py b/cmk_base/automations/check_mk.py index ba87c1d..8aece39 100644 --- a/cmk_base/automations/check_mk.py +++ b/cmk_base/automations/check_mk.py @@ -1105,7 +1105,7 @@ class AutomationActiveCheck(Automation): if entries: act_info = checks.active_check_info[plugin] for params in entries: - description = config.active_check_service_description(hostname, act_info, params) + description = config.active_check_service_description(hostname, plugin, params) if description == item: args = core_config.active_check_arguments(hostname, description, act_info["argument_function"](params)) command_line = self._replace_core_macros(hostname, act_info["command_line"].replace("$ARG1$", args))
7 years
1
0
0
0
Unifiy host/service groups column implementation.
by Sven Panne
Module: check_mk Branch: master Commit: eaff1ae1819f2a68fdffa3951554bb2cbe2d991d URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=eaff1ae1819f2a…
Author: Sven Panne <sp(a)mathias-kettner.de> Date: Mon Nov 6 10:05:05 2017 +0100 Unifiy host/service groups column implementation. Change-Id: I141809e0c34f9a4a6cceae4ab2e38b5d2887e395 --- livestatus/src/HostGroupsColumn.cc | 17 +++++++++++++++++ livestatus/src/ServiceGroupsColumn.cc | 17 +++++++++++++++++ livestatus/src/ServiceGroupsColumn.h | 2 +- 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/livestatus/src/HostGroupsColumn.cc b/livestatus/src/HostGroupsColumn.cc index 22f470c..63460aa 100644 --- a/livestatus/src/HostGroupsColumn.cc +++ b/livestatus/src/HostGroupsColumn.cc @@ -24,13 +24,29 @@ #include "HostGroupsColumn.h" #include "Row.h" + +#ifdef CMC +#include "Object.h" +#include "ObjectGroup.h" +#include "cmc.h" +#else #include "auth.h" #include "nagios.h" +#endif std::vector<std::string> HostGroupsColumn::getValue( Row row, const contact *auth_user, std::chrono::seconds /*timezone_offset*/) const { std::vector<std::string> group_names; +#ifdef CMC + if (auto object = columnData<Object>(row)) { + for (const auto &og : object->_groups) { + if (og->isContactAuthorized(_mc, auth_user)) { + group_names.push_back(og->name()); + } + } + } +#else if (auto p = columnData<objectlist *>(row)) { for (objectlist *list = *p; list != nullptr; list = list->next) { auto hg = static_cast<hostgroup *>(list->object_ptr); @@ -39,5 +55,6 @@ std::vector<std::string> HostGroupsColumn::getValue( } } } +#endif return group_names; } diff --git a/livestatus/src/ServiceGroupsColumn.cc b/livestatus/src/ServiceGroupsColumn.cc index a5f6aed..af7451f 100644 --- a/livestatus/src/ServiceGroupsColumn.cc +++ b/livestatus/src/ServiceGroupsColumn.cc @@ -24,13 +24,29 @@ #include "ServiceGroupsColumn.h" #include "Row.h" + +#ifdef CMC +#include "Object.h" +#include "ObjectGroup.h" +#include "cmc.h" +#else #include "auth.h" #include "nagios.h" +#endif std::vector<std::string> ServiceGroupsColumn::getValue( Row row, const contact *auth_user, std::chrono::seconds /*timezone_offset*/) const { std::vector<std::string> group_names; +#ifdef CMC + if (auto object = columnData<Object>(row)) { + for (const auto &og : object->_groups) { + if (og->isContactAuthorized(_mc, auth_user)) { + group_names.push_back(og->name()); + } + } + } +#else if (auto p = columnData<objectlist *>(row)) { for (objectlist *list = *p; list != nullptr; list = list->next) { auto sg = static_cast<servicegroup *>(list->object_ptr); @@ -39,5 +55,6 @@ std::vector<std::string> ServiceGroupsColumn::getValue( } } } +#endif return group_names; } diff --git a/livestatus/src/ServiceGroupsColumn.h b/livestatus/src/ServiceGroupsColumn.h index ec1d199..f715a7e 100644 --- a/livestatus/src/ServiceGroupsColumn.h +++ b/livestatus/src/ServiceGroupsColumn.h @@ -45,7 +45,7 @@ public: std::vector<std::string> getValue( Row row, const contact *auth_user, - std::chrono::seconds /*timezone_offset*/) const override; + std::chrono::seconds timezone_offset) const override; private: MonitoringCore *const _mc;
7 years
1
0
0
0
← Newer
1
...
26
27
28
29
30
31
32
33
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
Results per page:
10
25
50
100
200