]> granicus.if.org Git - icinga2/blobdiff - components/livestatus/hostgroupstable.cpp
Remove the HostUnreachable state.
[icinga2] / components / livestatus / hostgroupstable.cpp
index fff3111d055a0fb980ddf6417ad3bd8831bf07ef..a525cc651e54b6580899d03c1d0aacad02840821 100644 (file)
@@ -1,6 +1,6 @@
 /******************************************************************************
  * 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                *
@@ -85,32 +85,32 @@ Value HostGroupsTable::AliasAccessor(const Value& row)
 
 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)
@@ -160,10 +160,8 @@ Value HostGroupsTable::NumHostsPendingAccessor(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++;
        }
 
@@ -199,7 +197,7 @@ Value HostGroupsTable::NumHostsUnreachAccessor(const Value& row)
        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++;
        }