mirror of https://github.com/Icinga/icinga2.git
Merge branch 'feature/cv-mod-attr-5956' into next
Fixes #5956 Fixes #5962 Fixes #5609
This commit is contained in:
commit
d930b1e72e
|
@ -34,7 +34,7 @@ Debian packages use `nagios` as the default user and group name. Therefore chang
|
|||
|
||||
### <a id="external-command-list"></a> External Command List
|
||||
|
||||
A list of currently supported external commands can be found on the
|
||||
[Icinga Wiki](https://wiki.icinga.org/display/icinga2/External+Commands).
|
||||
A list of currently supported external commands can be found [here](#external-commands-list-detail)
|
||||
|
||||
Detailed information on the commands and their required parameters can be found
|
||||
on the [Icinga 1.x documentation](http://docs.icinga.org/latest/en/extcommands2.html).
|
||||
|
|
|
@ -82,6 +82,8 @@ A detailed list which table attributes are supported can be found here: [https:/
|
|||
|
||||
#### <a id="schema-livestatus-command-queries"></a> Livestatus COMMAND Queries
|
||||
|
||||
A list of available external commands and their parameters can be found [here](#external-commands-list-detail)
|
||||
|
||||
$ echo -e 'COMMAND <externalcommandstring>' | netcat 127.0.0.1 6558
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,147 @@
|
|||
## <a id="external-commands-list-detail"></a> External Commands List
|
||||
|
||||
Additional details can be found in the [Icinga 1.x Documentation](http://docs.icinga.org/latest/en/extcommands2.html)
|
||||
|
||||
Command name | Parameters | Description
|
||||
------------------------------------------|-----------------------------------|--------------------------
|
||||
PROCESS_HOST_CHECK_RESULT | ;<host_name>;<status_code>;<plugin_output> (3) |
|
||||
PROCESS_SERVICE_CHECK_RESULT | ;<host_name>;<service_name>;<return_code>;<plugin_output> (4) |
|
||||
SCHEDULE_HOST_CHECK | ;<host_name>;<check_time> (2) |
|
||||
SCHEDULE_FORCED_HOST_CHECK | ;<host_name>;<check_time> (2) |
|
||||
SCHEDULE_SVC_CHECK | ;<host_name>;<service_name>;<check_time> (3) |
|
||||
SCHEDULE_FORCED_SVC_CHECK | ;<host_name>;<service_name>;<check_time> (3) |
|
||||
ENABLE_HOST_CHECK | ;<host_name> (1) |
|
||||
DISABLE_HOST_CHECK | ;<host_name> (1) |
|
||||
ENABLE_SVC_CHECK | ;<host_name>;<service_name> (2) |
|
||||
DISABLE_SVC_CHECK | ;<host_name>;<service_name> (2) |
|
||||
SHUTDOWN_PROCESS | (0) |
|
||||
RESTART_PROCESS | (0) |
|
||||
SCHEDULE_FORCED_HOST_SVC_CHECKS | ;<host_name>;<check_time> (2) |
|
||||
SCHEDULE_HOST_SVC_CHECKS | ;<host_name>;<check_time> (2) |
|
||||
ENABLE_HOST_SVC_CHECKS | ;<host_name> (1) |
|
||||
DISABLE_HOST_SVC_CHECKS | ;<host_name> (1) |
|
||||
ACKNOWLEDGE_SVC_PROBLEM | ;<host_name>;<service_name>;<sticky>;<notify>;<persistent>;<author>;<comment> (7) |
|
||||
ACKNOWLEDGE_SVC_PROBLEM_EXPIRE | ;<host_name>;<service_name>;<sticky>;<notify>;<persistent>;<timestamp>;<author>;<comment> (8) |
|
||||
REMOVE_SVC_ACKNOWLEDGEMENT | ;<host_name>;<service_name> (2) |
|
||||
ACKNOWLEDGE_HOST_PROBLEM | ;<host_name>;<sticky>;<notify>;<persistent>;<author>;<comment> (6) |
|
||||
ACKNOWLEDGE_HOST_PROBLEM_EXPIRE | ;<host_name>;<sticky>;<notify>;<persistent>;<timestamp>;<author>;<comment> (7) |
|
||||
REMOVE_HOST_ACKNOWLEDGEMENT | ;<host_name> (1) |
|
||||
DISABLE_HOST_FLAP_DETECTION | ;<host_name> (1) |
|
||||
ENABLE_HOST_FLAP_DETECTION | ;<host_name> (1) |
|
||||
DISABLE_SVC_FLAP_DETECTION | ;<host_name>;<service_name> (2) |
|
||||
ENABLE_SVC_FLAP_DETECTION | ;<host_name>;<service_name> (2) |
|
||||
ENABLE_HOSTGROUP_SVC_CHECKS | ;<hostgroup_name> (1) |
|
||||
DISABLE_HOSTGROUP_SVC_CHECKS | ;<hostgroup_name> (1) |
|
||||
ENABLE_SERVICEGROUP_SVC_CHECKS | ;<servicegroup_name> (1) |
|
||||
DISABLE_SERVICEGROUP_SVC_CHECKS | ;<servicegroup_name> (1) |
|
||||
ENABLE_PASSIVE_HOST_CHECKS | ;<host_name> (1) |
|
||||
DISABLE_PASSIVE_HOST_CHECKS | ;<host_name> (1) |
|
||||
ENABLE_PASSIVE_SVC_CHECKS | ;<host_name>;<service_name> (2) |
|
||||
DISABLE_PASSIVE_SVC_CHECKS | ;<host_name>;<service_name> (2) |
|
||||
ENABLE_SERVICEGROUP_PASSIVE_SVC_CHECKS | ;<servicegroup_name> (1) |
|
||||
DISABLE_SERVICEGROUP_PASSIVE_SVC_CHECKS | ;<servicegroup_name> (1) |
|
||||
ENABLE_HOSTGROUP_PASSIVE_SVC_CHECKS | ;<hostgroup_name> (1) |
|
||||
DISABLE_HOSTGROUP_PASSIVE_SVC_CHECKS | ;<hostgroup_name> (1) |
|
||||
PROCESS_FILE | ;<file_name>;<delete> (2) |
|
||||
SCHEDULE_SVC_DOWNTIME | ;<host_name>;<service_name>;<start_time>;<end_time>;<fixed>;<trigger_id>;<duration>;<author>;<comment> (9) |
|
||||
DEL_SVC_DOWNTIME | ;<downtime_id> (1) |
|
||||
SCHEDULE_HOST_DOWNTIME | ;<host_name>;<start_time>;<end_time>;<fixed>;<trigger_id>;<duration>;<author>;<comment> (8) |
|
||||
DEL_HOST_DOWNTIME | ;<downtime_id> (1) |
|
||||
SCHEDULE_HOST_SVC_DOWNTIME | ;<host_name>;<start_time>;<end_time>;<fixed>;<trigger_id>;<duration>;<author>;<comment> (8) |
|
||||
SCHEDULE_HOSTGROUP_HOST_DOWNTIME | ;<hostgroup_name>;<start_time>;<end_time>;<fixed>;<trigger_id>;<duration>;<author>;<comment> (8) |
|
||||
SCHEDULE_HOSTGROUP_SVC_DOWNTIME | ;<hostgroup_name>;<start_time>;<end_time>;<fixed>;<trigger_id>;<duration>;<author>;<comment> (8) |
|
||||
SCHEDULE_SERVICEGROUP_HOST_DOWNTIME | ;<servicegroup_name>;<start_time>;<end_time>;<fixed>;<trigger_id>;<duration>;<author>;<comment> (8) |
|
||||
SCHEDULE_SERVICEGROUP_SVC_DOWNTIME | ;<servicegroup_name>;<start_time>;<end_time>;<fixed>;<trigger_id>;<duration>;<author>;<comment> (8) |
|
||||
ADD_HOST_COMMENT | ;<host_name>;<persistent>;<author>;<comment> (4) |
|
||||
DEL_HOST_COMMENT | ;<comment_id> (1) |
|
||||
ADD_SVC_COMMENT | ;<host_name>;<service_name>;<persistent>;<author>;<comment> (5) |
|
||||
DEL_SVC_COMMENT | ;<comment_id> (1) |
|
||||
DEL_ALL_HOST_COMMENTS | ;<host_name> (1) |
|
||||
DEL_ALL_SVC_COMMENTS | ;<host_name>;<service_name> (2) |
|
||||
SEND_CUSTOM_HOST_NOTIFICATION | ;<host_name>;<options>;<author>;<comment> (4) |
|
||||
SEND_CUSTOM_SVC_NOTIFICATION | ;<host_name>;<service_name>;<options>;<author>;<comment> (5) |
|
||||
DELAY_HOST_NOTIFICATION | ;<host_name>;<notification_time> (2) |
|
||||
DELAY_SVC_NOTIFICATION | ;<host_name>;<service_name>;<notification_time> (3) |
|
||||
ENABLE_HOST_NOTIFICATIONS | ;<host_name> (1) |
|
||||
DISABLE_HOST_NOTIFICATIONS | ;<host_name> (1) |
|
||||
ENABLE_SVC_NOTIFICATIONS | ;<host_name>;<service_name> (2) |
|
||||
DISABLE_SVC_NOTIFICATIONS | ;<host_name>;<service_name> (2) |
|
||||
DISABLE_HOSTGROUP_HOST_CHECKS | ;<hostgroup_name> (1) |
|
||||
DISABLE_HOSTGROUP_PASSIVE_HOST_CHECKS | ;<hostgroup_name> (1) |
|
||||
DISABLE_SERVICEGROUP_HOST_CHECKS | ;<servicegroup_name> (1) |
|
||||
DISABLE_SERVICEGROUP_PASSIVE_HOST_CHECKS | ;<servicegroup_name> (1) |
|
||||
ENABLE_HOSTGROUP_HOST_CHECKS | ;<hostgroup_name> (1) |
|
||||
ENABLE_HOSTGROUP_PASSIVE_HOST_CHECKS | ;<hostgroup_name> (1) |
|
||||
ENABLE_SERVICEGROUP_HOST_CHECKS | ;<servicegroup_name> (1) |
|
||||
ENABLE_SERVICEGROUP_PASSIVE_HOST_CHECKS | ;<servicegroup_name> (1) |
|
||||
ENABLE_NOTIFICATIONS | (0) |
|
||||
DISABLE_NOTIFICATIONS | (0) |
|
||||
ENABLE_FLAP_DETECTION | (0) |
|
||||
DISABLE_FLAP_DETECTION | (0) |
|
||||
ENABLE_EVENT_HANDLERS | (0) |
|
||||
DISABLE_EVENT_HANDLERS | (0) |
|
||||
ENABLE_PERFORMANCE_DATA | (0) |
|
||||
DISABLE_PERFORMANCE_DATA | (0) |
|
||||
START_EXECUTING_HOST_CHECKS | (0) |
|
||||
STOP_EXECUTING_HOST_CHECKS | (0) |
|
||||
START_EXECUTING_SVC_CHECKS | (0) |
|
||||
STOP_EXECUTING_SVC_CHECKS | (0) |
|
||||
CHANGE_SVC_MODATTR | ;<host_name>;<service_name>;<value> (3) |
|
||||
CHANGE_HOST_MODATTR | ;<host_name>;<value> (2) |
|
||||
CHANGE_NORMAL_SVC_CHECK_INTERVAL | ;<host_name>;<service_name>;<check_interval> (3) |
|
||||
CHANGE_NORMAL_HOST_CHECK_INTERVAL | ;<host_name>;<check_interval> (2) |
|
||||
CHANGE_RETRY_SVC_CHECK_INTERVAL | ;<host_name>;<service_name>;<check_interval> (3) |
|
||||
CHANGE_RETRY_HOST_CHECK_INTERVAL | ;<host_name>;<check_interval> (2) |
|
||||
ENABLE_HOST_EVENT_HANDLER | ;<host_name> (1) |
|
||||
DISABLE_HOST_EVENT_HANDLER | ;<host_name> (1) |
|
||||
ENABLE_SVC_EVENT_HANDLER | ;<host_name>;<service_name> (2) |
|
||||
DISABLE_SVC_EVENT_HANDLER | ;<host_name>;<service_name> (2) |
|
||||
CHANGE_HOST_EVENT_HANDLER | ;<host_name>;<event_command_name> (2) |
|
||||
CHANGE_SVC_EVENT_HANDLER | ;<host_name>;<service_name>;<event_command_name> (3) |
|
||||
CHANGE_HOST_CHECK_COMMAND | ;<host_name>;<check_command_name> (2) |
|
||||
CHANGE_SVC_CHECK_COMMAND | ;<host_name>;<service_name>;<check_command_name> (3) |
|
||||
CHANGE_MAX_HOST_CHECK_ATTEMPTS | ;<host_name>;<check_attempts> (2) |
|
||||
CHANGE_MAX_SVC_CHECK_ATTEMPTS | ;<host_name>;<service_name>;<check_attempts> (3) |
|
||||
CHANGE_HOST_CHECK_TIMEPERIOD | ;<host_name>;<timeperiod_name> (2) |
|
||||
CHANGE_SVC_CHECK_TIMEPERIOD | ;<host_name>;<service_name>;<timeperiod_name> |
|
||||
CHANGE_CUSTOM_HOST_VAR | ;<host_name>;<var_name>;<var_value> (3) |
|
||||
CHANGE_CUSTOM_SVC_VAR | ;<host_name>;<service_name>;<var_name>;<var_value> (4) |
|
||||
CHANGE_CUSTOM_USER_VAR | ;<user_name>;<var_name>;<var_value> (3) |
|
||||
CHANGE_CUSTOM_CHECKCOMMAND_VAR | ;<check_command_name>;<var_name>;<var_value> (3) |
|
||||
CHANGE_CUSTOM_EVENTCOMMAND_VAR | ;<event_command_name>;<var_name>;<var_value> (3) |
|
||||
CHANGE_CUSTOM_NOTIFICATIONCOMMAND_VAR | ;<notification_command_name>;<var_name>;<var_value> (3) |
|
||||
ENABLE_HOSTGROUP_HOST_NOTIFICATIONS | ;<hostgroup_name> (1) |
|
||||
ENABLE_HOSTGROUP_SVC_NOTIFICATIONS | ;<hostgroup_name> (1) |
|
||||
DISABLE_HOSTGROUP_HOST_NOTIFICATIONS | ;<hostgroup_name> (1) |
|
||||
DISABLE_HOSTGROUP_SVC_NOTIFICATIONS | ;<hostgroup_name> (1) |
|
||||
ENABLE_SERVICEGROUP_HOST_NOTIFICATIONS | ;<servicegroup_name> (1) |
|
||||
DISABLE_SERVICEGROUP_HOST_NOTIFICATIONS | ;<servicegroup_name> (1) |
|
||||
ENABLE_SERVICEGROUP_SVC_NOTIFICATIONS | ;<servicegroup_name> (1) |
|
||||
DISABLE_SERVICEGROUP_SVC_NOTIFICATIONS | ;<servicegroup_name> (1) |
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -165,24 +165,15 @@ account by Icinga 1.x Classic UI and Web.
|
|||
## <a id="differences-1x-2-custom-attributes"></a> Custom Attributes
|
||||
|
||||
Icinga 2 allows you to define custom attributes in the `vars` dictionary.
|
||||
|
||||
### <a id="differences-1x-2-action-url-notes-url-notes"></a> Action Url, Notes Url, Notes
|
||||
|
||||
Icinga 1.x objects support configuration attributes not required as runtime
|
||||
values but for external resources such as Icinga 1.x Classic UI or Web.
|
||||
The `notes`, `notes_url`, `action_url`, `icon_image`, `icon_image_alt`
|
||||
attributes for host and service objects, additionally `statusmap_image` and
|
||||
`2d_coords` for the host's representation in status maps.
|
||||
attributes for host and service objects are still available in Icinga 2.
|
||||
|
||||
### <a id="differences-1x-2-action-url-notes-url-notes"></a> Statusmap Image, 2D Coords
|
||||
|
||||
These attributes can be set using the `vars` dictionary in Icinga 2 `Host`
|
||||
or `Service` objects:
|
||||
|
||||
vars = {
|
||||
notes = "Icinga 2 is the best!"
|
||||
notes_url = "http://docs.icinga.org"
|
||||
action_url = "http://dev.icinga.org"
|
||||
icon_image = "../../images/logos/Stats2.png"
|
||||
icon_image_alt = "icinga2 alt icon text"
|
||||
"2d_coords" = "1,2"
|
||||
statusmap_image = "../../images/logos/icinga.gif"
|
||||
}
|
||||
|
@ -227,8 +218,6 @@ and their users.
|
|||
|
||||
## <a id="differences-1x-2-macros"></a> Macros
|
||||
|
||||
TODO
|
||||
|
||||
Various object attributes and runtime variables can be accessed as macros in
|
||||
commands in Icinga 1.x - Icinga 2 supports all required [custom attributes](#custom-attributes).
|
||||
|
||||
|
@ -270,8 +259,6 @@ With the freely definable custom attributes in Icinga 2 it looks like this:
|
|||
|
||||
### <a id="differences-1x-2-environment-macros"></a> Environment Macros
|
||||
|
||||
TODO
|
||||
|
||||
The global configuration setting `enable_environment_macros` does not exist in
|
||||
Icinga 2.
|
||||
|
||||
|
@ -353,6 +340,57 @@ Changes to global runtime macros:
|
|||
TIME | icinga.time
|
||||
|
||||
|
||||
## <a id="differences-1x-2-external-commands"></a> External Commands
|
||||
|
||||
`CHANGE_CUSTOM_CONTACT_VAR` was renamed to `CHANGE_CUSTOM_USER_VAR`.
|
||||
|
||||
The following external commands are not supported:
|
||||
|
||||
CHANGE_CONTACT_HOST_NOTIFICATION_TIMEPERIOD
|
||||
CHANGE_HOST_NOTIFICATION_TIMEPERIOD
|
||||
CHANGE_SVC_NOTIFICATION_TIMEPERIOD
|
||||
DEL_DOWNTIME_BY_HOSTGROUP_NAME
|
||||
DEL_DOWNTIME_BY_START_TIME_COMMENT
|
||||
DISABLE_ALL_NOTIFICATIONS_BEYOND_HOST
|
||||
DISABLE_CONTACT_HOST_NOTIFICATIONS
|
||||
DISABLE_CONTACT_SVC_NOTIFICATIONS
|
||||
DISABLE_CONTACTGROUP_HOST_NOTIFICATIONS
|
||||
DISABLE_CONTACTGROUP_SVC_NOTIFICATIONS
|
||||
DISABLE_FAILURE_PREDICTION
|
||||
DISABLE_HOST_AND_CHILD_NOTIFICATIONS
|
||||
DISABLE_HOST_FRESHNESS_CHECKS
|
||||
DISABLE_HOST_SVC_NOTIFICATIONS
|
||||
DISABLE_NOTIFICATIONS_EXPIRE_TIME
|
||||
DISABLE_SERVICE_FRESHNESS_CHECKS
|
||||
ENABLE_ALL_NOTIFICATIONS_BEYOND_HOST
|
||||
ENABLE_CONTACT_HOST_NOTIFICATIONS
|
||||
ENABLE_CONTACT_SVC_NOTIFICATIONS
|
||||
ENABLE_CONTACTGROUP_HOST_NOTIFICATIONS
|
||||
ENABLE_CONTACTGROUP_SVC_NOTIFICATIONS
|
||||
ENABLE_FAILURE_PREDICTION
|
||||
ENABLE_HOST_AND_CHILD_NOTIFICATIONS
|
||||
ENABLE_HOST_FRESHNESS_CHECKS
|
||||
ENABLE_HOST_SVC_NOTIFICATIONS
|
||||
ENABLE_SERVICE_FRESHNESS_CHECKS
|
||||
READ_STATE_INFORMATION
|
||||
SAVE_STATE_INFORMATION
|
||||
SCHEDULE_AND_PROPAGATE_HOST_DOWNTIME
|
||||
SCHEDULE_AND_PROPAGATE_TRIGGERED_HOST_DOWNTIME
|
||||
SET_HOST_NOTIFICATION_NUMBER
|
||||
SET_SVC_NOTIFICATION_NUMBER
|
||||
START_ACCEPTING_PASSIVE_HOST_CHECKS
|
||||
START_ACCEPTING_PASSIVE_SVC_CHECKS
|
||||
START_OBSESSING_OVER_HOST
|
||||
START_OBSESSING_OVER_HOST_CHECKS
|
||||
START_OBSESSING_OVER_SVC
|
||||
START_OBSESSING_OVER_SVC_CHECKS
|
||||
STOP_ACCEPTING_PASSIVE_HOST_CHECKS
|
||||
STOP_ACCEPTING_PASSIVE_SVC_CHECKS
|
||||
STOP_OBSESSING_OVER_HOST
|
||||
STOP_OBSESSING_OVER_HOST_CHECKS
|
||||
STOP_OBSESSING_OVER_SVC
|
||||
STOP_OBSESSING_OVER_SVC_CHECKS
|
||||
|
||||
## <a id="differences-1x-2-checks"></a> Checks
|
||||
|
||||
### <a id="differences-1x-2-check-output"></a> Check Output
|
||||
|
|
|
@ -46,6 +46,7 @@ boost::signals2::signal<void (const DynamicObject::Ptr&)> DynamicObject::OnStart
|
|||
boost::signals2::signal<void (const DynamicObject::Ptr&)> DynamicObject::OnStopped;
|
||||
boost::signals2::signal<void (const DynamicObject::Ptr&, const String&)> DynamicObject::OnStateChanged;
|
||||
boost::signals2::signal<void (const DynamicObject::Ptr&, const String&, bool)> DynamicObject::OnAuthorityChanged;
|
||||
boost::signals2::signal<void (const DynamicObject::Ptr&)> DynamicObject::OnVarsChanged;
|
||||
|
||||
void DynamicObject::StaticInitialize(void)
|
||||
{
|
||||
|
@ -361,3 +362,31 @@ DynamicObject::Ptr DynamicObject::GetObject(const String& type, const String& na
|
|||
DynamicType::Ptr dtype = DynamicType::GetByName(type);
|
||||
return dtype->GetObject(name);
|
||||
}
|
||||
|
||||
|
||||
Dictionary::Ptr DynamicObject::GetVars(void) const
|
||||
{
|
||||
if (!GetOverrideVars().IsEmpty())
|
||||
return GetOverrideVars();
|
||||
else
|
||||
return GetVarsRaw();
|
||||
}
|
||||
|
||||
void DynamicObject::SetVars(const Dictionary::Ptr& vars, const String& authority)
|
||||
{
|
||||
SetOverrideVars(vars);
|
||||
|
||||
Log(LogDebug, "base", "Setting vars for object '" + GetName() + "'");
|
||||
|
||||
OnVarsChanged(GetSelf());
|
||||
}
|
||||
|
||||
bool DynamicObject::IsVarOverridden(const String& name)
|
||||
{
|
||||
Dictionary::Ptr vars_override = GetOverrideVars();
|
||||
|
||||
if (!vars_override)
|
||||
return false;
|
||||
|
||||
return vars_override->Contains(name);
|
||||
}
|
||||
|
|
|
@ -58,6 +58,7 @@ public:
|
|||
static boost::signals2::signal<void (const DynamicObject::Ptr&)> OnStopped;
|
||||
static boost::signals2::signal<void (const DynamicObject::Ptr&, const String&)> OnStateChanged;
|
||||
static boost::signals2::signal<void (const DynamicObject::Ptr&, const String&, bool)> OnAuthorityChanged;
|
||||
static boost::signals2::signal<void (const DynamicObject::Ptr&)> OnVarsChanged;
|
||||
|
||||
Value InvokeMethod(const String& method, const std::vector<Value>& arguments);
|
||||
|
||||
|
@ -75,6 +76,11 @@ public:
|
|||
Object::Ptr GetExtension(const String& key);
|
||||
void ClearExtension(const String& key);
|
||||
|
||||
Dictionary::Ptr GetVars(void) const;
|
||||
void SetVars(const Dictionary::Ptr& vars, const String& authority = String());
|
||||
|
||||
bool IsVarOverridden(const String& name);
|
||||
|
||||
void Register(void);
|
||||
|
||||
void Activate(void);
|
||||
|
|
|
@ -22,7 +22,7 @@ abstract class DynamicObject
|
|||
[config, get_protected] String type (TypeName);
|
||||
[config, get_protected] Array::Ptr templates;
|
||||
[config] Dictionary::Ptr methods;
|
||||
[config] Dictionary::Ptr vars;
|
||||
[config] Dictionary::Ptr vars (VarsRaw);
|
||||
[config] Array::Ptr domains;
|
||||
[config] Array::Ptr authorities;
|
||||
[get_protected] bool active;
|
||||
|
@ -30,6 +30,8 @@ abstract class DynamicObject
|
|||
[get_protected] bool stop_called;
|
||||
Dictionary::Ptr authority_info;
|
||||
[protected] Dictionary::Ptr extensions;
|
||||
|
||||
[state] Value override_vars;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -137,3 +137,4 @@ boost::mutex& DynamicType::GetStaticMutex(void)
|
|||
static boost::mutex mutex;
|
||||
return mutex;
|
||||
}
|
||||
|
||||
|
|
|
@ -53,35 +53,5 @@ Dictionary::Ptr CommandDbObject::GetStatusFields(void) const
|
|||
|
||||
void CommandDbObject::OnConfigUpdate(void)
|
||||
{
|
||||
Command::Ptr command = static_pointer_cast<Command>(GetObject());
|
||||
|
||||
Dictionary::Ptr vars = command->GetVars();
|
||||
|
||||
if (!vars)
|
||||
return;
|
||||
|
||||
Log(LogDebug, "db_ido", "Dumping command vars for '" + command->GetName() + "'");
|
||||
|
||||
ObjectLock olock(vars);
|
||||
|
||||
BOOST_FOREACH(const Dictionary::Pair& kv, vars) {
|
||||
if (!kv.first.IsEmpty()) {
|
||||
Log(LogDebug, "db_ido", "command customvar key: '" + kv.first + "' value: '" + Convert::ToString(kv.second) + "'");
|
||||
|
||||
Dictionary::Ptr fields1 = make_shared<Dictionary>();
|
||||
fields1->Set("varname", Convert::ToString(kv.first));
|
||||
fields1->Set("varvalue", Convert::ToString(kv.second));
|
||||
fields1->Set("config_type", 1);
|
||||
fields1->Set("has_been_modified", 0);
|
||||
fields1->Set("object_id", command);
|
||||
fields1->Set("instance_id", 0); /* DbConnection class fills in real ID */
|
||||
|
||||
DbQuery query1;
|
||||
query1.Table = "customvariables";
|
||||
query1.Type = DbQueryInsert;
|
||||
query1.Category = DbCatConfig;
|
||||
query1.Fields = fields1;
|
||||
OnQuery(query1);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -21,8 +21,11 @@
|
|||
#include "db_ido/dbtype.h"
|
||||
#include "db_ido/dbvalue.h"
|
||||
#include "icinga/service.h"
|
||||
#include "icinga/compatutility.h"
|
||||
#include "remote/endpoint.h"
|
||||
#include "base/dynamicobject.h"
|
||||
#include "base/dynamictype.h"
|
||||
#include "base/convert.h"
|
||||
#include "base/objectlock.h"
|
||||
#include "base/utility.h"
|
||||
#include "base/initialize.h"
|
||||
|
@ -43,6 +46,7 @@ void DbObject::StaticInitialize(void)
|
|||
{
|
||||
/* triggered in ProcessCheckResult(), requires UpdateNextCheck() to be called before */
|
||||
DynamicObject::OnStateChanged.connect(boost::bind(&DbObject::StateChangedHandler, _1));
|
||||
DynamicObject::OnVarsChanged.connect(boost::bind(&DbObject::VarsChangedHandler, _1));
|
||||
}
|
||||
|
||||
void DbObject::SetObject(const DynamicObject::Ptr& object)
|
||||
|
@ -72,6 +76,10 @@ DbType::Ptr DbObject::GetType(void) const
|
|||
|
||||
void DbObject::SendConfigUpdate(void)
|
||||
{
|
||||
/* update custom var config for all objects */
|
||||
SendVarsConfigUpdate();
|
||||
|
||||
/* config objects */
|
||||
Dictionary::Ptr fields = GetConfigFields();
|
||||
|
||||
if (!fields)
|
||||
|
@ -98,6 +106,10 @@ void DbObject::SendConfigUpdate(void)
|
|||
|
||||
void DbObject::SendStatusUpdate(void)
|
||||
{
|
||||
/* update custom var status for all objects */
|
||||
SendVarsStatusUpdate();
|
||||
|
||||
/* status objects */
|
||||
Dictionary::Ptr fields = GetStatusFields();
|
||||
|
||||
if (!fields)
|
||||
|
@ -135,6 +147,87 @@ void DbObject::SendStatusUpdate(void)
|
|||
OnStatusUpdate();
|
||||
}
|
||||
|
||||
void DbObject::SendVarsConfigUpdate(void)
|
||||
{
|
||||
DynamicObject::Ptr obj = GetObject();
|
||||
|
||||
Dictionary::Ptr vars = CompatUtility::GetCustomAttributeConfig(obj);
|
||||
|
||||
if (vars) {
|
||||
Log(LogDebug, "db_ido", "Updating object vars for '" + obj->GetName() + "'");
|
||||
|
||||
ObjectLock olock (vars);
|
||||
|
||||
BOOST_FOREACH(const Dictionary::Pair& kv, vars) {
|
||||
if (!kv.first.IsEmpty()) {
|
||||
int overridden = obj->IsVarOverridden(kv.first) ? 1 : 0;
|
||||
|
||||
Log(LogDebug, "db_ido", "object customvar key: '" + kv.first + "' value: '" + Convert::ToString(kv.second) +
|
||||
"' overridden: " + Convert::ToString(overridden));
|
||||
|
||||
Dictionary::Ptr fields = make_shared<Dictionary>();
|
||||
fields->Set("varname", Convert::ToString(kv.first));
|
||||
fields->Set("varvalue", Convert::ToString(kv.second));
|
||||
fields->Set("config_type", 1);
|
||||
fields->Set("has_been_modified", overridden);
|
||||
fields->Set("object_id", obj);
|
||||
fields->Set("instance_id", 0); /* DbConnection class fills in real ID */
|
||||
|
||||
DbQuery query;
|
||||
query.Table = "customvariables";
|
||||
query.Type = DbQueryInsert;
|
||||
query.Category = DbCatConfig;
|
||||
query.Fields = fields;
|
||||
OnQuery(query);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DbObject::SendVarsStatusUpdate(void)
|
||||
{
|
||||
DynamicObject::Ptr obj = GetObject();
|
||||
|
||||
Dictionary::Ptr vars = CompatUtility::GetCustomAttributeConfig(obj);
|
||||
|
||||
if (vars) {
|
||||
Log(LogDebug, "db_ido", "Updating object vars for '" + obj->GetName() + "'");
|
||||
|
||||
ObjectLock olock (vars);
|
||||
|
||||
BOOST_FOREACH(const Dictionary::Pair& kv, vars) {
|
||||
if (!kv.first.IsEmpty()) {
|
||||
int overridden = obj->IsVarOverridden(kv.first) ? 1 : 0;
|
||||
|
||||
Log(LogDebug, "db_ido", "object customvar key: '" + kv.first + "' value: '" + Convert::ToString(kv.second) +
|
||||
"' overridden: " + Convert::ToString(overridden));
|
||||
|
||||
Dictionary::Ptr fields = make_shared<Dictionary>();
|
||||
fields->Set("varname", Convert::ToString(kv.first));
|
||||
fields->Set("varvalue", Convert::ToString(kv.second));
|
||||
fields->Set("has_been_modified", overridden);
|
||||
fields->Set("status_update_time", DbValue::FromTimestamp(Utility::GetTime()));
|
||||
fields->Set("object_id", obj);
|
||||
fields->Set("instance_id", 0); /* DbConnection class fills in real ID */
|
||||
|
||||
DbQuery query;
|
||||
query.Table = "customvariablestatus";
|
||||
query.Type = DbQueryInsert | DbQueryUpdate;
|
||||
query.Category = DbCatState;
|
||||
query.Fields = fields;
|
||||
|
||||
query.WhereCriteria = make_shared<Dictionary>();
|
||||
query.WhereCriteria->Set("object_id", obj);
|
||||
query.WhereCriteria->Set("varname", Convert::ToString(kv.first));
|
||||
query.Object = GetSelf();
|
||||
|
||||
OnQuery(query);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
double DbObject::GetLastConfigUpdate(void) const
|
||||
{
|
||||
return m_LastConfigUpdate;
|
||||
|
@ -206,3 +299,15 @@ void DbObject::StateChangedHandler(const DynamicObject::Ptr& object)
|
|||
|
||||
dbobj->SendStatusUpdate();
|
||||
}
|
||||
|
||||
void DbObject::VarsChangedHandler(const DynamicObject::Ptr& object)
|
||||
{
|
||||
DbObject::Ptr dbobj = GetOrCreateByObject(object);
|
||||
|
||||
Log(LogDebug, "db_ido", "Vars changed for object '" + object->GetName() + "'");
|
||||
|
||||
if (!dbobj)
|
||||
return;
|
||||
|
||||
dbobj->SendVarsStatusUpdate();
|
||||
}
|
||||
|
|
|
@ -80,6 +80,8 @@ public:
|
|||
|
||||
void SendConfigUpdate(void);
|
||||
void SendStatusUpdate(void);
|
||||
void SendVarsConfigUpdate(void);
|
||||
void SendVarsStatusUpdate(void);
|
||||
|
||||
double GetLastConfigUpdate(void) const;
|
||||
double GetLastStatusUpdate(void) const;
|
||||
|
@ -101,6 +103,7 @@ private:
|
|||
double m_LastStatusUpdate;
|
||||
|
||||
static void StateChangedHandler(const DynamicObject::Ptr& object);
|
||||
static void VarsChangedHandler(const DynamicObject::Ptr& object);
|
||||
|
||||
friend class DbType;
|
||||
};
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "db_ido/hostdbobject.h"
|
||||
#include "db_ido/dbtype.h"
|
||||
#include "db_ido/dbvalue.h"
|
||||
#include "db_ido/dbevents.h"
|
||||
#include "icinga/host.h"
|
||||
#include "icinga/service.h"
|
||||
#include "icinga/notification.h"
|
||||
|
@ -258,39 +259,9 @@ void HostDbObject::OnConfigUpdate(void)
|
|||
OnQuery(query_contact);
|
||||
}
|
||||
|
||||
/* custom variables */
|
||||
Dictionary::Ptr vars;
|
||||
{
|
||||
ObjectLock olock(host);
|
||||
vars = CompatUtility::GetCustomAttributeConfig(host);
|
||||
}
|
||||
|
||||
if (vars) {
|
||||
Log(LogDebug, "ido", "Dumping host vars for '" + host->GetName() + "'");
|
||||
|
||||
ObjectLock olock (vars);
|
||||
|
||||
BOOST_FOREACH(const Dictionary::Pair& kv, vars) {
|
||||
if (!kv.first.IsEmpty()) {
|
||||
Log(LogDebug, "db_ido", "host customvar key: '" + kv.first + "' value: '" + Convert::ToString(kv.second) + "'");
|
||||
|
||||
Dictionary::Ptr fields3 = make_shared<Dictionary>();
|
||||
fields3->Set("varname", Convert::ToString(kv.first));
|
||||
fields3->Set("varvalue", Convert::ToString(kv.second));
|
||||
fields3->Set("config_type", 1);
|
||||
fields3->Set("has_been_modified", 0);
|
||||
fields3->Set("object_id", host);
|
||||
fields3->Set("instance_id", 0); /* DbConnection class fills in real ID */
|
||||
|
||||
DbQuery query3;
|
||||
query3.Table = "customvariables";
|
||||
query3.Type = DbQueryInsert;
|
||||
query3.Category = DbCatConfig;
|
||||
query3.Fields = fields3;
|
||||
OnQuery(query3);
|
||||
}
|
||||
}
|
||||
}
|
||||
/* update comments and downtimes on config change */
|
||||
DbEvents::AddComments(host);
|
||||
DbEvents::AddDowntimes(host);
|
||||
}
|
||||
|
||||
void HostDbObject::OnStatusUpdate(void)
|
||||
|
|
|
@ -235,41 +235,6 @@ void ServiceDbObject::OnConfigUpdate(void)
|
|||
OnQuery(query_contact);
|
||||
}
|
||||
|
||||
/* custom variables */
|
||||
Dictionary::Ptr vars;
|
||||
|
||||
{
|
||||
ObjectLock olock(service);
|
||||
vars = CompatUtility::GetCustomAttributeConfig(service);
|
||||
}
|
||||
|
||||
if (vars) {
|
||||
Log(LogDebug, "db_ido", "Dumping service vars for '" + service->GetName() + "'");
|
||||
|
||||
ObjectLock olock(vars);
|
||||
|
||||
BOOST_FOREACH(const Dictionary::Pair& kv, vars) {
|
||||
if (!kv.first.IsEmpty()) {
|
||||
Log(LogDebug, "db_ido", "service customvar key: '" + kv.first + "' value: '" + Convert::ToString(kv.second) + "'");
|
||||
|
||||
Dictionary::Ptr fields2 = make_shared<Dictionary>();
|
||||
fields2->Set("varname", Convert::ToString(kv.first));
|
||||
fields2->Set("varvalue", Convert::ToString(kv.second));
|
||||
fields2->Set("config_type", 1);
|
||||
fields2->Set("has_been_modified", 0);
|
||||
fields2->Set("object_id", service);
|
||||
fields2->Set("instance_id", 0); /* DbConnection class fills in real ID */
|
||||
|
||||
DbQuery query2;
|
||||
query2.Table = "customvariables";
|
||||
query2.Type = DbQueryInsert;
|
||||
query2.Category = DbCatConfig;
|
||||
query2.Fields = fields2;
|
||||
OnQuery(query2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* update comments and downtimes on config change */
|
||||
DbEvents::AddComments(service);
|
||||
DbEvents::AddDowntimes(service);
|
||||
|
|
|
@ -188,6 +188,9 @@ int Checkable::GetModifiedAttributes(void) const
|
|||
if (!GetOverrideCheckPeriod().IsEmpty())
|
||||
attrs |= ModAttrCheckTimeperiod;
|
||||
|
||||
if (!GetOverrideVars().IsEmpty())
|
||||
attrs |= ModAttrCustomVariable;
|
||||
|
||||
// TODO: finish
|
||||
|
||||
return attrs;
|
||||
|
@ -230,4 +233,9 @@ void Checkable::SetModifiedAttributes(int flags)
|
|||
|
||||
if ((flags & ModAttrCheckTimeperiod) == 0)
|
||||
SetOverrideCheckPeriod(Empty);
|
||||
|
||||
if ((flags & ModAttrCustomVariable) == 0) {
|
||||
SetOverrideVars(Empty);
|
||||
OnVarsChanged(GetSelf());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,9 @@
|
|||
#include "icinga/servicegroup.h"
|
||||
#include "icinga/pluginutility.h"
|
||||
#include "icinga/icingaapplication.h"
|
||||
#include "icinga/checkcommand.h"
|
||||
#include "icinga/eventcommand.h"
|
||||
#include "icinga/notificationcommand.h"
|
||||
#include "base/convert.h"
|
||||
#include "base/logger_fwd.h"
|
||||
#include "base/objectlock.h"
|
||||
|
@ -241,6 +243,13 @@ void ExternalCommandProcessor::Initialize(void)
|
|||
RegisterCommand("CHANGE_MAX_SVC_CHECK_ATTEMPTS", &ExternalCommandProcessor::ChangeMaxSvcCheckAttempts, 3);
|
||||
RegisterCommand("CHANGE_HOST_CHECK_TIMEPERIOD", &ExternalCommandProcessor::ChangeHostCheckTimeperiod, 2);
|
||||
RegisterCommand("CHANGE_SVC_CHECK_TIMEPERIOD", &ExternalCommandProcessor::ChangeSvcCheckTimeperiod, 3);
|
||||
RegisterCommand("CHANGE_CUSTOM_HOST_VAR", &ExternalCommandProcessor::ChangeCustomHostVar, 3);
|
||||
RegisterCommand("CHANGE_CUSTOM_SVC_VAR", &ExternalCommandProcessor::ChangeCustomSvcVar, 4);
|
||||
RegisterCommand("CHANGE_CUSTOM_USER_VAR", &ExternalCommandProcessor::ChangeCustomUserVar, 3);
|
||||
RegisterCommand("CHANGE_CUSTOM_CHECKCOMMAND_VAR", &ExternalCommandProcessor::ChangeCustomCheckcommandVar, 3);
|
||||
RegisterCommand("CHANGE_CUSTOM_EVENTCOMMAND_VAR", &ExternalCommandProcessor::ChangeCustomEventcommandVar, 3);
|
||||
RegisterCommand("CHANGE_CUSTOM_NOTIFICATIONCOMMAND_VAR", &ExternalCommandProcessor::ChangeCustomNotificationcommandVar, 3);
|
||||
|
||||
RegisterCommand("ENABLE_HOSTGROUP_HOST_NOTIFICATIONS", &ExternalCommandProcessor::EnableHostgroupHostNotifications, 1);
|
||||
RegisterCommand("ENABLE_HOSTGROUP_SVC_NOTIFICATIONS", &ExternalCommandProcessor::EnableHostgroupSvcNotifications, 1);
|
||||
RegisterCommand("DISABLE_HOSTGROUP_HOST_NOTIFICATIONS", &ExternalCommandProcessor::DisableHostgroupHostNotifications, 1);
|
||||
|
@ -1933,6 +1942,152 @@ void ExternalCommandProcessor::ChangeSvcCheckTimeperiod(double time, const std::
|
|||
}
|
||||
}
|
||||
|
||||
void ExternalCommandProcessor::ChangeCustomHostVar(double time, const std::vector<String>& arguments)
|
||||
{
|
||||
Host::Ptr host = Host::GetByName(arguments[0]);
|
||||
|
||||
if (!host)
|
||||
BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot change custom var for non-existent host '" + arguments[0] + "'"));
|
||||
|
||||
Dictionary::Ptr vars = host->GetVars();
|
||||
Dictionary::Ptr override_vars = vars->ShallowClone();
|
||||
|
||||
if (!vars->Contains(arguments[1]))
|
||||
BOOST_THROW_EXCEPTION(std::invalid_argument("Custom var '" + arguments[1] + "' for host '" + arguments[0] + "' does not exist."));
|
||||
|
||||
override_vars->Set(arguments[1], arguments[2]);
|
||||
|
||||
Log(LogInformation, "icinga", "Changing custom var '" + arguments[1] + "' for host '" + arguments[0] + "' to value '" + arguments[2] + "'");
|
||||
|
||||
{
|
||||
ObjectLock olock(host);
|
||||
|
||||
host->SetVars(override_vars);
|
||||
}
|
||||
}
|
||||
|
||||
void ExternalCommandProcessor::ChangeCustomSvcVar(double time, const std::vector<String>& arguments)
|
||||
{
|
||||
Service::Ptr service = Service::GetByNamePair(arguments[0], arguments[1]);
|
||||
|
||||
if (!service)
|
||||
BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot change custom var for non-existent service '" + arguments[1] + "' on host '" + arguments[0] + "'"));
|
||||
|
||||
Dictionary::Ptr vars = service->GetVars();
|
||||
Dictionary::Ptr override_vars = vars->ShallowClone();
|
||||
|
||||
if (!vars->Contains(arguments[2]))
|
||||
BOOST_THROW_EXCEPTION(std::invalid_argument("Custom var '" + arguments[2] + "' for service '" + arguments[1] +
|
||||
"' on host '" + arguments[0] + "' does not exist."));
|
||||
|
||||
override_vars->Set(arguments[2], arguments[3]);
|
||||
|
||||
Log(LogInformation, "icinga", "Changing custom var '" + arguments[2] + "' for service '" + arguments[1] + "' on host '" +
|
||||
arguments[0] + "' to value '" + arguments[3] + "'");
|
||||
|
||||
{
|
||||
ObjectLock olock(service);
|
||||
|
||||
service->SetVars(override_vars);
|
||||
}
|
||||
}
|
||||
|
||||
void ExternalCommandProcessor::ChangeCustomUserVar(double time, const std::vector<String>& arguments)
|
||||
{
|
||||
User::Ptr user = User::GetByName(arguments[0]);
|
||||
|
||||
if (!user)
|
||||
BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot change custom var for non-existent user '" + arguments[0] + "'"));
|
||||
|
||||
Dictionary::Ptr vars = user->GetVars();
|
||||
Dictionary::Ptr override_vars = vars->ShallowClone();
|
||||
|
||||
if (!vars->Contains(arguments[1]))
|
||||
BOOST_THROW_EXCEPTION(std::invalid_argument("Custom var '" + arguments[1] + "' for user '" + arguments[0] + "' does not exist."));
|
||||
|
||||
override_vars->Set(arguments[1], arguments[2]);
|
||||
|
||||
Log(LogInformation, "icinga", "Changing custom var '" + arguments[1] + "' for user '" + arguments[0] + "' to value '" + arguments[2] + "'");
|
||||
|
||||
{
|
||||
ObjectLock olock(user);
|
||||
|
||||
user->SetVars(override_vars);
|
||||
}
|
||||
}
|
||||
|
||||
void ExternalCommandProcessor::ChangeCustomCheckcommandVar(double time, const std::vector<String>& arguments)
|
||||
{
|
||||
CheckCommand::Ptr command = CheckCommand::GetByName(arguments[0]);
|
||||
|
||||
if (!command)
|
||||
BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot change custom var for non-existent command '" + arguments[0] + "'"));
|
||||
|
||||
Dictionary::Ptr vars = command->GetVars();
|
||||
Dictionary::Ptr override_vars = vars->ShallowClone();
|
||||
|
||||
if (!vars->Contains(arguments[1]))
|
||||
BOOST_THROW_EXCEPTION(std::invalid_argument("Custom var '" + arguments[1] + "' for command '" + arguments[0] + "' does not exist."));
|
||||
|
||||
override_vars->Set(arguments[1], arguments[2]);
|
||||
|
||||
Log(LogInformation, "icinga", "Changing custom var '" + arguments[1] + "' for command '" + arguments[0] + "' to value '" + arguments[2] + "'");
|
||||
|
||||
{
|
||||
ObjectLock olock(command);
|
||||
|
||||
command->SetVars(override_vars);
|
||||
}
|
||||
}
|
||||
|
||||
void ExternalCommandProcessor::ChangeCustomEventcommandVar(double time, const std::vector<String>& arguments)
|
||||
{
|
||||
EventCommand::Ptr command = EventCommand::GetByName(arguments[0]);
|
||||
|
||||
if (!command)
|
||||
BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot change custom var for non-existent command '" + arguments[0] + "'"));
|
||||
|
||||
Dictionary::Ptr vars = command->GetVars();
|
||||
Dictionary::Ptr override_vars = vars->ShallowClone();
|
||||
|
||||
if (!vars->Contains(arguments[1]))
|
||||
BOOST_THROW_EXCEPTION(std::invalid_argument("Custom var '" + arguments[1] + "' for command '" + arguments[0] + "' does not exist."));
|
||||
|
||||
override_vars->Set(arguments[1], arguments[2]);
|
||||
|
||||
Log(LogInformation, "icinga", "Changing custom var '" + arguments[1] + "' for command '" + arguments[0] + "' to value '" + arguments[2] + "'");
|
||||
|
||||
{
|
||||
ObjectLock olock(command);
|
||||
|
||||
command->SetVars(override_vars);
|
||||
}
|
||||
}
|
||||
|
||||
void ExternalCommandProcessor::ChangeCustomNotificationcommandVar(double time, const std::vector<String>& arguments)
|
||||
{
|
||||
NotificationCommand::Ptr command = NotificationCommand::GetByName(arguments[0]);
|
||||
|
||||
if (!command)
|
||||
BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot change custom var for non-existent command '" + arguments[0] + "'"));
|
||||
|
||||
Dictionary::Ptr vars = command->GetVars();
|
||||
Dictionary::Ptr override_vars = vars->ShallowClone();
|
||||
|
||||
if (!vars->Contains(arguments[1]))
|
||||
BOOST_THROW_EXCEPTION(std::invalid_argument("Custom var '" + arguments[1] + "' for command '" + arguments[0] + "' does not exist."));
|
||||
|
||||
override_vars->Set(arguments[1], arguments[2]);
|
||||
|
||||
Log(LogInformation, "icinga", "Changing custom var '" + arguments[1] + "' for command '" + arguments[0] + "' to value '" + arguments[2] + "'");
|
||||
|
||||
{
|
||||
ObjectLock olock(command);
|
||||
|
||||
command->SetVars(override_vars);
|
||||
}
|
||||
}
|
||||
|
||||
void ExternalCommandProcessor::EnableHostgroupHostNotifications(double time, const std::vector<String>& arguments)
|
||||
{
|
||||
HostGroup::Ptr hg = HostGroup::GetByName(arguments[0]);
|
||||
|
|
|
@ -141,6 +141,13 @@ private:
|
|||
static void ChangeMaxSvcCheckAttempts(double time, const std::vector<String>& arguments);
|
||||
static void ChangeHostCheckTimeperiod(double time, const std::vector<String>& arguments);
|
||||
static void ChangeSvcCheckTimeperiod(double time, const std::vector<String>& arguments);
|
||||
static void ChangeCustomHostVar(double time, const std::vector<String>& arguments);
|
||||
static void ChangeCustomSvcVar(double time, const std::vector<String>& arguments);
|
||||
static void ChangeCustomUserVar(double time, const std::vector<String>& arguments);
|
||||
static void ChangeCustomCheckcommandVar(double time, const std::vector<String>& arguments);
|
||||
static void ChangeCustomEventcommandVar(double time, const std::vector<String>& arguments);
|
||||
static void ChangeCustomNotificationcommandVar(double time, const std::vector<String>& arguments);
|
||||
|
||||
static void EnableHostgroupHostNotifications(double time, const std::vector<String>& arguments);
|
||||
static void EnableHostgroupSvcNotifications(double time, const std::vector<String>& arguments);
|
||||
static void DisableHostgroupHostNotifications(double time, const std::vector<String>& arguments);
|
||||
|
|
Loading…
Reference in New Issue