mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-20 12:14:44 +02:00
Added missing files.
This commit is contained in:
parent
e2c04f604f
commit
26396f9e7b
43
icinga/hostgroup.cpp
Normal file
43
icinga/hostgroup.cpp
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
#include "i2-icinga.h"
|
||||||
|
|
||||||
|
using namespace icinga;
|
||||||
|
|
||||||
|
string HostGroup::GetAlias(void) const
|
||||||
|
{
|
||||||
|
string value;
|
||||||
|
|
||||||
|
if (GetConfigObject()->GetProperty("alias", &value))
|
||||||
|
return value;
|
||||||
|
|
||||||
|
return GetName();
|
||||||
|
}
|
||||||
|
|
||||||
|
string HostGroup::GetNotesUrl(void) const
|
||||||
|
{
|
||||||
|
string value;
|
||||||
|
GetConfigObject()->GetProperty("notes_url", &value);
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
string HostGroup::GetActionUrl(void) const
|
||||||
|
{
|
||||||
|
string value;
|
||||||
|
GetConfigObject()->GetProperty("action_url", &value);
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool HostGroup::Exists(const string& name)
|
||||||
|
{
|
||||||
|
return (ConfigObject::GetObject("hostgroup", name));
|
||||||
|
}
|
||||||
|
|
||||||
|
HostGroup HostGroup::GetByName(const string& name)
|
||||||
|
{
|
||||||
|
ConfigObject::Ptr configObject = ConfigObject::GetObject("hostgroup", name);
|
||||||
|
|
||||||
|
if (!configObject)
|
||||||
|
throw invalid_argument("HostGroup '" + name + "' does not exist.");
|
||||||
|
|
||||||
|
return HostGroup(configObject);
|
||||||
|
}
|
||||||
|
|
24
icinga/hostgroup.h
Normal file
24
icinga/hostgroup.h
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
#ifndef HOSTGROUP_H
|
||||||
|
#define HOSTGROUP_H
|
||||||
|
|
||||||
|
namespace icinga
|
||||||
|
{
|
||||||
|
|
||||||
|
class I2_ICINGA_API HostGroup : public ConfigObjectAdapter
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
HostGroup(const ConfigObject::Ptr& configObject)
|
||||||
|
: ConfigObjectAdapter(configObject)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
static bool Exists(const string& name);
|
||||||
|
static HostGroup GetByName(const string& name);
|
||||||
|
|
||||||
|
string GetAlias(void) const;
|
||||||
|
string GetNotesUrl(void) const;
|
||||||
|
string GetActionUrl(void) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* HOSTGROUP_H */
|
43
icinga/servicegroup.cpp
Normal file
43
icinga/servicegroup.cpp
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
#include "i2-icinga.h"
|
||||||
|
|
||||||
|
using namespace icinga;
|
||||||
|
|
||||||
|
string ServiceGroup::GetAlias(void) const
|
||||||
|
{
|
||||||
|
string value;
|
||||||
|
|
||||||
|
if (GetConfigObject()->GetProperty("alias", &value))
|
||||||
|
return value;
|
||||||
|
|
||||||
|
return GetName();
|
||||||
|
}
|
||||||
|
|
||||||
|
string ServiceGroup::GetNotesUrl(void) const
|
||||||
|
{
|
||||||
|
string value;
|
||||||
|
GetConfigObject()->GetProperty("notes_url", &value);
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
string ServiceGroup::GetActionUrl(void) const
|
||||||
|
{
|
||||||
|
string value;
|
||||||
|
GetConfigObject()->GetProperty("action_url", &value);
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ServiceGroup::Exists(const string& name)
|
||||||
|
{
|
||||||
|
return (ConfigObject::GetObject("hostgroup", name));
|
||||||
|
}
|
||||||
|
|
||||||
|
ServiceGroup ServiceGroup::GetByName(const string& name)
|
||||||
|
{
|
||||||
|
ConfigObject::Ptr configObject = ConfigObject::GetObject("hostgroup", name);
|
||||||
|
|
||||||
|
if (!configObject)
|
||||||
|
throw invalid_argument("ServiceGroup '" + name + "' does not exist.");
|
||||||
|
|
||||||
|
return ServiceGroup(configObject);
|
||||||
|
}
|
||||||
|
|
24
icinga/servicegroup.h
Normal file
24
icinga/servicegroup.h
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
#ifndef SERVICEGROUP_H
|
||||||
|
#define SERVICEGROUP_H
|
||||||
|
|
||||||
|
namespace icinga
|
||||||
|
{
|
||||||
|
|
||||||
|
class I2_ICINGA_API ServiceGroup : public ConfigObjectAdapter
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ServiceGroup(const ConfigObject::Ptr& configObject)
|
||||||
|
: ConfigObjectAdapter(configObject)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
static bool Exists(const string& name);
|
||||||
|
static ServiceGroup GetByName(const string& name);
|
||||||
|
|
||||||
|
string GetAlias(void) const;
|
||||||
|
string GetNotesUrl(void) const;
|
||||||
|
string GetActionUrl(void) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* SERVICEGROUP_H */
|
Loading…
x
Reference in New Issue
Block a user