[icinga-checkins] icinga.org: icinga2/next: Livestatus: Fix 'OutputFormat:json' w/ o space is valid (NagVis bug)

git at icinga.org git at icinga.org
Wed Jun 11 22:55:11 CEST 2014


Module: icinga2
Branch: next
Commit: 8d344ebb3a645db55cff3e25428acce12b9dc75c
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=8d344ebb3a645db55cff3e25428acce12b9dc75c

Author: Michael Friedrich <michael.friedrich at gmail.com>
Date:   Wed Jun 11 22:53:56 2014 +0200

Livestatus: Fix 'OutputFormat:json' w/o space is valid (NagVis bug)

Fixes #6470

---

 components/livestatus/livestatusquery.cpp |    7 +++++--
 test/livestatus/queries/host/host_nagvis  |    6 ++++++
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/components/livestatus/livestatusquery.cpp b/components/livestatus/livestatusquery.cpp
index 134b418..698163a 100644
--- a/components/livestatus/livestatusquery.cpp
+++ b/components/livestatus/livestatusquery.cpp
@@ -106,8 +106,11 @@ LivestatusQuery::LivestatusQuery(const std::vector<String>& lines, const String&
 		String header = line.SubStr(0, col_index);
 		String params;
 
-		if (line.GetLength() > col_index + 2)
-			params = line.SubStr(col_index + 2);
+		//OutputFormat:json or OutputFormat: json
+		if (line.GetLength() > col_index + 1)
+			params = line.SubStr(col_index + 1);
+
+		params.Trim();
 
 		if (header == "ResponseHeader")
 			m_ResponseHeader = params;
diff --git a/test/livestatus/queries/host/host_nagvis b/test/livestatus/queries/host/host_nagvis
new file mode 100644
index 0000000..34cdc75
--- /dev/null
+++ b/test/livestatus/queries/host/host_nagvis
@@ -0,0 +1,6 @@
+GET hosts
+Columns: name alias
+OutputFormat:json
+KeepAlive: on
+ResponseHeader: fixed16
+



More information about the icinga-checkins mailing list