From 006597a12d28d9cd752b3eeb56dff3bc97049f4c 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 The development guidelines¹ currently state that the plugin output should be in the format "SERVICE STATUS: Information text". However, the SERVICE and STATUS information is redundant, as the plugin caller (e.g., Nagios) should know which SERVICE is checked and the STATUS is returned via the plugin's exit code. After discussing² this issue on the development list, we decided to make the plugin output configurable at compile time (separately for "normal" and "verbose" output). ¹ http://nagiosplug.sf.net/developer-guidelines.html ² http://thread.gmane.org/gmane.network.nagios.plugins.devel/5155 Signed-off-by: Holger Weiss --- configure.in | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'configure.in') diff --git a/configure.in b/configure.in index 68ac0a00..a4b5e968 100644 --- a/configure.in +++ b/configure.in @@ -39,6 +39,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 @@ -150,6 +183,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