mirror of https://github.com/Icinga/icinga2.git
parent
cc8fe684fe
commit
ec99efbc28
|
@ -18,14 +18,17 @@
|
|||
******************************************************************************/
|
||||
|
||||
#include "icinga/checkable.hpp"
|
||||
#include "config/configcompilercontext.hpp"
|
||||
#include "base/objectlock.hpp"
|
||||
#include "base/utility.hpp"
|
||||
#include "base/scriptfunction.hpp"
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/bind/apply.hpp>
|
||||
|
||||
using namespace icinga;
|
||||
|
||||
REGISTER_TYPE(Checkable);
|
||||
REGISTER_SCRIPTFUNCTION(ValidateCheckableCheckInterval, &Checkable::ValidateCheckInterval);
|
||||
|
||||
boost::signals2::signal<void (const Checkable::Ptr&, bool, const MessageOrigin&)> Checkable::OnEnablePerfdataChanged;
|
||||
boost::signals2::signal<void (const Checkable::Ptr&, const String&, const String&, AcknowledgementType, double, const MessageOrigin&)> Checkable::OnAcknowledgementSet;
|
||||
|
@ -263,3 +266,11 @@ Endpoint::Ptr Checkable::GetCommandEndpoint(void) const
|
|||
{
|
||||
return Endpoint::GetByName(GetCommandEndpointRaw());
|
||||
}
|
||||
|
||||
void Checkable::ValidateCheckInterval(const String& location, const Checkable::Ptr& object)
|
||||
{
|
||||
if (object->GetCheckInterval() <= 0) {
|
||||
ConfigCompilerContext::GetInstance()->AddMessage(true, "Validation failed for " +
|
||||
location + ": check_interval must be greater than 0.");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -276,6 +276,8 @@ public:
|
|||
void RemoveReverseDependency(const intrusive_ptr<Dependency>& dep);
|
||||
std::set<intrusive_ptr<Dependency> > GetReverseDependencies(void) const;
|
||||
|
||||
static void ValidateCheckInterval(const String& location, const Checkable::Ptr& object);
|
||||
|
||||
protected:
|
||||
virtual void Start(void);
|
||||
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
}
|
||||
|
||||
%type Checkable {
|
||||
%validator "ValidateCheckableCheckInterval",
|
||||
|
||||
%attribute %string "display_name",
|
||||
|
||||
%require "check_command",
|
||||
|
|
Loading…
Reference in New Issue