mirror of https://github.com/Icinga/icinga2.git
parent
6bec49bd23
commit
41d4ba169f
|
@ -16,6 +16,6 @@
|
|||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
install(
|
||||
FILES command.conf command-common.conf constants.conf itl.conf timeperiod.conf
|
||||
FILES command.conf command-common.conf itl.conf timeperiod.conf
|
||||
DESTINATION ${CMAKE_INSTALL_DATADIR}/icinga2/itl
|
||||
)
|
||||
|
|
|
@ -1,84 +0,0 @@
|
|||
/******************************************************************************
|
||||
* Icinga 2 *
|
||||
* Copyright (C) 2012-2013 Icinga Development Team (http://www.icinga.org/) *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License *
|
||||
* as published by the Free Software Foundation; either version 2 *
|
||||
* of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the Free Software Foundation *
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
||||
******************************************************************************/
|
||||
|
||||
const StateOK = 0
|
||||
const StateWarning = 1
|
||||
const StateCritical = 2
|
||||
const StateUnknown = 3
|
||||
|
||||
/*
|
||||
* Converting states to their filter values: 1<<state
|
||||
*/
|
||||
const StateFilterOK = (1<<StateOK)
|
||||
const StateFilterWarning = (1<<StateWarning)
|
||||
const StateFilterCritical = (1<<StateCritical)
|
||||
const StateFilterUnknown = (1<<StateUnknown)
|
||||
|
||||
const NotificationDowntimeStart = 0
|
||||
const NotificationDowntimeEnd = 1
|
||||
const NotificationDowntimeRemoved = 2
|
||||
const NotificationCustom = 3
|
||||
const NotificationAcknowledgement = 4
|
||||
const NotificationProblem = 5
|
||||
const NotificationRecovery = 6
|
||||
const NotificationFlappingStart = 7
|
||||
const NotificationFlappingEnd = 8
|
||||
|
||||
/*
|
||||
* Converting notification types to their filter values: 1<<type
|
||||
*/
|
||||
const NotificationFilterDowntimeStart = (1<<NotificationDowntimeStart)
|
||||
const NotificationFilterDowntimeEnd = (1<<NotificationDowntimeEnd)
|
||||
const NotificationFilterDowntimeRemoved = (1<<NotificationDowntimeRemoved)
|
||||
const NotificationFilterCustom = (1<<NotificationCustom)
|
||||
const NotificationFilterAcknowledgement = (1<<NotificationAcknowledgement)
|
||||
const NotificationFilterProblem = (1<<NotificationProblem)
|
||||
const NotificationFilterRecovery = (1<<NotificationRecovery)
|
||||
const NotificationFilterFlappingStart = (1<<NotificationFlappingStart)
|
||||
const NotificationFilterFlappingEnd = (1<<NotificationFlappingEnd)
|
||||
|
||||
/*
|
||||
* Domain privilege flags
|
||||
*/
|
||||
const DomainPrivRead = (1<<0)
|
||||
const DomainPrivCheckResult = (1<<1)
|
||||
const DomainPrivCommand = (1<<2)
|
||||
|
||||
const DomainPrivReadOnly = (DomainPrivRead)
|
||||
const DomainPrivReadWrite = (DomainPrivRead | DomainPrivCheckResult | DomainPrivCommand)
|
||||
|
||||
/*
|
||||
* IDO filter categories
|
||||
*/
|
||||
const DbCatConfig = (1 << 0)
|
||||
const DbCatState = (1 << 1)
|
||||
const DbCatAcknowledgement = (1 << 2)
|
||||
const DbCatComment = (1 << 3)
|
||||
const DbCatDowntime = (1 << 4)
|
||||
const DbCatEventHandler = (1 << 5)
|
||||
const DbCatExternalCommand = (1 << 6)
|
||||
const DbCatFlapping = (1 << 7)
|
||||
const DbCatCheck = (1 << 8)
|
||||
const DbCatLog = (1 << 9)
|
||||
const DbCatNotification = (1 << 10)
|
||||
const DbCatProgramStatus = (1 << 11)
|
||||
const DbCatRetention = (1 << 12)
|
||||
const DbCatStateHistory = (1 << 13)
|
||||
|
||||
const DbCatEverything = (~0)
|
|
@ -22,7 +22,6 @@
|
|||
* configuration templates.
|
||||
*/
|
||||
|
||||
include "constants.conf"
|
||||
include "command.conf"
|
||||
include "command-common.conf"
|
||||
include "timeperiod.conf"
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
#include "base/logger_fwd.h"
|
||||
#include "base/exception.h"
|
||||
#include "base/scriptfunction.h"
|
||||
#include "base/initialize.h"
|
||||
#include "base/scriptvariable.h"
|
||||
#include <fstream>
|
||||
#include <boost/make_shared.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
|
@ -38,12 +40,23 @@
|
|||
using namespace icinga;
|
||||
|
||||
REGISTER_TYPE(DynamicObject);
|
||||
INITIALIZE_ONCE(&DynamicObject::StaticInitialize);
|
||||
|
||||
boost::signals2::signal<void (const DynamicObject::Ptr&)> DynamicObject::OnStarted;
|
||||
boost::signals2::signal<void (const DynamicObject::Ptr&)> DynamicObject::OnStopped;
|
||||
boost::signals2::signal<void (const DynamicObject::Ptr&)> DynamicObject::OnStateChanged;
|
||||
boost::signals2::signal<void (const DynamicObject::Ptr&, const String&, bool)> DynamicObject::OnAuthorityChanged;
|
||||
|
||||
void DynamicObject::StaticInitialize(void)
|
||||
{
|
||||
ScriptVariable::Set("DomainPrivRead", DomainPrivRead, true, true);
|
||||
ScriptVariable::Set("DomainPrivCheckResult", DomainPrivCheckResult, true, true);
|
||||
ScriptVariable::Set("DomainPrivCommand", DomainPrivCommand, true, true);
|
||||
|
||||
ScriptVariable::Set("DomainPrevReadOnly", DomainPrivRead, true, true);
|
||||
ScriptVariable::Set("DomainPrivReadWrite", DomainPrivRead | DomainPrivCheckResult | DomainPrivCommand, true, true);
|
||||
}
|
||||
|
||||
DynamicObject::DynamicObject(void)
|
||||
{ }
|
||||
|
||||
|
|
|
@ -52,6 +52,8 @@ class I2_BASE_API DynamicObject : public ObjectImpl<DynamicObject>
|
|||
public:
|
||||
DECLARE_PTR_TYPEDEFS(DynamicObject);
|
||||
|
||||
static void StaticInitialize(void);
|
||||
|
||||
static boost::signals2::signal<void (const DynamicObject::Ptr&)> OnStarted;
|
||||
static boost::signals2::signal<void (const DynamicObject::Ptr&)> OnStopped;
|
||||
static boost::signals2::signal<void (const DynamicObject::Ptr&)> OnStateChanged;
|
||||
|
|
|
@ -63,7 +63,7 @@ Value ScriptVariable::Get(const String& name)
|
|||
return sv->GetData();
|
||||
}
|
||||
|
||||
ScriptVariable::Ptr ScriptVariable::Set(const String& name, const Value& value, bool overwrite)
|
||||
ScriptVariable::Ptr ScriptVariable::Set(const String& name, const Value& value, bool overwrite, bool make_const)
|
||||
{
|
||||
ScriptVariable::Ptr sv = GetByName(name);
|
||||
|
||||
|
@ -77,6 +77,9 @@ ScriptVariable::Ptr ScriptVariable::Set(const String& name, const Value& value,
|
|||
sv->SetData(value);
|
||||
}
|
||||
|
||||
if (make_const)
|
||||
sv->SetConstant(true);
|
||||
|
||||
return sv;
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ public:
|
|||
static ScriptVariable::Ptr GetByName(const String& name);
|
||||
|
||||
static Value Get(const String& name);
|
||||
static ScriptVariable::Ptr Set(const String& name, const Value& value, bool overwrite = true);
|
||||
static ScriptVariable::Ptr Set(const String& name, const Value& value, bool overwrite = true, bool make_const = false);
|
||||
|
||||
private:
|
||||
Value m_Data;
|
||||
|
|
|
@ -18,5 +18,27 @@
|
|||
******************************************************************************/
|
||||
|
||||
#include "db_ido/dbquery.h"
|
||||
#include "base/initialize.h"
|
||||
#include "base/scriptvariable.h"
|
||||
|
||||
using namespace icinga;
|
||||
|
||||
void DbQuery::StaticInitialize(void)
|
||||
{
|
||||
ScriptVariable::Set("DbCatConfig", DbCatConfig, true, true);
|
||||
ScriptVariable::Set("DbCatState", DbCatState, true, true);
|
||||
ScriptVariable::Set("DbCatAcknowledgement", DbCatAcknowledgement, true, true);
|
||||
ScriptVariable::Set("DbCatComment", DbCatComment, true, true);
|
||||
ScriptVariable::Set("DbCatDowntime", DbCatDowntime, true, true);
|
||||
ScriptVariable::Set("DbCatEventHandler", DbCatEventHandler, true, true);
|
||||
ScriptVariable::Set("DbCatExternalCommand", DbCatExternalCommand, true, true);
|
||||
ScriptVariable::Set("DbCatFlapping", DbCatFlapping, true, true);
|
||||
ScriptVariable::Set("DbCatCheck", DbCatCheck, true, true);
|
||||
ScriptVariable::Set("DbCatLog", DbCatLog, true, true);
|
||||
ScriptVariable::Set("DbCatNotification", DbCatNotification, true, true);
|
||||
ScriptVariable::Set("DbCatProgramStatus", DbCatProgramStatus, true, true);
|
||||
ScriptVariable::Set("DbCatRetention", DbCatRetention, true, true);
|
||||
ScriptVariable::Set("DbCatStateHistory", DbCatStateHistory, true, true);
|
||||
|
||||
ScriptVariable::Set("DbCatEverything", ~(unsigned int)0, true, true);
|
||||
}
|
||||
|
|
|
@ -68,6 +68,8 @@ struct I2_DB_IDO_API DbQuery
|
|||
bool ConfigUpdate;
|
||||
bool StatusUpdate;
|
||||
|
||||
static void StaticInitialize(void);
|
||||
|
||||
DbQuery(void)
|
||||
: Type(0), Category(DbCatInvalid), ConfigUpdate(false), StatusUpdate(false)
|
||||
{ }
|
||||
|
|
|
@ -19,7 +19,24 @@
|
|||
|
||||
#include "icinga/checkresult.h"
|
||||
#include "base/dynamictype.h"
|
||||
#include "base/initialize.h"
|
||||
#include "base/scriptvariable.h"
|
||||
|
||||
using namespace icinga;
|
||||
|
||||
REGISTER_TYPE(CheckResult);
|
||||
INITIALIZE_ONCE(&CheckResult::StaticInitialize);
|
||||
|
||||
void CheckResult::StaticInitialize(void)
|
||||
{
|
||||
ScriptVariable::Set("StateOK", StateOK, true, true);
|
||||
ScriptVariable::Set("StateWarning", StateWarning, true, true);
|
||||
ScriptVariable::Set("StateCritical", StateCritical, true, true);
|
||||
ScriptVariable::Set("StateUnknown", StateUnknown, true, true);
|
||||
|
||||
ScriptVariable::Set("StateFilterOK", 1 << StateOK, true, true);
|
||||
ScriptVariable::Set("StateFilterWarning", 1 << StateWarning, true, true);
|
||||
ScriptVariable::Set("StateFilterCritical", 1 << StateCritical, true, true);
|
||||
ScriptVariable::Set("StateFilterUnknown", 1 << StateUnknown, true, true);
|
||||
}
|
||||
|
||||
|
|
|
@ -35,6 +35,8 @@ class I2_ICINGA_API CheckResult : public ObjectImpl<CheckResult>
|
|||
{
|
||||
public:
|
||||
DECLARE_PTR_TYPEDEFS(CheckResult);
|
||||
|
||||
static void StaticInitialize(void);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -27,14 +27,40 @@
|
|||
#include "base/utility.h"
|
||||
#include "base/convert.h"
|
||||
#include "base/exception.h"
|
||||
#include "base/initialize.h"
|
||||
#include "base/scriptvariable.h"
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
using namespace icinga;
|
||||
|
||||
REGISTER_TYPE(Notification);
|
||||
INITIALIZE_ONCE(&Notification::StaticInitialize);
|
||||
|
||||
boost::signals2::signal<void (const Notification::Ptr&, double, const String&)> Notification::OnNextNotificationChanged;
|
||||
|
||||
void Notification::StaticInitialize(void)
|
||||
{
|
||||
ScriptVariable::Set("NotificationDowntimeStart", NotificationDowntimeStart, true, true);
|
||||
ScriptVariable::Set("NotificationDowntimeEnd", NotificationDowntimeEnd, true, true);
|
||||
ScriptVariable::Set("NotificationDowntimeRemoved", NotificationDowntimeRemoved, true, true);
|
||||
ScriptVariable::Set("NotificationCustom", NotificationCustom, true, true);
|
||||
ScriptVariable::Set("NotificationAcknowledgement", NotificationAcknowledgement, true, true);
|
||||
ScriptVariable::Set("NotificationProblem", NotificationProblem, true, true);
|
||||
ScriptVariable::Set("NotificationRecovery", NotificationRecovery, true, true);
|
||||
ScriptVariable::Set("NotificationFlappingStart", NotificationFlappingStart, true, true);
|
||||
ScriptVariable::Set("NotificationFlappingEnd", NotificationFlappingEnd, true, true);
|
||||
|
||||
ScriptVariable::Set("NotificationFilterDowntimeStart", 1 << NotificationDowntimeStart, true, true);
|
||||
ScriptVariable::Set("NotificationFilterDowntimeEnd", 1 << NotificationDowntimeEnd, true, true);
|
||||
ScriptVariable::Set("NotificationFilterDowntimeRemoved", 1 << NotificationDowntimeRemoved, true, true);
|
||||
ScriptVariable::Set("NotificationFilterCustom", 1 << NotificationCustom, true, true);
|
||||
ScriptVariable::Set("NotificationFilterAcknowledgement", 1 << NotificationAcknowledgement, true, true);
|
||||
ScriptVariable::Set("NotificationFilterProblem", 1 << NotificationProblem, true, true);
|
||||
ScriptVariable::Set("NotificationFilterRecovery", 1 << NotificationRecovery, true, true);
|
||||
ScriptVariable::Set("NotificationFilterFlappingStart", 1 << NotificationFlappingStart, true, true);
|
||||
ScriptVariable::Set("NotificationFilterFlappingEnd", 1 << NotificationFlappingEnd, true, true);
|
||||
}
|
||||
|
||||
void Notification::Start(void)
|
||||
{
|
||||
DynamicObject::Start();
|
||||
|
|
|
@ -62,6 +62,8 @@ public:
|
|||
DECLARE_PTR_TYPEDEFS(Notification);
|
||||
DECLARE_TYPENAME(Notification);
|
||||
|
||||
static void StaticInitialize(void);
|
||||
|
||||
shared_ptr<Service> GetService(void) const;
|
||||
shared_ptr<NotificationCommand> GetNotificationCommand(void) const;
|
||||
TimePeriod::Ptr GetNotificationPeriod(void) const;
|
||||
|
|
Loading…
Reference in New Issue