Multiline plugin output problem


#1

Hi

I have a problem with nagios web interface. In the service details page, all services are listed. They are in ok status. The problem is, status information column shows only one line of information.

When i check the status of a service by clicking on its link under ‘service’ column in service details page, a new page opens with detailed information on service i.e. ‘next scheduled check’, ‘last state change’. In this page i can see whole status information so i am pretty much sure that my services are working correctly

Any suggestion is appreciated

btw, i am using nagios 3.0.6


#2

While reading nagios 3.0 manual, i found out that my configuration was not correct at all.

i made these changes in nagios.cfg file

host_perfdata_command=process-host-perfdata
service_perfdata_command=process-service-perfdata

and these changes in commands.cfg file

define command{
	command_name	process-host-perfdata
	command_line	/usr/bin/printf "%b" "$LASTHOSTCHECK$\t$HOSTNAME$\t$HOSTSTATE$\t$HOSTATTEMPT$\t$HOSTSTATETYPE$\t$HOSTEXECUTIONTIME$\t$HOSTOUTPUT$\t$LONGHOSTOUTPUT$\t$HOSTPERFDATA$\n" >> /usr/local/nagios/var/host-perfdata.out
	}
define command{
	command_name	process-service-perfdata
	command_line	/usr/bin/printf "%b" "$LASTSERVICECHECK$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICEOUTPUT$\t$LONGSERVICEOUTPUT$\t$SERVICEPERFDATA$\n" >> /usr/local/nagios/var/service-perfdata.out
	}

With this configuration, nagios writes $longserviceoutput$ ,which is essential for me, to service-perfdata.out. I think i am closer to my goal. If only i manage to write longserviceoutput to status information column in service details page


#3

i solved my problem by editing nagios source code. it is probably not a good solution but worked for me… I am pretty much sure that it is possible to display multiline output by changing configuration files but in case you are desperate for a quick solution here is my solution:

1-) enter nagios-3.0.6/cgi/ directory
2-) open status.c
3-) ctrl+f plugin_output
4-) edit source code like this:

printf("%s “,(temp_status->plugin_output==NULL)?”":html_encode(temp_status->plugin_output,TRUE));

if(temp_status->long_plugin_output!=NULL)
{
printf("
%s&bnsp;", html_encode(temp_status->long_plugin_output,TRUE));
}

5-) make
6-) copy status.cgi to a safe location
7-) install nagios as usual
:sunglasses: copy status.cgi (step 6) to /usr/local/nagios/sbin
9-) restart nagios