/******************************************************************************
* Icinga 2 *
- * Copyright (C) 2012-2013 Icinga Development Team (http://www.icinga.org/) *
+ * Copyright (C) 2012-2014 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 *
#include <boost/foreach.hpp>
using namespace icinga;
-using namespace livestatus;
HostGroupsTable::HostGroupsTable(void)
{
Value HostGroupsTable::NotesAccessor(const Value& row)
{
- Dictionary::Ptr custom = static_cast<HostGroup::Ptr>(row)->GetCustom();
+ Dictionary::Ptr vars = static_cast<HostGroup::Ptr>(row)->GetVars();
- if (!custom)
+ if (!vars)
return Empty;
- return custom->Get("notes");
+ return vars->Get("notes");
}
Value HostGroupsTable::NotesUrlAccessor(const Value& row)
{
- Dictionary::Ptr custom = static_cast<HostGroup::Ptr>(row)->GetCustom();
+ Dictionary::Ptr vars = static_cast<HostGroup::Ptr>(row)->GetVars();
- if (!custom)
+ if (!vars)
return Empty;
- return custom->Get("notes_url");
+ return vars->Get("notes_url");
}
Value HostGroupsTable::ActionUrlAccessor(const Value& row)
{
- Dictionary::Ptr custom = static_cast<HostGroup::Ptr>(row)->GetCustom();
+ Dictionary::Ptr vars = static_cast<HostGroup::Ptr>(row)->GetVars();
- if (!custom)
+ if (!vars)
return Empty;
- return custom->Get("action_url");
+ return vars->Get("action_url");
}
Value HostGroupsTable::MembersAccessor(const Value& row)
int num_hosts = 0;
BOOST_FOREACH(const Host::Ptr& host, static_cast<HostGroup::Ptr>(row)->GetMembers()) {
- Service::Ptr hc = host->GetCheckService();
-
- /* no hostcheck service or no checkresult */
- if (!hc || !hc->GetLastCheckResult())
+ /* no checkresult */
+ if (!host->GetLastCheckResult())
num_hosts++;
}
int num_hosts = 0;
BOOST_FOREACH(const Host::Ptr& host, static_cast<HostGroup::Ptr>(row)->GetMembers()) {
- if (host->GetState() == HostUnreachable)
+ if (!host->IsReachable())
num_hosts++;
}