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 --- plugins/utils.c | 17 ----------------- plugins/utils.h | 2 -- 2 files changed, 19 deletions(-) (limited to 'plugins') diff --git a/plugins/utils.c b/plugins/utils.c index 0e79fbdb..5967647a 100644 --- a/plugins/utils.c +++ b/plugins/utils.c @@ -121,23 +121,6 @@ print_revision (const char *command_name, const char *revision_string) command_name, clean_revstring(revision_string), PACKAGE, VERSION); } -const char * -state_text (int result) -{ - switch (result) { - case STATE_OK: - return "OK"; - case STATE_WARNING: - return "WARNING"; - case STATE_CRITICAL: - return "CRITICAL"; - case STATE_DEPENDENT: - return "DEPENDENT"; - default: - return "UNKNOWN"; - } -} - void timeout_alarm_handler (int signo) { diff --git a/plugins/utils.h b/plugins/utils.h index f15a7b16..98d19d20 100644 --- a/plugins/utils.h +++ b/plugins/utils.h @@ -84,8 +84,6 @@ void usage4(const char *) __attribute__((noreturn)); void usage5(void) __attribute__((noreturn)); void usage_va(const char *fmt, ...) __attribute__((noreturn)); -const char *state_text (int); - #define max(a,b) (((a)>(b))?(a):(b)) #define min(a,b) (((a)<(b))?(a):(b)) -- cgit v1.2.3-74-g34f1