summaryrefslogtreecommitdiffstats
path: root/plugins/t
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/t')
0 files changed, 0 insertions, 0 deletions
diff --git a/plugins/check_http.c b/plugins/check_http.c
index 6d13010..5e33ec8 100644
--- a/plugins/check_http.c
+++ b/plugins/check_http.c
@@ -662,28 +662,28 @@ check_document_dates (const char *headers)
662 662
663 /* Done parsing the body. Now check the dates we (hopefully) parsed. */ 663 /* Done parsing the body. Now check the dates we (hopefully) parsed. */
664 if (!server_date || !*server_date) { 664 if (!server_date || !*server_date) {
665 die (STATE_UNKNOWN, _("Server date unknown\n")); 665 die (STATE_UNKNOWN, _("HTTP UNKNOWN - Server date unknown\n"));
666 } else if (!document_date || !*document_date) { 666 } else if (!document_date || !*document_date) {
667 die (STATE_CRITICAL, _("Document modification date unknown\n")); 667 die (STATE_CRITICAL, _("HTTP CRITICAL - Document modification date unknown\n"));
668 } else { 668 } else {
669 time_t srv_data = parse_time_string (server_date); 669 time_t srv_data = parse_time_string (server_date);
670 time_t doc_data = parse_time_string (document_date); 670 time_t doc_data = parse_time_string (document_date);
671 671
672 if (srv_data <= 0) { 672 if (srv_data <= 0) {
673 die (STATE_CRITICAL, _("CRITICAL - Server date \"%100s\" unparsable"), server_date); 673 die (STATE_CRITICAL, _("HTTP CRITICAL - Server date \"%100s\" unparsable"), server_date);
674 } else if (doc_data <= 0) { 674 } else if (doc_data <= 0) {
675 die (STATE_CRITICAL, _("CRITICAL - Document date \"%100s\" unparsable"), document_date); 675 die (STATE_CRITICAL, _("HTTP CRITICAL - Document date \"%100s\" unparsable"), document_date);
676 } else if (doc_data > srv_data + 30) { 676 } else if (doc_data > srv_data + 30) {
677 die (STATE_CRITICAL, _("CRITICAL - Document is %d seconds in the future\n"), (int)doc_data - (int)srv_data); 677 die (STATE_CRITICAL, _("HTTP CRITICAL - Document is %d seconds in the future\n"), (int)doc_data - (int)srv_data);
678 } else if (doc_data < srv_data - maximum_age) { 678 } else if (doc_data < srv_data - maximum_age) {
679 int n = (srv_data - doc_data); 679 int n = (srv_data - doc_data);
680 if (n > (60 * 60 * 24 * 2)) 680 if (n > (60 * 60 * 24 * 2))
681 die (STATE_CRITICAL, 681 die (STATE_CRITICAL,
682 _("CRITICAL - Last modified %.1f days ago\n"), 682 _("HTTP CRITICAL - Last modified %.1f days ago\n"),
683 ((float) n) / (60 * 60 * 24)); 683 ((float) n) / (60 * 60 * 24));
684 else 684 else
685 die (STATE_CRITICAL, 685 die (STATE_CRITICAL,
686 _("CRITICAL - Last modified %d:%02d:%02d ago\n"), 686 _("HTTP CRITICAL - Last modified %d:%02d:%02d ago\n"),
687 n / (60 * 60), (n / 60) % 60, n % 60); 687 n / (60 * 60), (n / 60) % 60, n % 60);
688 } 688 }
689 689
@@ -764,7 +764,7 @@ check_http (void)
764 764
765 /* try to connect to the host at the given port number */ 765 /* try to connect to the host at the given port number */
766 if (my_tcp_connect (server_address, server_port, &sd) != STATE_OK) 766 if (my_tcp_connect (server_address, server_port, &sd) != STATE_OK)
767 die (STATE_CRITICAL, _("Unable to open TCP socket\n")); 767 die (STATE_CRITICAL, _("HTTP CRITICAL - Unable to open TCP socket\n"));
768#ifdef HAVE_SSL 768#ifdef HAVE_SSL
769 if (use_ssl == TRUE) { 769 if (use_ssl == TRUE) {
770 np_net_ssl_init(sd); 770 np_net_ssl_init(sd);
@@ -836,15 +836,15 @@ check_http (void)
836 if (use_ssl) { 836 if (use_ssl) {
837 sslerr=SSL_get_error(ssl, i); 837 sslerr=SSL_get_error(ssl, i);
838 if ( sslerr == SSL_ERROR_SSL ) { 838 if ( sslerr == SSL_ERROR_SSL ) {
839 die (STATE_WARNING, _("Client Certificate Required\n")); 839 die (STATE_WARNING, _("HTTP WARNING - Client Certificate Required\n"));
840 } else { 840 } else {
841 die (STATE_CRITICAL, _("Error on receive\n")); 841 die (STATE_CRITICAL, _("HTTP CRITICAL - Error on receive\n"));
842 } 842 }
843 } 843 }
844 else { 844 else {
845 */ 845 */
846#endif 846#endif
847 die (STATE_CRITICAL, _("Error on receive\n")); 847 die (STATE_CRITICAL, _("HTTP CRITICAL - Error on receive\n"));
848#ifdef HAVE_SSL 848#ifdef HAVE_SSL
849 /* XXX 849 /* XXX
850 } 850 }
@@ -854,7 +854,7 @@ check_http (void)
854 854
855 /* return a CRITICAL status if we couldn't read any data */ 855 /* return a CRITICAL status if we couldn't read any data */
856 if (pagesize == (size_t) 0) 856 if (pagesize == (size_t) 0)
857 die (STATE_CRITICAL, _("No data received from host\n")); 857 die (STATE_CRITICAL, _("HTTP CRITICAL - No data received from host\n"));
858 858
859 /* close the connection */ 859 /* close the connection */
860#ifdef HAVE_SSL 860#ifdef HAVE_SSL
@@ -909,7 +909,7 @@ check_http (void)
909 asprintf (&msg, 909 asprintf (&msg,
910 _("Invalid HTTP response received from host on port %d\n"), 910 _("Invalid HTTP response received from host on port %d\n"),
911 server_port); 911 server_port);
912 die (STATE_CRITICAL, "%s", msg); 912 die (STATE_CRITICAL, "HTTP CRITICAL - %s", msg);
913 } 913 }
914 914
915 /* Exit here if server_expect was set by user and not default */ 915 /* Exit here if server_expect was set by user and not default */
@@ -950,13 +950,13 @@ check_http (void)
950 if (onredirect == STATE_DEPENDENT) 950 if (onredirect == STATE_DEPENDENT)
951 redir (header, status_line); 951 redir (header, status_line);
952 else if (onredirect == STATE_UNKNOWN) 952 else if (onredirect == STATE_UNKNOWN)
953 printf (_("UNKNOWN")); 953 printf (_("HTTP UNKNOWN"));
954 else if (onredirect == STATE_OK) 954 else if (onredirect == STATE_OK)
955 printf (_("OK")); 955 printf (_("HTTP OK"));
956 else if (onredirect == STATE_WARNING) 956 else if (onredirect == STATE_WARNING)
957 printf (_("WARNING")); 957 printf (_("HTTP WARNING"));
958 else if (onredirect == STATE_CRITICAL) 958 else if (onredirect == STATE_CRITICAL)
959 printf (_("CRITICAL")); 959 printf (_("HTTP CRITICAL"));
960 microsec = deltime (tv); 960 microsec = deltime (tv);
961 elapsed_time = (double)microsec / 1.0e6; 961 elapsed_time = (double)microsec / 1.0e6;
962 die (onredirect, 962 die (onredirect,
@@ -997,7 +997,7 @@ check_http (void)
997 exit (STATE_OK); 997 exit (STATE_OK);
998 } 998 }
999 else { 999 else {
1000 printf (_("CRITICAL - string not found%s|%s %s\n"), 1000 printf (_("HTTP CRITICAL - string not found%s|%s %s\n"),
1001 (display_html ? "</A>" : ""), 1001 (display_html ? "</A>" : ""),
1002 perfd_time (elapsed_time), perfd_size (pagesize)); 1002 perfd_time (elapsed_time), perfd_size (pagesize));
1003 exit (STATE_CRITICAL); 1003 exit (STATE_CRITICAL);
@@ -1019,7 +1019,7 @@ check_http (void)
1019 else 1019 else
1020 msg = strdup(_("pattern found")); 1020 msg = strdup(_("pattern found"));
1021 printf (("%s - %s%s|%s %s\n"), 1021 printf (("%s - %s%s|%s %s\n"),
1022 _("CRITICAL"), 1022 _("HTTP CRITICAL"),
1023 msg, 1023 msg,
1024 (display_html ? "</A>" : ""), 1024 (display_html ? "</A>" : ""),
1025 perfd_time (elapsed_time), perfd_size (pagesize)); 1025 perfd_time (elapsed_time), perfd_size (pagesize));
@@ -1027,7 +1027,7 @@ check_http (void)
1027 } 1027 }
1028 else { 1028 else {
1029 regerror (errcode, &preg, errbuf, MAX_INPUT_BUFFER); 1029 regerror (errcode, &preg, errbuf, MAX_INPUT_BUFFER);
1030 printf (_("CRITICAL - Execute Error: %s\n"), errbuf); 1030 printf (_("HTTP CRITICAL - Execute Error: %s\n"), errbuf);
1031 exit (STATE_CRITICAL); 1031 exit (STATE_CRITICAL);
1032 } 1032 }
1033 } 1033 }
@@ -1080,11 +1080,11 @@ redir (char *pos, char *status_line)
1080 1080
1081 addr = malloc (MAX_IPV4_HOSTLENGTH + 1); 1081 addr = malloc (MAX_IPV4_HOSTLENGTH + 1);
1082 if (addr == NULL) 1082 if (addr == NULL)
1083 die (STATE_UNKNOWN, _("Could not allocate addr\n")); 1083 die (STATE_UNKNOWN, _("HTTP UNKNOWN - Could not allocate addr\n"));
1084 1084
1085 url = malloc (strcspn (pos, "\r\n")); 1085 url = malloc (strcspn (pos, "\r\n"));
1086 if (url == NULL) 1086 if (url == NULL)
1087 die (STATE_UNKNOWN, _("Could not allocate url\n")); 1087 die (STATE_UNKNOWN, _("HTTP UNKNOWN - Could not allocate url\n"));
1088 1088
1089 while (pos) { 1089 while (pos) {
1090 sscanf (pos, "%[Ll]%*[Oo]%*[Cc]%*[Aa]%*[Tt]%*[Ii]%*[Oo]%*[Nn]:%n", xx, &i); 1090 sscanf (pos, "%[Ll]%*[Oo]%*[Cc]%*[Aa]%*[Tt]%*[Ii]%*[Oo]%*[Nn]:%n", xx, &i);
@@ -1093,7 +1093,7 @@ redir (char *pos, char *status_line)
1093 pos += (size_t) strspn (pos, "\r\n"); 1093 pos += (size_t) strspn (pos, "\r\n");
1094 if (strlen(pos) == 0) 1094 if (strlen(pos) == 0)
1095 die (STATE_UNKNOWN, 1095 die (STATE_UNKNOWN,
1096 _("UNKNOWN - Could not find redirect location - %s%s\n"), 1096 _("HTTP UNKNOWN - Could not find redirect location - %s%s\n"),
1097 status_line, (display_html ? "</A>" : "")); 1097 status_line, (display_html ? "</A>" : ""));
1098 continue; 1098 continue;
1099 } 1099 }
@@ -1103,7 +1103,7 @@ redir (char *pos, char *status_line)
1103 1103
1104 url = realloc (url, strcspn (pos, "\r\n")); 1104 url = realloc (url, strcspn (pos, "\r\n"));
1105 if (url == NULL) 1105 if (url == NULL)
1106 die (STATE_UNKNOWN, _("could not allocate url\n")); 1106 die (STATE_UNKNOWN, _("HTTP UNKNOWN - could not allocate url\n"));
1107 1107
1108 /* URI_HTTP, URI_HOST, URI_PORT, URI_PATH */ 1108 /* URI_HTTP, URI_HOST, URI_PORT, URI_PATH */
1109 if (sscanf (pos, HD1, type, addr, port, url) == 4) { 1109 if (sscanf (pos, HD1, type, addr, port, url) == 4) {
@@ -1146,7 +1146,7 @@ redir (char *pos, char *status_line)
1146 1146
1147 else { 1147 else {
1148 die (STATE_UNKNOWN, 1148 die (STATE_UNKNOWN,
1149 _("UNKNOWN - Could not parse redirect location - %s%s\n"), 1149 _("HTTP UNKNOWN - Could not parse redirect location - %s%s\n"),
1150 pos, (display_html ? "</A>" : "")); 1150 pos, (display_html ? "</A>" : ""));
1151 } 1151 }
1152 1152
@@ -1156,7 +1156,7 @@ redir (char *pos, char *status_line)
1156 1156
1157 if (++redir_depth > max_depth) 1157 if (++redir_depth > max_depth)
1158 die (STATE_WARNING, 1158 die (STATE_WARNING,
1159 _("WARNING - maximum redirection depth %d exceeded - %s://%s:%d%s%s\n"), 1159 _("HTTP WARNING - maximum redirection depth %d exceeded - %s://%s:%d%s%s\n"),
1160 max_depth, type, addr, i, url, (display_html ? "</A>" : "")); 1160 max_depth, type, addr, i, url, (display_html ? "</A>" : ""));
1161 1161
1162 if (server_port==i && 1162 if (server_port==i &&
@@ -1164,7 +1164,7 @@ redir (char *pos, char *status_line)
1164 (host_name && !strcmp(host_name, addr)) && 1164 (host_name && !strcmp(host_name, addr)) &&
1165 !strcmp(server_url, url)) 1165 !strcmp(server_url, url))
1166 die (STATE_WARNING, 1166 die (STATE_WARNING,
1167 _("WARNING - redirection creates an infinite loop - %s://%s:%d%s%s\n"), 1167 _("HTTP WARNING - redirection creates an infinite loop - %s://%s:%d%s%s\n"),
1168 type, addr, i, url, (display_html ? "</A>" : "")); 1168 type, addr, i, url, (display_html ? "</A>" : ""));
1169 1169
1170 server_port = i; 1170 server_port = i;