summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Baumann <abaumann@yahoo.com>2009-10-06 11:06:21 +0000
committerAndreas Baumann <abaumann@yahoo.com>2009-10-06 11:06:21 +0000
commit7069b6ad3cd365f554eec2b1489c76b8dfde739e (patch)
tree2b321773c4a1e1cd2bd3e6c908cb587a4f154ebc
parentfe2b5e365b2850e77b063584b3fd23d9090e231c (diff)
downloadnagios-plugin-curl-7069b6ad3cd365f554eec2b1489c76b8dfde739e.tar.gz
nagios-plugin-curl-7069b6ad3cd365f554eec2b1489c76b8dfde739e.tar.bz2
fix in output of status message for HTTP and FTP
-rw-r--r--src/check_curl.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/check_curl.c b/src/check_curl.c
index 5d0f6fa..bd7f95f 100644
--- a/src/check_curl.c
+++ b/src/check_curl.c
@@ -49,6 +49,8 @@ int main( int argc, char *argv[] ) {
char perfstring[1024];
curlhelp_statusline status_line;
const char *protocol;
+ const char *answer_protocol;
+ const char *answer_protocol_version;
cmdline_parser_init( &args_info );
@@ -223,11 +225,20 @@ int main( int argc, char *argv[] ) {
/* free header list, we don't need it anymore */
curl_slist_free_all( header_list );
+
+ /* set answer protocol */
+ if( strcmp( protocol, "http" ) == 0 ) {
+ answer_protocol = "HTTP";
+ answer_protocol_version = "";
+ } else if( strcmp( protocol, "ftp" ) == 0 ) {
+ answer_protocol = "FTP";
+ answer_protocol_version = "";
+ }
/* Curl errors, result in critical Nagios state */
if( res != CURLE_OK ) {
remove_newlines( errbuf );
- printf( "HTTP CRITICAL - %s (error: %d)\n", errbuf, res );
+ printf( "%s CRITICAL - %s (error: %d)\n", answer_protocol, errbuf, res );
curl_easy_cleanup( curl );
curl_global_cleanup( );
curlhelp_freebuffer( &body_buf );