From 92bb86c484c3d52c5ffdfa790f7a5acf68edcc36 Mon Sep 17 00:00:00 2001 From: Holger Weiss Date: Wed, 22 Apr 2009 00:28:53 +0200 Subject: Make C plugin output format configurable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit *** THIS COMMIT WILL BE MODIFIED IN THE FUTURE! *** The development guidelines¹ currently state that the plugin output should be in the format "SERVICE STATUS: Information text". However, when a plugin is called via Nagios in order to perform a service check, adding SERVICE and STATUS to the output is redundant. And when a plugin is called on the command line for testing, there is no use in printing out the SERVICE string, either. However, for debugging, it does make sense to print out the STATUS so that the user won't have to check and interpret the exit code manually. But it should suffice to print such debug output only when called with "--verbose", not in production. Space for plugin output is sometimes scarce, so that we should try to keep the output "short and to the point" (as the guide states) and not waste space with redundant information. Therefore, we decided² to make the ("normal" and "verbose") plugin output configurable at compile time. ¹ http://nagiosplug.sf.net/developer-guidelines.html ² http://thread.gmane.org/gmane.network.nagios.plugins.devel/5155 --- configure.in | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'configure.in') diff --git a/configure.in b/configure.in index 9067978a..474522d4 100644 --- a/configure.in +++ b/configure.in @@ -40,6 +40,39 @@ INSTALL="$INSTALL $extra_install_args" INSTALL_STRIP_PROGRAM="$INSTALL_STRIP_PROGRAM $extra_install_args" AC_SUBST(INSTALL) +dnl Configure the plugin output format +default_output_format="%s %x: %i\n" +AC_ARG_WITH([standard_output_format], + [AS_HELP_STRING([--with-standard-output-format=FORMAT], + [specify the standard plugin output FORMAT; %p, %s, %x, and %m + will be replaced by the plugin name, the service name, the + status string, and the information message, respectively; tabs + or newlines can be inserted using \t or \n + @<:@default="%s %x: %m\n"@:>@])], + [standard_output_format=$withval], + [standard_output_format="yes"]) +AC_ARG_WITH([verbose_output_format], + [AS_HELP_STRING([--with-verbose-output-format=FORMAT], + [specify the verbose plugin output FORMAT; %p, %s, %x, and %m + will be replaced by the plugin name, the service name, the + status string, and the information message, respectively; tabs + or newlines can be inserted using \t or \n + @<:@default="%s %x: %m\n"@:>@])], + [verbose_output_format=$withval], + [verbose_output_format="yes"]) +AS_IF([test "$standard_output_format" = yes], + [standard_output_format=$default_output_format], + [test "$standard_output_format" = no], + [standard_output_format=""], + [test "$verbose_output_format" = yes], + [verbose_output_format=$default_output_format], + [test "$verbose_output_format" = no], + [verbose_output_format=""]) +AC_DEFINE_UNQUOTED([STANDARD_OUTPUT_FORMAT], ["$standard_output_format"], + [Define the standard plugin output format.]) +AC_DEFINE_UNQUOTED([VERBOSE_OUTPUT_FORMAT], ["$verbose_output_format"], + [Define the verbose plugin output format.]) + AC_PROG_CC gl_EARLY AC_PROG_GCC_TRADITIONAL @@ -147,6 +180,11 @@ AC_CHECK_LIB(socket,socket,SOCKETLIBS="$SOCKETLIBS -lsocket") AC_CHECK_LIB(resolv,main,SOCKETLIBS="$SOCKETLIBS -lresolv") AC_SUBST(SOCKETLIBS) +dnl check for basename(3) which needs -lgen on some systems (e.g. IRIX) +AC_CHECK_HEADERS([libgen.h]) +AC_SEARCH_LIBS([basename], [gen]) +AC_CHECK_FUNCS([basename]) + dnl dnl check for math-related functions needing -lm AC_CHECK_HEADERS(math.h) -- cgit v1.2.3-74-g34f1