LONGSERVICEOUTPUT or Multiline check output on nagios log

An open discussion forum for obtaining help with Nagios Core. Nagios Core users of all experience levels are welcome here. Subforum have been created for the discussion of Nagios Core and Nagios Plugin development.

NOTE: The SourceForge.net mailing lists have been deprecated in favor of this forum in order to expedite support and provide additional features not available on the old mailing list.

LONGSERVICEOUTPUT or Multiline check output on nagios log

Postby khmon » Thu Jun 15, 2017 2:57 pm

Hello

We are currently developing some checks that output information on multiline format. For example

OK/WARN/CRIT Myservice | Perfdata
Line1
Line2
Line3


Now, the issue (Nagios 4.3.1, Linux Centos 7) is that I do see the events on the main log file, the current status on status.dat, but for historic purposes, I don't seem to find the multi-line output of a check on nagios.log. That is the log contains

[timestamp] .... OK/WARN/CRIT Myservice

The thing is that I don't see any "Line1 ... Line3" in there.

Are we doing something wrong or status.dat's long_plugin_output is not logged on nagios.log? Should we enable some setting?
khmon
 
Posts: 2
Joined: Thu Jun 15, 2017 2:49 pm

Re: LONGSERVICEOUTPUT or Multiline check output on nagios lo

Postby lmiltchev » Fri Jun 16, 2017 10:46 am

There is a feature request for adding this functionality to Nagios Core - see here: https://github.com/NagiosEnterprises/nagioscore/issues/262
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
lmiltchev
QA Manager
 
Posts: 9264
Joined: Mon May 23, 2011 12:15 pm

Re: LONGSERVICEOUTPUT or Multiline check output on nagios lo

Postby khmon » Tue Jun 20, 2017 8:49 am

Thanks for your feedback!

Is there an ETA for when that request may be completed?

I was able to get it to work for the time being by editing base/logging.c , and updating log_service_event() to do:

asprintf(&temp_buffer, "SERVICE ALERT: %s;%s;%s;%s;%d;%s;%s\n",
svc->host_name, svc->description,
service_state_name(svc->current_state),
state_type_name(svc->state_type),
svc->current_attempt,
(svc->plugin_output == NULL) ? "" : svc->plugin_output,
(svc->long_plugin_output == NULL) ? "" : svc->long_plugin_output);

The last "(svc->long_plugin_output == NULL) ? "" : svc->long_plugin_output)" and the additional ",%s" is the minimum required to get the nagios long (multiline) plugin output saved to the nagios.log fie.

I haven't dived enough into the code as to know if nagios.h "MAX_PLUGIN_OUTPUT_LENGTH" also controls the amount of data a plugin can send back to nagios. Will try to look for that.

I have tried to see how feasible it would be to submit this code, but I'd need to dive at the code to see how options are submitted and managed on the code to add "options" if the only way to get this in the codebase is to have some sort of a "log_long_pluging_output 1" on nagios.cfg.

There might be other places beyond SERVICE ALERT where something like this might be required, though.
khmon
 
Posts: 2
Joined: Thu Jun 15, 2017 2:49 pm

Re: LONGSERVICEOUTPUT or Multiline check output on nagios lo

Postby tgriep » Tue Jun 20, 2017 3:35 pm

It looks like the enhancement is in review so there is not any time frame on when or if it will be released.
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
tgriep
Madmin
 
Posts: 5330
Joined: Thu Oct 30, 2014 9:02 am


Return to Nagios Core

Who is online

Users browsing this forum: Bing [Bot] and 9 guests