mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-25 22:54:57 +02:00
Move internal script functions into the 'Internal' namespace
fixes #12338
This commit is contained in:
parent
43c2ec31ef
commit
dc06209e4a
@ -18,6 +18,6 @@
|
|||||||
add_subdirectory(plugins-contrib.d)
|
add_subdirectory(plugins-contrib.d)
|
||||||
|
|
||||||
install(
|
install(
|
||||||
FILES itl command.conf command-icinga.conf hangman timeperiod.conf plugins command-plugins.conf manubulon command-plugins-manubulon.conf windows-plugins command-plugins-windows.conf nscp command-nscp-local.conf plugins-contrib
|
FILES itl command.conf command-icinga.conf hangman plugins command-plugins.conf manubulon command-plugins-manubulon.conf windows-plugins command-plugins-windows.conf nscp command-nscp-local.conf plugins-contrib
|
||||||
DESTINATION ${CMAKE_INSTALL_DATADIR}/icinga2/include
|
DESTINATION ${CMAKE_INSTALL_DATADIR}/icinga2/include
|
||||||
)
|
)
|
||||||
|
1
itl/itl
1
itl/itl
@ -24,4 +24,3 @@
|
|||||||
|
|
||||||
include "command.conf"
|
include "command.conf"
|
||||||
include "command-icinga.conf"
|
include "command-icinga.conf"
|
||||||
include "timeperiod.conf"
|
|
||||||
|
@ -548,7 +548,6 @@ void ConfigObject::RestoreObject(const String& message, int attributeTypes)
|
|||||||
if (!object)
|
if (!object)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ASSERT(!object->IsActive());
|
|
||||||
#ifdef I2_DEBUG
|
#ifdef I2_DEBUG
|
||||||
Log(LogDebug, "ConfigObject")
|
Log(LogDebug, "ConfigObject")
|
||||||
<< "Restoring object '" << name << "' of type '" << type << "'.";
|
<< "Restoring object '" << name << "' of type '" << type << "'.";
|
||||||
|
@ -63,7 +63,16 @@ private:
|
|||||||
Function::Ptr sf = new icinga::Function(WrapFunction(callback)); \
|
Function::Ptr sf = new icinga::Function(WrapFunction(callback)); \
|
||||||
ScriptGlobal::Set(#name, sf); \
|
ScriptGlobal::Set(#name, sf); \
|
||||||
} \
|
} \
|
||||||
INITIALIZE_ONCE(RegisterFunction); \
|
INITIALIZE_ONCE_WITH_PRIORITY(RegisterFunction, 10); \
|
||||||
|
} } }
|
||||||
|
|
||||||
|
#define REGISTER_SCRIPTFUNCTION_NS(ns, name, callback) \
|
||||||
|
namespace { namespace UNIQUE_NAME(sf) { namespace sf ## ns ## name { \
|
||||||
|
void RegisterFunction(void) { \
|
||||||
|
Function::Ptr sf = new icinga::Function(WrapFunction(callback)); \
|
||||||
|
ScriptGlobal::Set(#ns "." #name, sf); \
|
||||||
|
} \
|
||||||
|
INITIALIZE_ONCE_WITH_PRIORITY(RegisterFunction, 10); \
|
||||||
} } }
|
} } }
|
||||||
|
|
||||||
#define REGISTER_SAFE_SCRIPTFUNCTION(name, callback) \
|
#define REGISTER_SAFE_SCRIPTFUNCTION(name, callback) \
|
||||||
@ -72,9 +81,17 @@ private:
|
|||||||
Function::Ptr sf = new icinga::Function(WrapFunction(callback), true); \
|
Function::Ptr sf = new icinga::Function(WrapFunction(callback), true); \
|
||||||
ScriptGlobal::Set(#name, sf); \
|
ScriptGlobal::Set(#name, sf); \
|
||||||
} \
|
} \
|
||||||
INITIALIZE_ONCE(RegisterFunction); \
|
INITIALIZE_ONCE_WITH_PRIORITY(RegisterFunction, 10); \
|
||||||
} } }
|
} } }
|
||||||
|
|
||||||
|
#define REGISTER_SAFE_SCRIPTFUNCTION_NS(ns, name, callback) \
|
||||||
|
namespace { namespace UNIQUE_NAME(sf) { namespace sf ## ns ## name { \
|
||||||
|
void RegisterFunction(void) { \
|
||||||
|
Function::Ptr sf = new icinga::Function(WrapFunction(callback), true); \
|
||||||
|
ScriptGlobal::Set(#ns "." #name, sf); \
|
||||||
|
} \
|
||||||
|
INITIALIZE_ONCE_WITH_PRIORITY(RegisterFunction, 10); \
|
||||||
|
} } }
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* SCRIPTFUNCTION_H */
|
#endif /* SCRIPTFUNCTION_H */
|
||||||
|
@ -68,7 +68,6 @@ private:
|
|||||||
Loader(void);
|
Loader(void);
|
||||||
|
|
||||||
static boost::thread_specific_ptr<std::priority_queue<DeferredInitializer> >& GetDeferredInitializers(void);
|
static boost::thread_specific_ptr<std::priority_queue<DeferredInitializer> >& GetDeferredInitializers(void);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#include "base/objectlock.hpp"
|
#include "base/objectlock.hpp"
|
||||||
#include "base/exception.hpp"
|
#include "base/exception.hpp"
|
||||||
#include <boost/foreach.hpp>
|
#include <boost/foreach.hpp>
|
||||||
|
#include <boost/algorithm/string/split.hpp>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
@ -47,7 +48,33 @@ Value ScriptGlobal::Get(const String& name, const Value *defaultValue)
|
|||||||
|
|
||||||
void ScriptGlobal::Set(const String& name, const Value& value)
|
void ScriptGlobal::Set(const String& name, const Value& value)
|
||||||
{
|
{
|
||||||
m_Globals->Set(name, value);
|
std::vector<String> tokens;
|
||||||
|
boost::algorithm::split(tokens, name, boost::is_any_of("."));
|
||||||
|
|
||||||
|
if (tokens.empty())
|
||||||
|
BOOST_THROW_EXCEPTION(std::invalid_argument("Name must not be empty"));
|
||||||
|
|
||||||
|
{
|
||||||
|
ObjectLock olock(m_Globals);
|
||||||
|
|
||||||
|
Dictionary::Ptr parent = m_Globals;
|
||||||
|
|
||||||
|
for (std::vector<String>::size_type i = 0; i < tokens.size(); i++) {
|
||||||
|
const String& token = tokens[i];
|
||||||
|
|
||||||
|
if (i + 1 != tokens.size()) {
|
||||||
|
if (!parent->Contains(token)) {
|
||||||
|
Dictionary::Ptr dict = new Dictionary();
|
||||||
|
parent->Set(token, dict);
|
||||||
|
parent = dict;
|
||||||
|
} else {
|
||||||
|
parent = parent->Get(token);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
parent->Set(tokens[tokens.size() - 1], value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ScriptGlobal::Exists(const String& name)
|
bool ScriptGlobal::Exists(const String& name)
|
||||||
|
@ -46,9 +46,7 @@ ConfigItem::TypeMap ConfigItem::m_Items;
|
|||||||
ConfigItem::ItemList ConfigItem::m_UnnamedItems;
|
ConfigItem::ItemList ConfigItem::m_UnnamedItems;
|
||||||
ConfigItem::IgnoredItemList ConfigItem::m_IgnoredItems;
|
ConfigItem::IgnoredItemList ConfigItem::m_IgnoredItems;
|
||||||
|
|
||||||
#ifdef I2_DEBUG
|
REGISTER_SCRIPTFUNCTION_NS(Internal, run_with_activation_context, &ConfigItem::RunWithActivationContext);
|
||||||
REGISTER_SCRIPTFUNCTION(__run_with_activation_context, &ConfigItem::RunWithActivationContext);
|
|
||||||
#endif /* I2_DEBUG */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for the ConfigItem class.
|
* Constructor for the ConfigItem class.
|
||||||
@ -534,9 +532,10 @@ bool ConfigItem::CommitNewItems(const ActivationContext::Ptr& context, WorkQueue
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ConfigItem::CommitItems(const ActivationContext::Ptr& context, WorkQueue& upq, std::vector<ConfigItem::Ptr>& newItems)
|
bool ConfigItem::CommitItems(const ActivationContext::Ptr& context, WorkQueue& upq, std::vector<ConfigItem::Ptr>& newItems, bool silent)
|
||||||
{
|
{
|
||||||
Log(LogInformation, "ConfigItem", "Committing config item(s).");
|
if (!silent)
|
||||||
|
Log(LogInformation, "ConfigItem", "Committing config item(s).");
|
||||||
|
|
||||||
if (!CommitNewItems(context, upq, newItems)) {
|
if (!CommitNewItems(context, upq, newItems)) {
|
||||||
upq.ReportExceptions("config");
|
upq.ReportExceptions("config");
|
||||||
@ -550,30 +549,33 @@ bool ConfigItem::CommitItems(const ActivationContext::Ptr& context, WorkQueue& u
|
|||||||
|
|
||||||
ApplyRule::CheckMatches();
|
ApplyRule::CheckMatches();
|
||||||
|
|
||||||
/* log stats for external parsers */
|
if (!silent) {
|
||||||
typedef std::map<Type::Ptr, int> ItemCountMap;
|
/* log stats for external parsers */
|
||||||
ItemCountMap itemCounts;
|
typedef std::map<Type::Ptr, int> ItemCountMap;
|
||||||
BOOST_FOREACH(const ConfigItem::Ptr& item, newItems) {
|
ItemCountMap itemCounts;
|
||||||
if (!item->m_Object)
|
BOOST_FOREACH(const ConfigItem::Ptr& item, newItems) {
|
||||||
continue;
|
if (!item->m_Object)
|
||||||
|
continue;
|
||||||
|
|
||||||
itemCounts[item->m_Object->GetReflectionType()]++;
|
itemCounts[item->m_Object->GetReflectionType()]++;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FOREACH(const ItemCountMap::value_type& kv, itemCounts) {
|
BOOST_FOREACH(const ItemCountMap::value_type& kv, itemCounts) {
|
||||||
Log(LogInformation, "ConfigItem")
|
Log(LogInformation, "ConfigItem")
|
||||||
<< "Instantiated " << kv.second << " " << (kv.second != 1 ? kv.first->GetPluralName() : kv.first->GetName()) << ".";
|
<< "Instantiated " << kv.second << " " << (kv.second != 1 ? kv.first->GetPluralName() : kv.first->GetName()) << ".";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ConfigItem::ActivateItems(WorkQueue& upq, const std::vector<ConfigItem::Ptr>& newItems, bool runtimeCreated)
|
bool ConfigItem::ActivateItems(WorkQueue& upq, const std::vector<ConfigItem::Ptr>& newItems, bool runtimeCreated, bool silent)
|
||||||
{
|
{
|
||||||
static boost::mutex mtx;
|
static boost::mutex mtx;
|
||||||
boost::mutex::scoped_lock lock(mtx);
|
boost::mutex::scoped_lock lock(mtx);
|
||||||
|
|
||||||
Log(LogInformation, "ConfigItem", "Triggering Start signal for config items");
|
if (!silent)
|
||||||
|
Log(LogInformation, "ConfigItem", "Triggering Start signal for config items");
|
||||||
|
|
||||||
BOOST_FOREACH(const ConfigItem::Ptr& item, newItems) {
|
BOOST_FOREACH(const ConfigItem::Ptr& item, newItems) {
|
||||||
if (!item->m_Object)
|
if (!item->m_Object)
|
||||||
@ -609,12 +611,12 @@ bool ConfigItem::ActivateItems(WorkQueue& upq, const std::vector<ConfigItem::Ptr
|
|||||||
}
|
}
|
||||||
#endif /* I2_DEBUG */
|
#endif /* I2_DEBUG */
|
||||||
|
|
||||||
Log(LogInformation, "ConfigItem", "Activated all objects.");
|
if (!silent)
|
||||||
|
Log(LogInformation, "ConfigItem", "Activated all objects.");
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef I2_DEBUG
|
|
||||||
bool ConfigItem::RunWithActivationContext(const Function::Ptr& function)
|
bool ConfigItem::RunWithActivationContext(const Function::Ptr& function)
|
||||||
{
|
{
|
||||||
ActivationScope scope;
|
ActivationScope scope;
|
||||||
@ -629,15 +631,14 @@ bool ConfigItem::RunWithActivationContext(const Function::Ptr& function)
|
|||||||
|
|
||||||
std::vector<ConfigItem::Ptr> newItems;
|
std::vector<ConfigItem::Ptr> newItems;
|
||||||
|
|
||||||
if (!CommitItems(scope.GetContext(), upq, newItems))
|
if (!CommitItems(scope.GetContext(), upq, newItems, true))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!ActivateItems(upq, newItems))
|
if (!ActivateItems(upq, newItems, false, true))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endif /* I2_DEBUG */
|
|
||||||
|
|
||||||
std::vector<ConfigItem::Ptr> ConfigItem::GetItems(const String& type)
|
std::vector<ConfigItem::Ptr> ConfigItem::GetItems(const String& type)
|
||||||
{
|
{
|
||||||
|
@ -68,12 +68,10 @@ public:
|
|||||||
static ConfigItem::Ptr GetByTypeAndName(const String& type,
|
static ConfigItem::Ptr GetByTypeAndName(const String& type,
|
||||||
const String& name);
|
const String& name);
|
||||||
|
|
||||||
static bool CommitItems(const ActivationContext::Ptr& context, WorkQueue& upq, std::vector<ConfigItem::Ptr>& newItems);
|
static bool CommitItems(const ActivationContext::Ptr& context, WorkQueue& upq, std::vector<ConfigItem::Ptr>& newItems, bool silent = false);
|
||||||
static bool ActivateItems(WorkQueue& upq, const std::vector<ConfigItem::Ptr>& newItems, bool runtimeCreated = false);
|
static bool ActivateItems(WorkQueue& upq, const std::vector<ConfigItem::Ptr>& newItems, bool runtimeCreated = false, bool silent = false);
|
||||||
|
|
||||||
#ifdef I2_DEBUG
|
|
||||||
static bool RunWithActivationContext(const Function::Ptr& function);
|
static bool RunWithActivationContext(const Function::Ptr& function);
|
||||||
#endif /* I2_DEBUG */
|
|
||||||
|
|
||||||
static std::vector<ConfigItem::Ptr> GetItems(const String& type);
|
static std::vector<ConfigItem::Ptr> GetItems(const String& type);
|
||||||
|
|
||||||
|
@ -17,10 +17,12 @@
|
|||||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
template CheckCommand "ido-check-command" {
|
assert(Internal.run_with_activation_context(function() {
|
||||||
execute = IdoCheck
|
template CheckCommand "ido-check-command" {
|
||||||
}
|
execute = Internal.IdoCheck
|
||||||
|
}
|
||||||
|
|
||||||
object CheckCommand "ido" {
|
object CheckCommand "ido" {
|
||||||
import "ido-check-command"
|
import "ido-check-command"
|
||||||
}
|
}
|
||||||
|
}))
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
REGISTER_SCRIPTFUNCTION(IdoCheck, &IdoCheckTask::ScriptFunc);
|
REGISTER_SCRIPTFUNCTION_NS(Internal, IdoCheck, &IdoCheckTask::ScriptFunc);
|
||||||
|
|
||||||
void IdoCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr,
|
void IdoCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr,
|
||||||
const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros)
|
const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros)
|
||||||
|
@ -37,13 +37,15 @@ mkclass_target(timeperiod.ti timeperiod.tcpp timeperiod.thpp)
|
|||||||
mkclass_target(usergroup.ti usergroup.tcpp usergroup.thpp)
|
mkclass_target(usergroup.ti usergroup.tcpp usergroup.thpp)
|
||||||
mkclass_target(user.ti user.tcpp user.thpp)
|
mkclass_target(user.ti user.tcpp user.thpp)
|
||||||
|
|
||||||
|
mkembedconfig_target(icinga-itl.conf icinga-itl.cpp)
|
||||||
|
|
||||||
set(icinga_SOURCES
|
set(icinga_SOURCES
|
||||||
apiactions.cpp apievents.cpp checkable.cpp checkable.thpp checkable-dependency.cpp checkable-downtime.cpp checkable-event.cpp
|
apiactions.cpp apievents.cpp checkable.cpp checkable.thpp checkable-dependency.cpp checkable-downtime.cpp checkable-event.cpp
|
||||||
checkable-flapping.cpp checkable-script.cpp checkcommand.cpp checkcommand.thpp checkresult.cpp checkresult.thpp
|
checkable-flapping.cpp checkable-script.cpp checkcommand.cpp checkcommand.thpp checkresult.cpp checkresult.thpp
|
||||||
cib.cpp clusterevents.cpp command.cpp command.thpp comment.cpp comment.thpp compatutility.cpp dependency.cpp dependency.thpp
|
cib.cpp clusterevents.cpp command.cpp command.thpp comment.cpp comment.thpp compatutility.cpp dependency.cpp dependency.thpp
|
||||||
dependency-apply.cpp downtime.cpp downtime.thpp eventcommand.cpp eventcommand.thpp
|
dependency-apply.cpp downtime.cpp downtime.thpp eventcommand.cpp eventcommand.thpp
|
||||||
externalcommandprocessor.cpp host.cpp host.thpp hostgroup.cpp hostgroup.thpp icingaapplication.cpp icingaapplication.thpp
|
externalcommandprocessor.cpp host.cpp host.thpp hostgroup.cpp hostgroup.thpp icingaapplication.cpp icingaapplication.thpp
|
||||||
customvarobject.cpp customvarobject.thpp
|
icinga-itl.cpp customvarobject.cpp customvarobject.thpp
|
||||||
legacytimeperiod.cpp macroprocessor.cpp notificationcommand.cpp notificationcommand.thpp notification.cpp notification.thpp
|
legacytimeperiod.cpp macroprocessor.cpp notificationcommand.cpp notificationcommand.thpp notification.cpp notification.thpp
|
||||||
notification-apply.cpp objectutils.cpp perfdatavalue.cpp perfdatavalue.thpp pluginutility.cpp scheduleddowntime.cpp scheduleddowntime.thpp
|
notification-apply.cpp objectutils.cpp perfdatavalue.cpp perfdatavalue.thpp pluginutility.cpp scheduleddowntime.cpp scheduleddowntime.thpp
|
||||||
scheduleddowntime-apply.cpp service-apply.cpp checkable-check.cpp checkable-comment.cpp
|
scheduleddowntime-apply.cpp service-apply.cpp checkable-check.cpp checkable-comment.cpp
|
||||||
|
@ -17,6 +17,8 @@
|
|||||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
template TimePeriod "legacy-timeperiod" {
|
assert(Internal.run_with_activation_context(function() {
|
||||||
update = LegacyTimePeriod
|
template TimePeriod "legacy-timeperiod" {
|
||||||
}
|
update = Internal.LegacyTimePeriod
|
||||||
|
}
|
||||||
|
}))
|
@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
REGISTER_SCRIPTFUNCTION(LegacyTimePeriod, &LegacyTimePeriod::ScriptFunc);
|
REGISTER_SCRIPTFUNCTION_NS(Internal, LegacyTimePeriod, &LegacyTimePeriod::ScriptFunc);
|
||||||
|
|
||||||
bool LegacyTimePeriod::IsInTimeRange(tm *begin, tm *end, int stride, tm *reference)
|
bool LegacyTimePeriod::IsInTimeRange(tm *begin, tm *end, int stride, tm *reference)
|
||||||
{
|
{
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
REGISTER_SCRIPTFUNCTION(ClrCheck, &ClrCheckTask::ScriptFunc);
|
REGISTER_SCRIPTFUNCTION_NS(Internal, ClrCheck, &ClrCheckTask::ScriptFunc);
|
||||||
|
|
||||||
static boost::once_flag l_OnceFlag = BOOST_ONCE_INIT;
|
static boost::once_flag l_OnceFlag = BOOST_ONCE_INIT;
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
REGISTER_SCRIPTFUNCTION(ClusterCheck, &ClusterCheckTask::ScriptFunc);
|
REGISTER_SCRIPTFUNCTION_NS(Internal, ClusterCheck, &ClusterCheckTask::ScriptFunc);
|
||||||
|
|
||||||
void ClusterCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr,
|
void ClusterCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr,
|
||||||
const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros)
|
const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros)
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
REGISTER_SCRIPTFUNCTION(ClusterZoneCheck, &ClusterZoneCheckTask::ScriptFunc);
|
REGISTER_SCRIPTFUNCTION_NS(Internal, ClusterZoneCheck, &ClusterZoneCheckTask::ScriptFunc);
|
||||||
|
|
||||||
void ClusterZoneCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr,
|
void ClusterZoneCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr,
|
||||||
const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros)
|
const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros)
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
REGISTER_SCRIPTFUNCTION(ExceptionCheck, &ExceptionCheckTask::ScriptFunc);
|
REGISTER_SCRIPTFUNCTION_NS(Internal, ExceptionCheck, &ExceptionCheckTask::ScriptFunc);
|
||||||
|
|
||||||
void ExceptionCheckTask::ScriptFunc(const Checkable::Ptr& service, const CheckResult::Ptr& cr,
|
void ExceptionCheckTask::ScriptFunc(const Checkable::Ptr& service, const CheckResult::Ptr& cr,
|
||||||
const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros)
|
const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros)
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
REGISTER_SCRIPTFUNCTION(IcingaCheck, &IcingaCheckTask::ScriptFunc);
|
REGISTER_SCRIPTFUNCTION_NS(Internal, IcingaCheck, &IcingaCheckTask::ScriptFunc);
|
||||||
|
|
||||||
void IcingaCheckTask::ScriptFunc(const Checkable::Ptr& service, const CheckResult::Ptr& cr,
|
void IcingaCheckTask::ScriptFunc(const Checkable::Ptr& service, const CheckResult::Ptr& cr,
|
||||||
const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros)
|
const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros)
|
||||||
|
@ -17,38 +17,40 @@
|
|||||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
template CheckCommand "icinga-check-command" {
|
assert(Internal.run_with_activation_context(function() {
|
||||||
execute = IcingaCheck
|
template CheckCommand "icinga-check-command" {
|
||||||
}
|
execute = Internal.IcingaCheck
|
||||||
|
}
|
||||||
|
|
||||||
template CheckCommand "cluster-check-command" {
|
template CheckCommand "cluster-check-command" {
|
||||||
execute = ClusterCheck
|
execute = Internal.ClusterCheck
|
||||||
}
|
}
|
||||||
|
|
||||||
template CheckCommand "cluster-zone-check-command" {
|
template CheckCommand "cluster-zone-check-command" {
|
||||||
execute = ClusterZoneCheck
|
execute = Internal.ClusterZoneCheck
|
||||||
}
|
}
|
||||||
|
|
||||||
template CheckCommand "plugin-check-command" {
|
template CheckCommand "plugin-check-command" {
|
||||||
execute = PluginCheck
|
execute = Internal.PluginCheck
|
||||||
}
|
}
|
||||||
|
|
||||||
template CheckCommand "clr-check-command" {
|
template CheckCommand "clr-check-command" {
|
||||||
execute = ClrCheck
|
execute = Internal.ClrCheck
|
||||||
}
|
}
|
||||||
|
|
||||||
template NotificationCommand "plugin-notification-command" {
|
template NotificationCommand "plugin-notification-command" {
|
||||||
execute = PluginNotification
|
execute = Internal.PluginNotification
|
||||||
}
|
}
|
||||||
|
|
||||||
template EventCommand "plugin-event-command" {
|
template EventCommand "plugin-event-command" {
|
||||||
execute = PluginEvent
|
execute = Internal.PluginEvent
|
||||||
}
|
}
|
||||||
|
|
||||||
template CheckCommand "random-check-command" {
|
template CheckCommand "random-check-command" {
|
||||||
execute = RandomCheck
|
execute = Internal.RandomCheck
|
||||||
}
|
}
|
||||||
|
|
||||||
template CheckCommand "exception-check-command" {
|
template CheckCommand "exception-check-command" {
|
||||||
execute = ExceptionCheck
|
execute = Internal.ExceptionCheck
|
||||||
}
|
}
|
||||||
|
}))
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
REGISTER_SCRIPTFUNCTION(NullCheck, &NullCheckTask::ScriptFunc);
|
REGISTER_SCRIPTFUNCTION_NS(Internal, NullCheck, &NullCheckTask::ScriptFunc);
|
||||||
|
|
||||||
void NullCheckTask::ScriptFunc(const Checkable::Ptr& service, const CheckResult::Ptr& cr,
|
void NullCheckTask::ScriptFunc(const Checkable::Ptr& service, const CheckResult::Ptr& cr,
|
||||||
const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros)
|
const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros)
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
REGISTER_SCRIPTFUNCTION(NullEvent, &NullEventTask::ScriptFunc);
|
REGISTER_SCRIPTFUNCTION_NS(Internal, NullEvent, &NullEventTask::ScriptFunc);
|
||||||
|
|
||||||
void NullEventTask::ScriptFunc(const Checkable::Ptr&, const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros)
|
void NullEventTask::ScriptFunc(const Checkable::Ptr&, const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros)
|
||||||
{ }
|
{ }
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
REGISTER_SCRIPTFUNCTION(PluginCheck, &PluginCheckTask::ScriptFunc);
|
REGISTER_SCRIPTFUNCTION_NS(Internal, PluginCheck, &PluginCheckTask::ScriptFunc);
|
||||||
|
|
||||||
void PluginCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr,
|
void PluginCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr,
|
||||||
const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros)
|
const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros)
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
REGISTER_SCRIPTFUNCTION(PluginEvent, &PluginEventTask::ScriptFunc);
|
REGISTER_SCRIPTFUNCTION_NS(Internal, PluginEvent, &PluginEventTask::ScriptFunc);
|
||||||
|
|
||||||
void PluginEventTask::ScriptFunc(const Checkable::Ptr& checkable,
|
void PluginEventTask::ScriptFunc(const Checkable::Ptr& checkable,
|
||||||
const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros)
|
const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros)
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
REGISTER_SCRIPTFUNCTION(PluginNotification, &PluginNotificationTask::ScriptFunc);
|
REGISTER_SCRIPTFUNCTION_NS(Internal, PluginNotification, &PluginNotificationTask::ScriptFunc);
|
||||||
|
|
||||||
void PluginNotificationTask::ScriptFunc(const Notification::Ptr& notification,
|
void PluginNotificationTask::ScriptFunc(const Notification::Ptr& notification,
|
||||||
const User::Ptr& user, const CheckResult::Ptr& cr, int itype,
|
const User::Ptr& user, const CheckResult::Ptr& cr, int itype,
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
REGISTER_SCRIPTFUNCTION(RandomCheck, &RandomCheckTask::ScriptFunc);
|
REGISTER_SCRIPTFUNCTION_NS(Internal, RandomCheck, &RandomCheckTask::ScriptFunc);
|
||||||
|
|
||||||
void RandomCheckTask::ScriptFunc(const Checkable::Ptr& service, const CheckResult::Ptr& cr,
|
void RandomCheckTask::ScriptFunc(const Checkable::Ptr& service, const CheckResult::Ptr& cr,
|
||||||
const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros)
|
const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros)
|
||||||
|
@ -22,8 +22,8 @@
|
|||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
REGISTER_SCRIPTFUNCTION(EmptyTimePeriod, &TimePeriodTask::EmptyTimePeriodUpdate);
|
REGISTER_SCRIPTFUNCTION_NS(Internal, EmptyTimePeriod, &TimePeriodTask::EmptyTimePeriodUpdate);
|
||||||
REGISTER_SCRIPTFUNCTION(EvenMinutesTimePeriod, &TimePeriodTask::EvenMinutesTimePeriodUpdate);
|
REGISTER_SCRIPTFUNCTION_NS(Internal, EvenMinutesTimePeriod, &TimePeriodTask::EvenMinutesTimePeriodUpdate);
|
||||||
|
|
||||||
Array::Ptr TimePeriodTask::EmptyTimePeriodUpdate(const TimePeriod::Ptr&, double, double)
|
Array::Ptr TimePeriodTask::EmptyTimePeriodUpdate(const TimePeriod::Ptr&, double, double)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user