2019-02-25 14:48:22 +01:00
|
|
|
/* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
|
2014-10-17 19:44:31 +02:00
|
|
|
|
2015-08-20 17:18:48 +02:00
|
|
|
#include "base/configobject.hpp"
|
|
|
|
#include "base/utility.hpp"
|
|
|
|
#impl_include "icinga/service.hpp"
|
|
|
|
|
2015-08-04 14:47:44 +02:00
|
|
|
library icinga;
|
|
|
|
|
2013-11-09 22:08:26 +01:00
|
|
|
namespace icinga
|
|
|
|
{
|
|
|
|
|
2015-08-20 17:18:48 +02:00
|
|
|
code {{{
|
2017-12-31 07:22:16 +01:00
|
|
|
class DowntimeNameComposer : public NameComposer
|
2015-08-20 17:18:48 +02:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual String MakeName(const String& shortName, const Object::Ptr& context) const;
|
|
|
|
virtual Dictionary::Ptr ParseName(const String& name) const;
|
|
|
|
};
|
|
|
|
}}}
|
|
|
|
|
|
|
|
class Downtime : ConfigObject < DowntimeNameComposer
|
2013-11-09 22:08:26 +01:00
|
|
|
{
|
2019-02-20 13:56:15 +01:00
|
|
|
activation_priority -10;
|
|
|
|
|
2015-08-20 17:18:48 +02:00
|
|
|
load_after Host;
|
|
|
|
load_after Service;
|
|
|
|
|
2022-06-20 15:25:40 +02:00
|
|
|
[config, no_user_modify, required, navigation(host)] name(Host) host_name {
|
2015-08-20 17:18:48 +02:00
|
|
|
navigate {{{
|
|
|
|
return Host::GetByName(GetHostName());
|
|
|
|
}}}
|
|
|
|
};
|
2022-06-20 15:25:40 +02:00
|
|
|
[config, no_user_modify, navigation(service)] String service_name {
|
2015-08-20 17:18:48 +02:00
|
|
|
track {{{
|
|
|
|
if (!oldValue.IsEmpty()) {
|
|
|
|
Service::Ptr service = Service::GetByNamePair(GetHostName(), oldValue);
|
|
|
|
DependencyGraph::RemoveDependency(this, service.get());
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!newValue.IsEmpty()) {
|
|
|
|
Service::Ptr service = Service::GetByNamePair(GetHostName(), newValue);
|
2016-05-09 13:48:30 +02:00
|
|
|
DependencyGraph::AddDependency(this, service.get());
|
2015-08-20 17:18:48 +02:00
|
|
|
}
|
|
|
|
}}}
|
|
|
|
navigate {{{
|
|
|
|
if (GetServiceName().IsEmpty())
|
2017-11-30 08:36:35 +01:00
|
|
|
return nullptr;
|
2015-08-20 17:18:48 +02:00
|
|
|
|
|
|
|
Host::Ptr host = Host::GetByName(GetHostName());
|
|
|
|
return host->GetServiceByShortName(GetServiceName());
|
|
|
|
}}}
|
|
|
|
};
|
|
|
|
|
2016-06-21 11:29:12 +02:00
|
|
|
[config] Timestamp entry_time {
|
2015-08-20 17:18:48 +02:00
|
|
|
default {{{ return Utility::GetTime(); }}}
|
|
|
|
};
|
|
|
|
[config, required] String author;
|
|
|
|
[config, required] String comment;
|
2016-06-21 11:29:12 +02:00
|
|
|
[config] Timestamp start_time;
|
|
|
|
[config] Timestamp end_time;
|
|
|
|
[state] Timestamp trigger_time;
|
2015-08-20 17:18:48 +02:00
|
|
|
[config] bool fixed;
|
2016-06-21 11:29:12 +02:00
|
|
|
[config] Timestamp duration;
|
2016-10-05 17:36:43 +02:00
|
|
|
[config] String triggered_by;
|
2015-08-20 17:18:48 +02:00
|
|
|
[config] String scheduled_by;
|
2021-07-22 17:43:03 +02:00
|
|
|
[config] String parent;
|
2015-11-12 09:31:27 +01:00
|
|
|
[state] Array::Ptr triggers {
|
2015-08-20 17:18:48 +02:00
|
|
|
default {{{ return new Array(); }}}
|
2013-11-09 22:08:26 +01:00
|
|
|
};
|
2016-03-23 14:03:44 +01:00
|
|
|
[state] int legacy_id;
|
2021-12-13 16:37:45 +01:00
|
|
|
[state] Timestamp remove_time;
|
|
|
|
[no_storage] bool was_cancelled {
|
|
|
|
get {{{ return GetRemoveTime() > 0; }}}
|
|
|
|
};
|
2015-08-20 17:18:48 +02:00
|
|
|
[config] String config_owner;
|
2020-10-05 15:12:42 +02:00
|
|
|
[config] String config_owner_hash;
|
2018-12-04 17:44:42 +01:00
|
|
|
[config] String authoritative_zone;
|
2019-11-21 15:28:25 +01:00
|
|
|
|
|
|
|
[no_user_view, no_user_modify] String removed_by;
|
2013-11-09 22:08:26 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|