summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorHolger Weiss <hweiss@users.sourceforge.net>2009-04-22 00:28:53 +0200
committerHolger Weiss <hweiss@users.sourceforge.net>2009-04-22 00:47:29 +0200
commit92bb86c484c3d52c5ffdfa790f7a5acf68edcc36 (patch)
treee2195501bf3b67b373c9c3ddd0a5f0330d0209ed /plugins
parent05a980ba4bd3de0540771000955bd3235ad17acd (diff)
downloadmonitoring-plugins-92bb86c484c3d52c5ffdfa790f7a5acf68edcc36.tar.gz
Make C plugin output format configurable
*** 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
Diffstat (limited to 'plugins')
-rw-r--r--plugins/utils.c17
-rw-r--r--plugins/utils.h2
2 files changed, 0 insertions, 19 deletions
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)
121 command_name, clean_revstring(revision_string), PACKAGE, VERSION); 121 command_name, clean_revstring(revision_string), PACKAGE, VERSION);
122} 122}
123 123
124const char *
125state_text (int result)
126{
127 switch (result) {
128 case STATE_OK:
129 return "OK";
130 case STATE_WARNING:
131 return "WARNING";
132 case STATE_CRITICAL:
133 return "CRITICAL";
134 case STATE_DEPENDENT:
135 return "DEPENDENT";
136 default:
137 return "UNKNOWN";
138 }
139}
140
141void 124void
142timeout_alarm_handler (int signo) 125timeout_alarm_handler (int signo)
143{ 126{
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));
84void usage5(void) __attribute__((noreturn)); 84void usage5(void) __attribute__((noreturn));
85void usage_va(const char *fmt, ...) __attribute__((noreturn)); 85void usage_va(const char *fmt, ...) __attribute__((noreturn));
86 86
87const char *state_text (int);
88
89#define max(a,b) (((a)>(b))?(a):(b)) 87#define max(a,b) (((a)>(b))?(a):(b))
90#define min(a,b) (((a)<(b))?(a):(b)) 88#define min(a,b) (((a)<(b))?(a):(b))
91 89