Module: check_mk
Branch: master
Commit: 36e4855b65735ab537e8e8b929a57e270d807b0d
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=36e4855b65735a…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Thu Aug 30 09:34:01 2018 +0200
CMK-846 Added structured_status column to host table.
This new column returns the contents of tmp/check_mk/status_data/<hostname>.
Change-Id: Id35bcaf53e23436b6491e6d9ba423bee400a3b35
---
livestatus/src/MonitoringCore.h | 1 +
livestatus/src/TableHosts.cc | 12 ++++++++----
livestatus/src/module.cc | 15 +++++++++++++++
3 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/livestatus/src/MonitoringCore.h b/livestatus/src/MonitoringCore.h
index 9cc4c45..8ed4e80 100644
--- a/livestatus/src/MonitoringCore.h
+++ b/livestatus/src/MonitoringCore.h
@@ -98,6 +98,7 @@ public:
virtual std::string mkeventdSocketPath() = 0;
virtual std::string mkLogwatchPath() = 0;
virtual std::string mkInventoryPath() = 0;
+ virtual std::string structuredStatusPath() = 0;
virtual std::string pnpPath() = 0;
virtual std::string logArchivePath() = 0;
virtual Encoding dataEncoding() = 0;
diff --git a/livestatus/src/TableHosts.cc b/livestatus/src/TableHosts.cc
index fb5c515..793abb5 100644
--- a/livestatus/src/TableHosts.cc
+++ b/livestatus/src/TableHosts.cc
@@ -591,14 +591,18 @@ void TableHosts::addColumns(Table *table, const std::string
&prefix,
HostSpecialIntColumn::Type::mk_inventory_last));
table->addColumn(std::make_unique<HostFileColumn>(
prefix + "mk_inventory",
- "The file content content of the Check_MK HW/SW-Inventory",
- indirect_offset, extra_offset, -1, 0, table->core()->mkInventoryPath(),
- ""));
+ "The file content of the Check_MK HW/SW-Inventory", indirect_offset,
+ extra_offset, -1, 0, table->core()->mkInventoryPath(), ""));
table->addColumn(std::make_unique<HostFileColumn>(
prefix + "mk_inventory_gz",
- "The gzipped file content content of the Check_MK HW/SW-Inventory",
+ "The gzipped file content of the Check_MK HW/SW-Inventory",
indirect_offset, extra_offset, -1, 0, table->core()->mkInventoryPath(),
".gz"));
+ table->addColumn(std::make_unique<HostFileColumn>(
+ prefix + "structured_status",
+ "The file content of the structured status of the Check_MK
HW/SW-Inventory",
+ indirect_offset, extra_offset, -1, 0,
+ table->core()->structuredStatusPath(), ""));
table->addColumn(std::make_unique<LogwatchListColumn>(
prefix + "mk_logwatch_files",
diff --git a/livestatus/src/module.cc b/livestatus/src/module.cc
index 5745f88..afe5e8c 100644
--- a/livestatus/src/module.cc
+++ b/livestatus/src/module.cc
@@ -97,6 +97,7 @@ int g_max_fd_ever = 0;
static char fl_socket_path[4096];
static char fl_pnp_path[4096];
static char fl_mk_inventory_path[4096];
+static char fl_structured_status_path[4096];
static char fl_mk_logwatch_path[4096];
static char fl_logfile_path[4096];
static char fl_mkeventd_socket_path[4096];
@@ -647,6 +648,9 @@ public:
}
std::string mkLogwatchPath() override { return fl_mk_logwatch_path; }
std::string mkInventoryPath() override { return fl_mk_inventory_path; }
+ std::string structuredStatusPath() override {
+ return fl_structured_status_path;
+ }
std::string pnpPath() override { return fl_pnp_path; }
std::string logArchivePath() override {
extern char *log_archive_path;
@@ -1042,6 +1046,17 @@ void livestatus_parse_arguments(const char *args_orig) {
}
check_path("Check_MK Inventory directory",
fl_mk_inventory_path);
+ } else if (strcmp(left, "structured_status_path") == 0) {
+ strncpy(fl_structured_status_path, right,
+ sizeof(fl_structured_status_path) - 1);
+ if (right[strlen(right) - 1] != '/') {
+ strncat(fl_structured_status_path, "/",
+ sizeof(fl_structured_status_path) -
+ strlen(fl_structured_status_path) -
+ 1); // make sure, that trailing slash is there
+ }
+ check_path("Check_MK structured status directory",
+ fl_structured_status_path);
} else if (strcmp(left, "mk_logwatch_path") == 0) {
strncpy(fl_mk_logwatch_path, right,
sizeof(fl_mk_logwatch_path) - 1);