Package: nagios-plugins Version: 1.4.12-3 If told to follow redirects, check_http follows exactly disregarding any supplied IP address. Of course this might be what you want.
The included patch adds another option to the -f|--on-redirect switch which will follow but still connect to the same host. It might be considered a bug that even if an IP address is NOT given, the same host will be connected to. --- check_http.c~ 2008-05-07 11:02:42.000000000 +0100 +++ check_http.c 2008-10-17 09:45:38.000000000 +0100 @@ -110,6 +110,7 @@ char **http_opt_headers; int http_opt_headers_count = 0; int onredirect = STATE_OK; +int follow_same_ip = FALSE; int use_ssl = FALSE; int verbose = FALSE; int sd; @@ -302,6 +303,11 @@ server_port = HTTPS_PORT; break; case 'f': /* onredirect */ + if (!strcmp (optarg, "follow-same-ip")) + { + onredirect = STATE_DEPENDENT; + follow_same_ip = TRUE; + } if (!strcmp (optarg, "follow")) onredirect = STATE_DEPENDENT; if (!strcmp (optarg, "unknown")) @@ -1151,8 +1158,11 @@ free (host_name); host_name = strdup (addr); - free (server_address); - server_address = strdup (addr); + if (!follow_same_ip) + { + free (server_address); + server_address = strdup (addr); + } free (server_url); if ((url[0] == '/')) @@ -1169,8 +1179,12 @@ display_html ? "</A>" : ""); if (verbose) - printf (_("Redirection to %s://%s:%d%s\n"), server_type, - host_name ? host_name : server_address, server_port, server_url); + { + printf (_("Redirection to %s://%s:%d%s\n"), server_type, + host_name ? host_name : server_address, server_port, server_url); + if (!host_name) + printf (_("Connecting to %s.\n"), server_address); + } check_http (); } @@ -1292,7 +1306,7 @@ printf (" %s\n", _(" Any other tags to be sent in http header. Use multiple times for additional headers")); printf (" %s\n", "-L, --link"); printf (" %s\n", _("Wrap output in HTML link (obsoleted by urlize)")); - printf (" %s\n", "-f, --onredirect=<ok|warning|critical|follow>"); + printf (" %s\n", "-f, --onredirect=<ok|warning|critical|follow|follow-same-ip>"); printf (" %s\n", _("How to handle redirected pages")); printf (" %s\n", "-m, --pagesize=INTEGER<:INTEGER>"); printf (" %s\n", _("Minimum page size required (bytes) : Maximum page size required (bytes)")); @@ -1346,7 +1360,7 @@ printf (_("Usage:")); printf (" %s -H <vhost> | -I <IP-address> [-u <uri>] [-p <port>]\n",progname); printf (" [-w <warn time>] [-c <critical time>] [-t <timeout>] [-L]\n"); - printf (" [-a auth] [-f <ok | warn | critcal | follow>] [-e <expect>]\n"); + printf (" [-a auth] [-f <ok | warn | critcal | follow | follow-same-ip>] [-e <expect>]\n"); printf (" [-s string] [-l] [-r <regex> | -R <case-insensitive regex>] [-P string]\n"); printf (" [-m <min_pg_size>:<max_pg_size>] [-4|-6] [-N] [-M <age>] [-A string]\n"); printf (" [-k string] [-S] [-C <age>] [-T <content-type>]\n"); -- I must take issue with the term "a mere child", for it has been my invariable experience that the company of a mere child is infinitely preferable to that of a mere adult. -- Fran Lebowitz -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]