From f53f8e64fd9af0110489553aa5ef09a89b13df62 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Tue, 25 Sep 2012 09:06:21 +0200 Subject: [PATCH] Renamed NagiosCheckTask to PluginCheckTask. Fixes #3146 --- components/checker/checkercomponent.cpp | 3 ++- icinga-app/config/icinga2.conf.dist | 2 +- lib/icinga/Makefile.am | 4 ++-- lib/icinga/i2-icinga.h | 2 +- lib/icinga/icinga.vcxproj | 6 +++--- ...nagioschecktask.cpp => pluginchecktask.cpp} | 18 +++++++++--------- .../{nagioschecktask.h => pluginchecktask.h} | 14 +++++++------- 7 files changed, 25 insertions(+), 24 deletions(-) rename lib/icinga/{nagioschecktask.cpp => pluginchecktask.cpp} (88%) rename lib/icinga/{nagioschecktask.h => pluginchecktask.h} (85%) diff --git a/components/checker/checkercomponent.cpp b/components/checker/checkercomponent.cpp index 2411b45d0..43e27239c 100644 --- a/components/checker/checkercomponent.cpp +++ b/components/checker/checkercomponent.cpp @@ -37,7 +37,8 @@ void CheckerComponent::Start(void) m_CheckTimer->OnTimerExpired.connect(boost::bind(&CheckerComponent::CheckTimerHandler, this)); m_CheckTimer->Start(); - NagiosCheckTask::Register(); + /* TODO: figure out a way to register check types */ + PluginCheckTask::Register(); NullCheckTask::Register(); m_ResultTimer = boost::make_shared(); diff --git a/icinga-app/config/icinga2.conf.dist b/icinga-app/config/icinga2.conf.dist index beb48df44..d932f6bde 100644 --- a/icinga-app/config/icinga2.conf.dist +++ b/icinga-app/config/icinga2.conf.dist @@ -16,7 +16,7 @@ local object Component "compat" { abstract object Service "nagios-service" { methods = { - check = "native::NagiosCheck" + check = "native::PluginCheck" }, macros = { diff --git a/lib/icinga/Makefile.am b/lib/icinga/Makefile.am index dcaf2301e..9e003acec 100644 --- a/lib/icinga/Makefile.am +++ b/lib/icinga/Makefile.am @@ -16,10 +16,10 @@ libicinga_la_SOURCES = \ icingaapplication.h \ macroprocessor.cpp \ macroprocessor.h \ - nagioschecktask.cpp \ - nagioschecktask.h \ nullchecktask.cpp \ nullchecktask.h \ + pluginchecktask.cpp \ + pluginchecktask.h \ service.cpp \ servicegroup.cpp \ servicegroup.h \ diff --git a/lib/icinga/i2-icinga.h b/lib/icinga/i2-icinga.h index d5f8e2766..cc924f458 100644 --- a/lib/icinga/i2-icinga.h +++ b/lib/icinga/i2-icinga.h @@ -50,7 +50,7 @@ using boost::algorithm::is_any_of; #include "servicegroup.h" #include "macroprocessor.h" -#include "nagioschecktask.h" +#include "pluginchecktask.h" #include "nullchecktask.h" #include "servicestatechangemessage.h" diff --git a/lib/icinga/icinga.vcxproj b/lib/icinga/icinga.vcxproj index 26cae9771..b8d5727e4 100644 --- a/lib/icinga/icinga.vcxproj +++ b/lib/icinga/icinga.vcxproj @@ -30,7 +30,7 @@ - + @@ -43,7 +43,7 @@ - + @@ -199,4 +199,4 @@ - \ No newline at end of file + diff --git a/lib/icinga/nagioschecktask.cpp b/lib/icinga/pluginchecktask.cpp similarity index 88% rename from lib/icinga/nagioschecktask.cpp rename to lib/icinga/pluginchecktask.cpp index 64c2cce9b..b699c4c1d 100644 --- a/lib/icinga/nagioschecktask.cpp +++ b/lib/icinga/pluginchecktask.cpp @@ -21,11 +21,11 @@ using namespace icinga; -NagiosCheckTask::NagiosCheckTask(const ScriptTask::Ptr& task, const Process::Ptr& process) +PluginCheckTask::PluginCheckTask(const ScriptTask::Ptr& task, const Process::Ptr& process) : m_Task(task), m_Process(process) { } -void NagiosCheckTask::ScriptFunc(const ScriptTask::Ptr& task, const vector& arguments) +void PluginCheckTask::ScriptFunc(const ScriptTask::Ptr& task, const vector& arguments) { if (arguments.size() < 1) throw_exception(invalid_argument("Missing argument: Service must be specified.")); @@ -46,15 +46,15 @@ void NagiosCheckTask::ScriptFunc(const ScriptTask::Ptr& task, const vector(command); - NagiosCheckTask ct(task, process); + PluginCheckTask ct(task, process); ct.m_Result = boost::make_shared(); ct.m_Result->Set("schedule_start", Utility::GetTime()); - process->Start(boost::bind(&NagiosCheckTask::ProcessFinishedHandler, ct)); + process->Start(boost::bind(&PluginCheckTask::ProcessFinishedHandler, ct)); } -void NagiosCheckTask::ProcessFinishedHandler(NagiosCheckTask ct) +void PluginCheckTask::ProcessFinishedHandler(PluginCheckTask ct) { ProcessResult pr; @@ -96,7 +96,7 @@ void NagiosCheckTask::ProcessFinishedHandler(NagiosCheckTask ct) ct.m_Task->FinishResult(ct.m_Result); } -void NagiosCheckTask::ProcessCheckOutput(const Dictionary::Ptr& result, String& output) +void PluginCheckTask::ProcessCheckOutput(const Dictionary::Ptr& result, String& output) { String text; String perfdata; @@ -125,8 +125,8 @@ void NagiosCheckTask::ProcessCheckOutput(const Dictionary::Ptr& result, String& result->Set("performance_data_raw", perfdata); } -void NagiosCheckTask::Register(void) +void PluginCheckTask::Register(void) { - ScriptFunction::Ptr func = boost::make_shared(&NagiosCheckTask::ScriptFunc); - ScriptFunction::Register("native::NagiosCheck", func); + ScriptFunction::Ptr func = boost::make_shared(&PluginCheckTask::ScriptFunc); + ScriptFunction::Register("native::PluginCheck", func); } diff --git a/lib/icinga/nagioschecktask.h b/lib/icinga/pluginchecktask.h similarity index 85% rename from lib/icinga/nagioschecktask.h rename to lib/icinga/pluginchecktask.h index c23cb1476..d8dd8b3bf 100644 --- a/lib/icinga/nagioschecktask.h +++ b/lib/icinga/pluginchecktask.h @@ -17,18 +17,18 @@ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * ******************************************************************************/ -#ifndef NAGIOSCHECKTASK_H -#define NAGIOSCHECKTASK_H +#ifndef PLUGINCHECKTASK_H +#define PLUGINCHECKTASK_H namespace icinga { /** - * Implements Nagios(TM)-style checks. + * Implements service checks based on external plugins. * * @ingroup icinga */ -class I2_ICINGA_API NagiosCheckTask +class I2_ICINGA_API PluginCheckTask { public: static void Register(void); @@ -36,10 +36,10 @@ public: private: static void ScriptFunc(const ScriptTask::Ptr& task, const vector& arguments); - static void ProcessFinishedHandler(NagiosCheckTask ct); + static void ProcessFinishedHandler(PluginCheckTask ct); static void ProcessCheckOutput(const Dictionary::Ptr& result, String& output); - NagiosCheckTask(const ScriptTask::Ptr& task, const Process::Ptr& process); + PluginCheckTask(const ScriptTask::Ptr& task, const Process::Ptr& process); ScriptTask::Ptr m_Task; Process::Ptr m_Process; @@ -48,4 +48,4 @@ private: } -#endif /* NAGIOSCHECKTASK_H */ +#endif /* PLUGINCHECKTASK_H */