mirror of https://github.com/Icinga/icinga2.git
Implement some more tables.
This commit is contained in:
parent
ed912b0e23
commit
7274d4680e
|
@ -0,0 +1,69 @@
|
||||||
|
/******************************************************************************
|
||||||
|
* Icinga 2 *
|
||||||
|
* Copyright (C) 2012 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 *
|
||||||
|
* as published by the Free Software Foundation; either version 2 *
|
||||||
|
* of the License, or (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This program is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with this program; if not, write to the Free Software Foundation *
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
#include "i2-livestatus.h"
|
||||||
|
|
||||||
|
using namespace icinga;
|
||||||
|
using namespace livestatus;
|
||||||
|
|
||||||
|
CommentsTable::CommentsTable(void)
|
||||||
|
{
|
||||||
|
AddColumns(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CommentsTable::AddColumns(Table *table, const String& prefix,
|
||||||
|
const Column::ObjectAccessor& objectAccessor)
|
||||||
|
{
|
||||||
|
table->AddColumn(prefix + "author", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "comment", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "id", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "entry_time", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "type", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "is_service", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "persistent", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "source", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "entry_type", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "expires", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "expire_time", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
|
||||||
|
// TODO: Join services table.
|
||||||
|
}
|
||||||
|
|
||||||
|
String CommentsTable::GetName(void) const
|
||||||
|
{
|
||||||
|
return "comments";
|
||||||
|
}
|
||||||
|
|
||||||
|
void CommentsTable::FetchRows(const function<void (const Object::Ptr&)>& addRowFn)
|
||||||
|
{
|
||||||
|
BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjects("Service")) {
|
||||||
|
Service::Ptr service = static_pointer_cast<Service>(object);
|
||||||
|
Dictionary::Ptr comments = service->GetComments();
|
||||||
|
|
||||||
|
if (!comments)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
ObjectLock olock(comments);
|
||||||
|
|
||||||
|
Value comment;
|
||||||
|
BOOST_FOREACH(tie(tuples::ignore, comment), comments) {
|
||||||
|
addRowFn(comment);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,48 @@
|
||||||
|
/******************************************************************************
|
||||||
|
* Icinga 2 *
|
||||||
|
* Copyright (C) 2012 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 *
|
||||||
|
* as published by the Free Software Foundation; either version 2 *
|
||||||
|
* of the License, or (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This program is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with this program; if not, write to the Free Software Foundation *
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
#ifndef COMMENTSTABLE_H
|
||||||
|
#define COMMENTSTABLE_H
|
||||||
|
|
||||||
|
namespace livestatus
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ingroup livestatus
|
||||||
|
*/
|
||||||
|
class CommentsTable : public Table
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef shared_ptr<CommentsTable> Ptr;
|
||||||
|
typedef weak_ptr<CommentsTable> WeakPtr;
|
||||||
|
|
||||||
|
CommentsTable(void);
|
||||||
|
|
||||||
|
static void AddColumns(Table *table, const String& prefix = String(),
|
||||||
|
const Column::ObjectAccessor& objectAccessor = Column::ObjectAccessor());
|
||||||
|
|
||||||
|
virtual String GetName(void) const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void FetchRows(const function<void (const Object::Ptr&)>& addRowFn);
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* COMMENTSTABLE_H */
|
|
@ -0,0 +1,69 @@
|
||||||
|
/******************************************************************************
|
||||||
|
* Icinga 2 *
|
||||||
|
* Copyright (C) 2012 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 *
|
||||||
|
* as published by the Free Software Foundation; either version 2 *
|
||||||
|
* of the License, or (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This program is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with this program; if not, write to the Free Software Foundation *
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
#include "i2-livestatus.h"
|
||||||
|
|
||||||
|
using namespace icinga;
|
||||||
|
using namespace livestatus;
|
||||||
|
|
||||||
|
DowntimesTable::DowntimesTable(void)
|
||||||
|
{
|
||||||
|
AddColumns(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DowntimesTable::AddColumns(Table *table, const String& prefix,
|
||||||
|
const Column::ObjectAccessor& objectAccessor)
|
||||||
|
{
|
||||||
|
table->AddColumn(prefix + "author", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "comment", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "id", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "entry_time", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "type", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "is_service", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "start_time", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "end_time", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "fixed", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "duration", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "triggered_by", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
|
||||||
|
// TODO: Join services table.
|
||||||
|
}
|
||||||
|
|
||||||
|
String DowntimesTable::GetName(void) const
|
||||||
|
{
|
||||||
|
return "downtimes";
|
||||||
|
}
|
||||||
|
|
||||||
|
void DowntimesTable::FetchRows(const function<void (const Object::Ptr&)>& addRowFn)
|
||||||
|
{
|
||||||
|
BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjects("Service")) {
|
||||||
|
Service::Ptr service = static_pointer_cast<Service>(object);
|
||||||
|
Dictionary::Ptr downtimes = service->GetDowntimes();
|
||||||
|
|
||||||
|
if (!downtimes)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
ObjectLock olock(downtimes);
|
||||||
|
|
||||||
|
Value downtime;
|
||||||
|
BOOST_FOREACH(tie(tuples::ignore, downtime), downtimes) {
|
||||||
|
addRowFn(downtime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,48 @@
|
||||||
|
/******************************************************************************
|
||||||
|
* Icinga 2 *
|
||||||
|
* Copyright (C) 2012 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 *
|
||||||
|
* as published by the Free Software Foundation; either version 2 *
|
||||||
|
* of the License, or (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This program is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with this program; if not, write to the Free Software Foundation *
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
#ifndef DOWNTIMESTABLE_H
|
||||||
|
#define DOWNTIMESTABLE_H
|
||||||
|
|
||||||
|
namespace livestatus
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ingroup livestatus
|
||||||
|
*/
|
||||||
|
class DowntimesTable : public Table
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef shared_ptr<DowntimesTable> Ptr;
|
||||||
|
typedef weak_ptr<DowntimesTable> WeakPtr;
|
||||||
|
|
||||||
|
DowntimesTable(void);
|
||||||
|
|
||||||
|
static void AddColumns(Table *table, const String& prefix = String(),
|
||||||
|
const Column::ObjectAccessor& objectAccessor = Column::ObjectAccessor());
|
||||||
|
|
||||||
|
virtual String GetName(void) const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void FetchRows(const function<void (const Object::Ptr&)>& addRowFn);
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* DOWNTIMESTABLE_H */
|
|
@ -46,6 +46,9 @@ using namespace icinga;
|
||||||
#include "contactgroupstable.h"
|
#include "contactgroupstable.h"
|
||||||
#include "contactstable.h"
|
#include "contactstable.h"
|
||||||
#include "hoststable.h"
|
#include "hoststable.h"
|
||||||
|
#include "servicestable.h"
|
||||||
|
#include "commentstable.h"
|
||||||
|
#include "downtimestable.h"
|
||||||
#include "component.h"
|
#include "component.h"
|
||||||
|
|
||||||
#endif /* I2LIVESTATUS_H */
|
#endif /* I2LIVESTATUS_H */
|
||||||
|
|
|
@ -23,8 +23,10 @@
|
||||||
<ClInclude Include="attributefilter.h" />
|
<ClInclude Include="attributefilter.h" />
|
||||||
<ClInclude Include="column.h" />
|
<ClInclude Include="column.h" />
|
||||||
<ClInclude Include="combinerfilter.h" />
|
<ClInclude Include="combinerfilter.h" />
|
||||||
|
<ClInclude Include="commentstable.h" />
|
||||||
<ClInclude Include="contactgroupstable.h" />
|
<ClInclude Include="contactgroupstable.h" />
|
||||||
<ClInclude Include="contactstable.h" />
|
<ClInclude Include="contactstable.h" />
|
||||||
|
<ClInclude Include="downtimestable.h" />
|
||||||
<ClInclude Include="filter.h" />
|
<ClInclude Include="filter.h" />
|
||||||
<ClInclude Include="hoststable.h" />
|
<ClInclude Include="hoststable.h" />
|
||||||
<ClInclude Include="i2-livestatus.h" />
|
<ClInclude Include="i2-livestatus.h" />
|
||||||
|
@ -33,6 +35,7 @@
|
||||||
<ClInclude Include="negatefilter.h" />
|
<ClInclude Include="negatefilter.h" />
|
||||||
<ClInclude Include="orfilter.h" />
|
<ClInclude Include="orfilter.h" />
|
||||||
<ClInclude Include="query.h" />
|
<ClInclude Include="query.h" />
|
||||||
|
<ClInclude Include="servicestable.h" />
|
||||||
<ClInclude Include="statustable.h" />
|
<ClInclude Include="statustable.h" />
|
||||||
<ClInclude Include="table.h" />
|
<ClInclude Include="table.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -41,15 +44,18 @@
|
||||||
<ClCompile Include="attributefilter.cpp" />
|
<ClCompile Include="attributefilter.cpp" />
|
||||||
<ClCompile Include="column.cpp" />
|
<ClCompile Include="column.cpp" />
|
||||||
<ClCompile Include="combinerfilter.cpp" />
|
<ClCompile Include="combinerfilter.cpp" />
|
||||||
|
<ClCompile Include="commentstable.cpp" />
|
||||||
<ClCompile Include="component.cpp" />
|
<ClCompile Include="component.cpp" />
|
||||||
<ClCompile Include="connection.cpp" />
|
<ClCompile Include="connection.cpp" />
|
||||||
<ClCompile Include="contactgroupstable.cpp" />
|
<ClCompile Include="contactgroupstable.cpp" />
|
||||||
<ClCompile Include="contactstable.cpp" />
|
<ClCompile Include="contactstable.cpp" />
|
||||||
|
<ClCompile Include="downtimestable.cpp" />
|
||||||
<ClCompile Include="filter.cpp" />
|
<ClCompile Include="filter.cpp" />
|
||||||
<ClCompile Include="hoststable.cpp" />
|
<ClCompile Include="hoststable.cpp" />
|
||||||
<ClCompile Include="negatefilter.cpp" />
|
<ClCompile Include="negatefilter.cpp" />
|
||||||
<ClCompile Include="orfilter.cpp" />
|
<ClCompile Include="orfilter.cpp" />
|
||||||
<ClCompile Include="query.cpp" />
|
<ClCompile Include="query.cpp" />
|
||||||
|
<ClCompile Include="servicestable.cpp" />
|
||||||
<ClCompile Include="statustable.cpp" />
|
<ClCompile Include="statustable.cpp" />
|
||||||
<ClCompile Include="table.cpp" />
|
<ClCompile Include="table.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
@ -57,6 +57,15 @@
|
||||||
<ClInclude Include="column.h">
|
<ClInclude Include="column.h">
|
||||||
<Filter>Headerdateien</Filter>
|
<Filter>Headerdateien</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="servicestable.h">
|
||||||
|
<Filter>Headerdateien</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="commentstable.h">
|
||||||
|
<Filter>Headerdateien</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="downtimestable.h">
|
||||||
|
<Filter>Headerdateien</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="component.cpp">
|
<ClCompile Include="component.cpp">
|
||||||
|
@ -104,5 +113,14 @@
|
||||||
<ClCompile Include="column.cpp">
|
<ClCompile Include="column.cpp">
|
||||||
<Filter>Quelldateien</Filter>
|
<Filter>Quelldateien</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="servicestable.cpp">
|
||||||
|
<Filter>Quelldateien</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="commentstable.cpp">
|
||||||
|
<Filter>Quelldateien</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="downtimestable.cpp">
|
||||||
|
<Filter>Quelldateien</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -0,0 +1,144 @@
|
||||||
|
/******************************************************************************
|
||||||
|
* Icinga 2 *
|
||||||
|
* Copyright (C) 2012 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 *
|
||||||
|
* as published by the Free Software Foundation; either version 2 *
|
||||||
|
* of the License, or (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This program is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with this program; if not, write to the Free Software Foundation *
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
#include "i2-livestatus.h"
|
||||||
|
|
||||||
|
using namespace icinga;
|
||||||
|
using namespace livestatus;
|
||||||
|
|
||||||
|
ServicesTable::ServicesTable(void)
|
||||||
|
{
|
||||||
|
AddColumns(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ServicesTable::AddColumns(Table *table, const String& prefix,
|
||||||
|
const Column::ObjectAccessor& objectAccessor)
|
||||||
|
{
|
||||||
|
table->AddColumn(prefix + "description", Column(&ServicesTable::ShortNameAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "display_name", Column(&ServicesTable::DisplayNameAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "check_command", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "check_command_expanded", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "event_handler", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "plugin_output", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "long_plugin_output", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "perf_data", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "notification_period", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "check_period", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "notes", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "notes_expanded", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "notes_url", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "notes_url_expanded", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "action_url", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "action_url_expanded", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "icon_image", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "icon_image_expanded", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "icon_image_alt", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "initial_state", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "max_check_attempts", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "current_attempt", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "state", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "has_been_checked", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "last_state", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "last_hard_state", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "state_type", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "check_type", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "acknowledged", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "acknowledgement_type", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "no_more_notifications", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "last_state_change", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "last_time_ok", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "last_time_warning", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "last_time_critical", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "last_time_unknown", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "last_check", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "next_check", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "last_notification", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "next_notification", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "current_notification_number", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "last_state_change", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "last_hard_state_change", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "scheduled_downtime_depth", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "is_flapping", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "checks_enabled", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "accept_passive_checks", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "event_handler_enabled", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "notifications_enabled", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "process_performance_data", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "is_executing", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "active_checks_enabled", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "check_options", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "flap_detection_enabled", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "check_freshness", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "obsess_over_service", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "modified_attributes", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "modified_attributes_list", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "pnpgraph_present", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "check_interval", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "retry_interval", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "notification_interval", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "first_notification_delay", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "low_flap_threshold", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "high_flap_threshold", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "latency", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "execution_time", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "percent_state_change", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "in_check_period", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "in_notification_period", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "contacts", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "downtimes", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "downtimes_with_info", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "comments", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "comments_with_info", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "comments_with_extra_info", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "host_", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "custom_variable_names", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "custom_variable_values", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "custom_variables", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "groups", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "contact_groups", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
|
|
||||||
|
HostsTable::AddColumns(table, "host_", &ServicesTable::HostAccessor);
|
||||||
|
}
|
||||||
|
|
||||||
|
String ServicesTable::GetName(void) const
|
||||||
|
{
|
||||||
|
return "services";
|
||||||
|
}
|
||||||
|
|
||||||
|
void ServicesTable::FetchRows(const function<void (const Object::Ptr&)>& addRowFn)
|
||||||
|
{
|
||||||
|
BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjects("Service")) {
|
||||||
|
addRowFn(object);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Object::Ptr ServicesTable::HostAccessor(const Object::Ptr& object)
|
||||||
|
{
|
||||||
|
return static_pointer_cast<Service>(object)->GetHost();
|
||||||
|
}
|
||||||
|
|
||||||
|
Value ServicesTable::ShortNameAccessor(const Object::Ptr& object)
|
||||||
|
{
|
||||||
|
return static_pointer_cast<Service>(object)->GetShortName();
|
||||||
|
}
|
||||||
|
|
||||||
|
Value ServicesTable::DisplayNameAccessor(const Object::Ptr& object)
|
||||||
|
{
|
||||||
|
return static_pointer_cast<Service>(object)->GetDisplayName();
|
||||||
|
}
|
|
@ -0,0 +1,53 @@
|
||||||
|
/******************************************************************************
|
||||||
|
* Icinga 2 *
|
||||||
|
* Copyright (C) 2012 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 *
|
||||||
|
* as published by the Free Software Foundation; either version 2 *
|
||||||
|
* of the License, or (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This program is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with this program; if not, write to the Free Software Foundation *
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
#ifndef SERVICESTABLE_H
|
||||||
|
#define SERVICESTABLE_H
|
||||||
|
|
||||||
|
namespace livestatus
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ingroup livestatus
|
||||||
|
*/
|
||||||
|
class ServicesTable : public Table
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef shared_ptr<ServicesTable> Ptr;
|
||||||
|
typedef weak_ptr<ServicesTable> WeakPtr;
|
||||||
|
|
||||||
|
ServicesTable(void);
|
||||||
|
|
||||||
|
static void AddColumns(Table *table, const String& prefix = String(),
|
||||||
|
const Column::ObjectAccessor& objectAccessor = Column::ObjectAccessor());
|
||||||
|
|
||||||
|
virtual String GetName(void) const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void FetchRows(const function<void (const Object::Ptr&)>& addRowFn);
|
||||||
|
|
||||||
|
static Object::Ptr HostAccessor(const Object::Ptr& object);
|
||||||
|
|
||||||
|
static Value ShortNameAccessor(const Object::Ptr& object);
|
||||||
|
static Value DisplayNameAccessor(const Object::Ptr& object);
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* SERVICESTABLE_H */
|
|
@ -35,6 +35,12 @@ Table::Ptr Table::GetByName(const String& name)
|
||||||
return boost::make_shared<ContactsTable>();
|
return boost::make_shared<ContactsTable>();
|
||||||
else if (name == "hosts")
|
else if (name == "hosts")
|
||||||
return boost::make_shared<HostsTable>();
|
return boost::make_shared<HostsTable>();
|
||||||
|
else if (name == "services")
|
||||||
|
return boost::make_shared<ServicesTable>();
|
||||||
|
else if (name == "comments")
|
||||||
|
return boost::make_shared<CommentsTable>();
|
||||||
|
else if (name == "downtimes")
|
||||||
|
return boost::make_shared<DowntimesTable>();
|
||||||
|
|
||||||
return Table::Ptr();
|
return Table::Ptr();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue