mirror of https://github.com/Icinga/icinga2.git
compat: Add {host,service}_groups attributes.
This commit is contained in:
parent
ae12f9923d
commit
7031421162
|
@ -341,14 +341,29 @@ void StatusDataWriter::DumpHostObject(std::ostream& fp, const Host::Ptr& host)
|
|||
|
||||
}
|
||||
|
||||
/* TODO FIXME
|
||||
Array::Ptr groups = host->GetGroups();
|
||||
if (groups) {
|
||||
fp << "\t" << "hostgroups" << "\t";
|
||||
DumpNameArray(fp, host->GetGroups());
|
||||
fp << "\n";
|
||||
}
|
||||
*/
|
||||
fp << "\t" << "host_groups" << "\t";
|
||||
bool first = true;
|
||||
|
||||
Array::Ptr groups = host->GetGroups();
|
||||
|
||||
if (groups) {
|
||||
ObjectLock olock(groups);
|
||||
|
||||
BOOST_FOREACH(const String& name, groups) {
|
||||
HostGroup::Ptr hg = HostGroup::GetByName(name);
|
||||
|
||||
if (hg) {
|
||||
if (!first)
|
||||
fp << ",";
|
||||
else
|
||||
first = false;
|
||||
|
||||
fp << hg->GetName();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fp << "\n";
|
||||
|
||||
DumpCustomAttributes(fp, host);
|
||||
|
||||
|
@ -497,6 +512,30 @@ void StatusDataWriter::DumpServiceObject(std::ostream& fp, const Service::Ptr& s
|
|||
<< "\t" << "check_freshness" << "\t" << 1 << "\n";
|
||||
}
|
||||
|
||||
fp << "\t" << "service_groups" << "\t";
|
||||
bool first = true;
|
||||
|
||||
Array::Ptr groups = service->GetGroups();
|
||||
|
||||
if (groups) {
|
||||
ObjectLock olock(groups);
|
||||
|
||||
BOOST_FOREACH(const String& name, groups) {
|
||||
ServiceGroup::Ptr sg = ServiceGroup::GetByName(name);
|
||||
|
||||
if (sg) {
|
||||
if (!first)
|
||||
fp << ",";
|
||||
else
|
||||
first = false;
|
||||
|
||||
fp << sg->GetName();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fp << "\n";
|
||||
|
||||
DumpCustomAttributes(fp, service);
|
||||
|
||||
fp << "\t" << "}" << "\n"
|
||||
|
@ -747,22 +786,6 @@ void StatusDataWriter::StatusTimerHandler(void)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
void StatusDataWriter::DumpNameArray(std::ostream& fp, const Array::Ptr& array)
|
||||
{
|
||||
bool first = true;
|
||||
ObjectLock olock(array);
|
||||
BOOST_FOREACH(const Array::Ptr& obj, array) {
|
||||
if (!first)
|
||||
fp << ",";
|
||||
else
|
||||
first = false;
|
||||
|
||||
fp << obj->GetName();
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
void StatusDataWriter::InternalSerialize(const Dictionary::Ptr& bag, int attributeTypes) const
|
||||
{
|
||||
DynamicObject::InternalSerialize(bag, attributeTypes);
|
||||
|
|
|
@ -97,8 +97,6 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
void DumpNameArray(std::ostream& fp, const Array::Ptr& array);
|
||||
|
||||
void DumpServiceStatus(std::ostream& fp, const Service::Ptr& service);
|
||||
void DumpServiceObject(std::ostream& fp, const Service::Ptr& service);
|
||||
|
||||
|
|
Loading…
Reference in New Issue