From 7069b6ad3cd365f554eec2b1489c76b8dfde739e Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Tue, 6 Oct 2009 11:06:21 +0000 Subject: fix in output of status message for HTTP and FTP --- src/check_curl.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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 ); -- cgit v1.2.3-54-g00ecf