summaryrefslogtreecommitdiffstats
path: root/plugins/check_http.c
diff options
context:
space:
mode:
authorBenoit Mortier <opensides@users.sourceforge.net>2004-12-01 23:54:51 +0000
committerBenoit Mortier <opensides@users.sourceforge.net>2004-12-01 23:54:51 +0000
commitd19edd4043c498626fe68308005947975ef0a697 (patch)
tree7a213ee16f9331e928b1c32aa6c521c05519db58 /plugins/check_http.c
parent1d8128e328f714258b7fec0c62245e1d187e0439 (diff)
downloadmonitoring-plugins-d19edd4043c498626fe68308005947975ef0a697.tar.gz
standardize localization string
standardize unknow arguments git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@969 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/check_http.c')
-rw-r--r--plugins/check_http.c39
1 files changed, 21 insertions, 18 deletions
diff --git a/plugins/check_http.c b/plugins/check_http.c
index 98005d02..748ca46e 100644
--- a/plugins/check_http.c
+++ b/plugins/check_http.c
@@ -14,6 +14,8 @@
14 along with this program; if not, write to the Free Software 14 along with this program; if not, write to the Free Software
15 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 15 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
16 16
17 $Id$
18
17******************************************************************************/ 19******************************************************************************/
18/* splint -I. -I../../plugins -I../../lib/ -I/usr/kerberos/include/ ../../plugins/check_http.c */ 20/* splint -I. -I../../plugins -I../../lib/ -I/usr/kerberos/include/ ../../plugins/check_http.c */
19 21
@@ -188,7 +190,7 @@ main (int argc, char **argv)
188#endif 190#endif
189 return result; 191 return result;
190} 192}
191 193
192 194
193 195
194/* process command-line arguments */ 196/* process command-line arguments */
@@ -249,7 +251,9 @@ process_arguments (int argc, char **argv)
249 251
250 switch (c) { 252 switch (c) {
251 case '?': /* usage */ 253 case '?': /* usage */
252 usage3 (_("unknown argument"), optopt); 254 printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
255 print_usage ();
256 exit (STATE_UNKNOWN);
253 break; 257 break;
254 case 'h': /* help */ 258 case 'h': /* help */
255 print_help (); 259 print_help ();
@@ -267,7 +271,7 @@ process_arguments (int argc, char **argv)
267 break; 271 break;
268 case 'c': /* critical time threshold */ 272 case 'c': /* critical time threshold */
269 if (!is_nonnegative (optarg)) 273 if (!is_nonnegative (optarg))
270 usage2 (_("invalid critical threshold"), optarg); 274 usage2 (_("Critical threshold must be integer"), optarg);
271 else { 275 else {
272 critical_time = strtod (optarg, NULL); 276 critical_time = strtod (optarg, NULL);
273 check_critical_time = TRUE; 277 check_critical_time = TRUE;
@@ -275,7 +279,7 @@ process_arguments (int argc, char **argv)
275 break; 279 break;
276 case 'w': /* warning time threshold */ 280 case 'w': /* warning time threshold */
277 if (!is_nonnegative (optarg)) 281 if (!is_nonnegative (optarg))
278 usage2 (_("invalid warning threshold"), optarg); 282 usage2 (_("Warning threshold must be integer"), optarg);
279 else { 283 else {
280 warning_time = strtod (optarg, NULL); 284 warning_time = strtod (optarg, NULL);
281 check_warning_time = TRUE; 285 check_warning_time = TRUE;
@@ -304,13 +308,13 @@ process_arguments (int argc, char **argv)
304 case 'C': /* Check SSL cert validity */ 308 case 'C': /* Check SSL cert validity */
305#ifdef HAVE_SSL 309#ifdef HAVE_SSL
306 if (!is_intnonneg (optarg)) 310 if (!is_intnonneg (optarg))
307 usage2 (_("invalid certificate expiration period"), optarg); 311 usage2 (_("Invalid certificate expiration period"), optarg);
308 else { 312 else {
309 days_till_exp = atoi (optarg); 313 days_till_exp = atoi (optarg);
310 check_cert = TRUE; 314 check_cert = TRUE;
311 } 315 }
312#else 316#else
313 usage (_("check_http: invalid option - SSL is not available\n")); 317 usage (_("Invalid option - SSL is not available\n"));
314#endif 318#endif
315 break; 319 break;
316 case 'f': /* onredirect */ 320 case 'f': /* onredirect */
@@ -455,7 +459,7 @@ process_arguments (int argc, char **argv)
455 459
456 return TRUE; 460 return TRUE;
457} 461}
458 462
459 463
460 464
461/* written by lauri alanko */ 465/* written by lauri alanko */
@@ -498,8 +502,6 @@ base64 (const char *bin, size_t len)
498 buf[i] = '\0'; 502 buf[i] = '\0';
499 return buf; 503 return buf;
500} 504}
501
502
503 505
504 506
505 507
@@ -613,6 +615,7 @@ parse_time_string (const char *string)
613} 615}
614 616
615 617
618
616static void 619static void
617check_document_dates (const char *headers) 620check_document_dates (const char *headers)
618{ 621{
@@ -818,12 +821,12 @@ check_http (void)
818 if ( sslerr == SSL_ERROR_SSL ) { 821 if ( sslerr == SSL_ERROR_SSL ) {
819 die (STATE_WARNING, _("Client Certificate Required\n")); 822 die (STATE_WARNING, _("Client Certificate Required\n"));
820 } else { 823 } else {
821 die (STATE_CRITICAL, _("Error in recv()\n")); 824 die (STATE_CRITICAL, _("Error on receive\n"));
822 } 825 }
823 } 826 }
824 else { 827 else {
825#endif 828#endif
826 die (STATE_CRITICAL, _("Error in recv()\n")); 829 die (STATE_CRITICAL, _("Error on receive\n"));
827#ifdef HAVE_SSL 830#ifdef HAVE_SSL
828 } 831 }
829#endif 832#endif
@@ -950,7 +953,7 @@ check_http (void)
950 microsec = deltime (tv); 953 microsec = deltime (tv);
951 elapsed_time = (double)microsec / 1.0e6; 954 elapsed_time = (double)microsec / 1.0e6;
952 asprintf (&msg, 955 asprintf (&msg,
953 _("HTTP problem: %s - %.3f second response time %s%s|%s %s\n"), 956 _("HTTP WARNING: %s - %.3f second response time %s%s|%s %s\n"),
954 status_line, elapsed_time, timestamp, 957 status_line, elapsed_time, timestamp,
955 (display_html ? "</A>" : ""), 958 (display_html ? "</A>" : ""),
956 perfd_time (elapsed_time), perfd_size (pagesize)); 959 perfd_time (elapsed_time), perfd_size (pagesize));
@@ -1021,7 +1024,6 @@ check_http (void)
1021 1024
1022 1025
1023 1026
1024
1025/* per RFC 2396 */ 1027/* per RFC 2396 */
1026#define HDR_LOCATION "%*[Ll]%*[Oo]%*[Cc]%*[Aa]%*[Tt]%*[Ii]%*[Oo]%*[Nn]: " 1028#define HDR_LOCATION "%*[Ll]%*[Oo]%*[Cc]%*[Aa]%*[Tt]%*[Ii]%*[Oo]%*[Nn]: "
1027#define URI_HTTP "%[HTPShtps]://" 1029#define URI_HTTP "%[HTPShtps]://"
@@ -1223,6 +1225,8 @@ int connect_SSL (void)
1223} 1225}
1224#endif 1226#endif
1225 1227
1228
1229
1226#ifdef HAVE_SSL 1230#ifdef HAVE_SSL
1227int 1231int
1228check_certificate (X509 ** certificate) 1232check_certificate (X509 ** certificate)
@@ -1298,7 +1302,7 @@ check_certificate (X509 ** certificate)
1298 return STATE_OK; 1302 return STATE_OK;
1299} 1303}
1300#endif 1304#endif
1301 1305
1302 1306
1303 1307
1304char *perfd_time (double elapsed_time) 1308char *perfd_time (double elapsed_time)
@@ -1310,6 +1314,7 @@ char *perfd_time (double elapsed_time)
1310} 1314}
1311 1315
1312 1316
1317
1313char *perfd_size (int page_len) 1318char *perfd_size (int page_len)
1314{ 1319{
1315 return perfdata ("size", page_len, "B", 1320 return perfdata ("size", page_len, "B",
@@ -1319,6 +1324,7 @@ char *perfd_size (int page_len)
1319} 1324}
1320 1325
1321 1326
1327
1322int 1328int
1323my_recv (void) 1329my_recv (void)
1324{ 1330{
@@ -1337,6 +1343,7 @@ my_recv (void)
1337} 1343}
1338 1344
1339 1345
1346
1340int 1347int
1341my_close (void) 1348my_close (void)
1342{ 1349{
@@ -1357,9 +1364,6 @@ my_close (void)
1357 1364
1358 1365
1359 1366
1360
1361
1362
1363void 1367void
1364print_help (void) 1368print_help (void)
1365{ 1369{
@@ -1483,7 +1487,6 @@ the certificate is expired.\n"));
1483 1487
1484 1488
1485 1489
1486
1487void 1490void
1488print_usage (void) 1491print_usage (void)
1489{ 1492{