summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Baumann <abaumann@yahoo.com>2008-10-09 19:22:45 +0000
committerAndreas Baumann <abaumann@yahoo.com>2008-10-09 19:22:45 +0000
commitb86bace98ed84c0b97a7dafa12fc4c07f3a7e9fe (patch)
tree1409cd9abd2db1c7cf1c0ceaaa4096960feb62a0
parent98980b1b1601d1540eaff919489f3c83e594f0af (diff)
downloadnagios-plugin-curl-b86bace98ed84c0b97a7dafa12fc4c07f3a7e9fe.tar.gz
nagios-plugin-curl-b86bace98ed84c0b97a7dafa12fc4c07f3a7e9fe.tar.bz2
- added user agent
-rw-r--r--README7
-rw-r--r--src/check_curl.c5
-rw-r--r--src/check_curl.ggo5
-rw-r--r--tests/useragent5
4 files changed, 22 insertions, 0 deletions
diff --git a/README b/README
index c8e8296..c9ea428 100644
--- a/README
+++ b/README
@@ -3,3 +3,10 @@ Replacement for check_http from the nagios-plugins package.
Feel free to contact me at <abaumann at yahoo dot com> in case of questions,
suggestions, patches, etc.
+Differences to check_http:
+- Additional option --config-file <configfile>, a gengetopt feature, allows
+ storing command line options in a configuration file
+
+Status of supported options:
+- -w and -c support only fixed values, no ranges
+
diff --git a/src/check_curl.c b/src/check_curl.c
index f95547b..011c8ee 100644
--- a/src/check_curl.c
+++ b/src/check_curl.c
@@ -28,6 +28,7 @@
#include "common.h"
#include "curlhelper.h"
+#include "utils.h"
#define DEFAULT_TIMEOUT (double)10.0
@@ -120,6 +121,10 @@ int main( int argc, char *argv[] ) {
if( args_info.authorization_given )
curl_easy_setopt( curl, CURLOPT_USERPWD, args_info.authorization_arg );
+ /* user agent */
+ if( args_info.useragent_given )
+ curl_easy_setopt( curl, CURLOPT_USERAGENT, args_info.useragent_arg );
+
/* compose URL */
snprintf( b, 2048, "http%s://%s%s",
args_info.ssl_given ? "s" : "",
diff --git a/src/check_curl.ggo b/src/check_curl.ggo
index f0b8eaa..2654c54 100644
--- a/src/check_curl.ggo
+++ b/src/check_curl.ggo
@@ -88,3 +88,8 @@ option "string" s "String to expect in the content"
option "ssl" S "Connect via SSL. Port defaults to 443"
optional
+
+option "useragent" A "String to be sent in http header as \"User Agent\""
+ string
+ typestr="STRING"
+ optional
diff --git a/tests/useragent b/tests/useragent
new file mode 100644
index 0000000..eef5e93
--- /dev/null
+++ b/tests/useragent
@@ -0,0 +1,5 @@
+v
+A "check_nagios_curl - Test (+http://nagios-plugin-curl.origo.ethz.ch)"
+I www.yahoo.com
+H www.yahoo.com
+u "/"