[icinga-checkins] icinga.org: icinga-core/dev/ido: core: pass long_output to neb api for statechange data #2650

git at icinga.org git at icinga.org
Thu Jun 21 11:07:33 CEST 2012


Module: icinga-core
Branch: dev/ido
Commit: 6ac57881f1c22c7429ba008420fdf6255092080b
URL:    https://git.icinga.org/?p=icinga-core.git;a=commit;h=6ac57881f1c22c7429ba008420fdf6255092080b

Author: Michael Friedrich <michael.friedrich at univie.ac.at>
Date:   Wed May 30 15:26:56 2012 +0200

core: pass long_output to neb api for statechange data #2650

currently, the neb api does not pass any longoutput, which idomod could
forward to ido2db then. ido* fakes that using the normal output, which
is pretty much misleading.

as this is a change on the neb api, it's scheduled for the next major
release. compatibility is restored adding the attribute at the end,
where old object typecasts will just cut it off (so those neb modules
using the nagios header files will not know about it, but still work).

refs #2650

Signed-off-by: Michael Friedrich <michael.friedrich at univie.ac.at>

---

 Changelog                    |    9 ++++++++-
 base/broker.c                |    2 ++
 include/nebstructs.h         |    2 ++
 module/idoutils/src/idomod.c |    3 +--
 4 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/Changelog b/Changelog
index e9bb03c..9eda1b6 100644
--- a/Changelog
+++ b/Changelog
@@ -6,11 +6,18 @@ Thanks to all contributers, testers and developers. Please read AUTHORS and THAN
 
 1.8.0 - XX/10/2012
 
-FIXES
+ENHANCEMENTS
+* core: pass long_output to neb api for statechange data #2650 - MF
 
+
+FIXES
 * idoutils: do not pass host and port if not set in the config, letting mysql|pgsql drivers autoselect the socket #2698 - MF
 
 
+CHANGES
+* core: neb struct statechange data += long_ouput #2650 - MF
+
+
 1.7.1 - 18/06/2012
 
 FIXES
diff --git a/base/broker.c b/base/broker.c
index 99e35f6..a964945 100644
--- a/base/broker.c
+++ b/base/broker.c
@@ -978,11 +978,13 @@ void broker_statechange_data(int type, int flags, int attr, int statechange_type
 		ds.host_name = temp_service->host_name;
 		ds.service_description = temp_service->description;
 		ds.output = temp_service->plugin_output;
+		ds.long_output = temp_service->long_plugin_output;
 	} else {
 		temp_host = (host *)data;
 		ds.host_name = temp_host->name;
 		ds.service_description = NULL;
 		ds.output = temp_host->plugin_output;
+		ds.long_output = temp_host->long_plugin_output;
 	}
 	ds.object_ptr = data;
 	ds.state = state;
diff --git a/include/nebstructs.h b/include/nebstructs.h
index e451db5..d3584b1 100644
--- a/include/nebstructs.h
+++ b/include/nebstructs.h
@@ -530,6 +530,8 @@ typedef struct nebstruct_statechange_struct{
 	char            *output;
 
 	void            *object_ptr;
+	/* do not break the api */
+	char            *long_output;
         }nebstruct_statechange_data;
 
 #ifdef __cplusplus
diff --git a/module/idoutils/src/idomod.c b/module/idoutils/src/idomod.c
index 07593c4..b9ae0c7 100644
--- a/module/idoutils/src/idomod.c
+++ b/module/idoutils/src/idomod.c
@@ -3038,8 +3038,7 @@ int idomod_broker_data(int event_type, void *data) {
 		es[0] = ido_escape_buffer(schangedata->host_name);
 		es[1] = ido_escape_buffer(schangedata->service_description);
 		es[2] = ido_escape_buffer(schangedata->output);
-		/* Preparing if servicecheck change data will have long_output in the future */
-		es[3] = ido_escape_buffer(schangedata->output);
+		es[3] = ido_escape_buffer(schangedata->long_output);
 
 		snprintf(temp_buffer, IDOMOD_MAX_BUFLEN - 1
 		         , "\n%d:\n%d=%d\n%d=%d\n%d=%d\n%d=%ld.%ld\n%d=%d\n%d=%s\n%d=%s\n%d=%d\n%d=%d\n%d=%d\n%d=%d\n%d=%d\n%d=%d\n%d=%d\n%d=%s\n%d=%s\n%d\n\n"





More information about the icinga-checkins mailing list