Module: check_mk
Branch: master
Commit: 6f2e6f830115a7790e213675b526451f034d2699
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=6f2e6f830115a7…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Thu Feb 7 11:05:24 2013 +0100
livestatus: new comments_with_extra_info column in
hosts/services table
---
ChangeLog | 4 ++++
livestatus/src/DownCommColumn.cc | 6 ++++++
livestatus/src/DownCommColumn.h | 5 +++--
livestatus/src/TableHosts.cc | 10 ++++++----
livestatus/src/TableServices.cc | 10 ++++++----
5 files changed, 25 insertions(+), 10 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 7d66e87..28c7887 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -34,6 +34,10 @@
* Add: if check now able to handle interface groups (if_groups)
* Add: winperf_phydisk can now output IOPS
* Add: oracle_tablespace now with flexible warn/crit levels(magic number)
+
+ Livestatus:
+ * Add: new column in hosts/services table: comments_with_extra_info
+ Adds the entry type and entry time
Multisite:
* Added comment painter to notification related views
diff --git a/livestatus/src/DownCommColumn.cc b/livestatus/src/DownCommColumn.cc
index 7b8ef34..2a42e0c 100644
--- a/livestatus/src/DownCommColumn.cc
+++ b/livestatus/src/DownCommColumn.cc
@@ -69,6 +69,12 @@ void DownCommColumn::output(void *data, Query *query)
query->outputString(dt->_author_name);
query->outputSublistSeparator();
query->outputString(dt->_comment);
+ query->outputSublistSeparator();
+ if(_with_extra_info && !_is_downtime) {
+ query->outputInteger(((Comment*)dt)->_entry_type);
+ query->outputSublistSeparator();
+ query->outputTime(dt->_entry_time);
+ }
query->outputEndSublist();
}
else
diff --git a/livestatus/src/DownCommColumn.h b/livestatus/src/DownCommColumn.h
index dc5cf3b..de0437c 100644
--- a/livestatus/src/DownCommColumn.h
+++ b/livestatus/src/DownCommColumn.h
@@ -36,9 +36,10 @@ class DownCommColumn : public ListColumn
{
bool _is_downtime;
bool _with_info;
+ bool _with_extra_info; // provides date and type
public:
- DownCommColumn(string name, string description, int indirect_offset, bool
is_downtime, bool with_info)
- : ListColumn(name, description, indirect_offset), _is_downtime(is_downtime),
_with_info(with_info) {}
+ DownCommColumn(string name, string description, int indirect_offset, bool
is_downtime, bool with_info, bool with_extra_info)
+ : ListColumn(name, description, indirect_offset), _is_downtime(is_downtime),
_with_info(with_info), _with_extra_info(with_extra_info) {}
int type() { return COLTYPE_LIST; }
void output(void *, Query *);
void *getNagiosObject(char *name);
diff --git a/livestatus/src/TableHosts.cc b/livestatus/src/TableHosts.cc
index 50f0876..731160b 100644
--- a/livestatus/src/TableHosts.cc
+++ b/livestatus/src/TableHosts.cc
@@ -241,13 +241,15 @@ void TableHosts::addColumns(Table *table, string prefix, int
indirect_offset)
table->addColumn(new HostContactsColumn(prefix + "contacts",
"A list of all contacts of this host, either direct or via a contact
group", indirect_offset));
table->addColumn(new DownCommColumn(prefix + "downtimes",
- "A list of the ids of all scheduled downtimes of this host",
indirect_offset, true, false));
+ "A list of the ids of all scheduled downtimes of this host",
indirect_offset, true, false, false));
table->addColumn(new DownCommColumn(prefix + "downtimes_with_info",
- "A list of the all scheduled downtimes of the host with id, author
and comment", indirect_offset, true, true));
+ "A list of the all scheduled downtimes of the host with id, author
and comment", indirect_offset, true, true, false));
table->addColumn(new DownCommColumn(prefix + "comments",
- "A list of the ids of all comments of this host",
indirect_offset, false, false));
+ "A list of the ids of all comments of this host",
indirect_offset, false, false, false));
table->addColumn(new DownCommColumn(prefix + "comments_with_info",
- "A list of all comments of the host with id, author and
comment", indirect_offset, false, true));
+ "A list of all comments of the host with id, author and
comment", indirect_offset, false, true, false));
+ table->addColumn(new DownCommColumn(prefix +
"comments_with_extra_info",
+ "A list of all comments of the host with id, author, comment, entry
type and entry time", indirect_offset, false, true, true));
table->addColumn(new CustomVarsColumn(prefix + "custom_variable_names",
"A list of the names of all custom variables", (char
*)(&hst.custom_variables) - ref, indirect_offset, CVT_VARNAMES));
diff --git a/livestatus/src/TableServices.cc b/livestatus/src/TableServices.cc
index 025cb0f..2154461 100644
--- a/livestatus/src/TableServices.cc
+++ b/livestatus/src/TableServices.cc
@@ -339,13 +339,15 @@ void TableServices::addColumns(Table *table, string prefix, int
indirect_offset,
table->addColumn(new ServiceContactsColumn(prefix + "contacts",
"A list of all contacts of the service, either direct or via a
contact group", indirect_offset));
table->addColumn(new DownCommColumn(prefix + "downtimes",
- "A list of all downtime ids of the service", indirect_offset,
true, false));
+ "A list of all downtime ids of the service", indirect_offset,
true, false, false));
table->addColumn(new DownCommColumn(prefix + "downtimes_with_info",
- "A list of all downtimes of the service with id, author and
comment", indirect_offset, true, true));
+ "A list of all downtimes of the service with id, author and
comment", indirect_offset, true, true, false));
table->addColumn(new DownCommColumn(prefix + "comments",
- "A list of all comment ids of the service", indirect_offset,
false, false));
+ "A list of all comment ids of the service", indirect_offset,
false, false, false));
table->addColumn(new DownCommColumn(prefix + "comments_with_info",
- "A list of all comments of the service with id, author and
comment", indirect_offset, false, true));
+ "A list of all comments of the service with id, author and
comment", indirect_offset, false, true, false));
+ table->addColumn(new DownCommColumn(prefix +
"comments_with_extra_info",
+ "A list of all comments of the service with id, author, comment,
entry type and entry time", indirect_offset, false, true, true));
if (add_hosts)
g_table_hosts->addColumns(this, "host_", (char *)(&svc.host_ptr)
- ref);