summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl DeBisschop <kdebisschop@users.sourceforge.net>2002-09-14 02:27:45 +0000
committerKarl DeBisschop <kdebisschop@users.sourceforge.net>2002-09-14 02:27:45 +0000
commitdde07305649e4eafcc246f770ff65544415d74ad (patch)
tree4247422b210dc51994cc1576903906bb7c6e33e8
parent4907426318fc394c3d11ba71a0694a0732cf8bf0 (diff)
downloadmonitoring-plugins-dde07305649e4eafcc246f770ff65544415d74ad.tar.gz
time data in performance string
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@97 f882894a-f735-0410-b71e-b25c423dba1c
-rw-r--r--plugins/check_http.c35
-rw-r--r--plugins/check_tcp.c6
2 files changed, 21 insertions, 20 deletions
diff --git a/plugins/check_http.c b/plugins/check_http.c
index ecf61288..1b4bae34 100644
--- a/plugins/check_http.c
+++ b/plugins/check_http.c
@@ -726,7 +726,8 @@ check_http (void)
726 726
727 /* Exit here if server_expect was set by user and not default */ 727 /* Exit here if server_expect was set by user and not default */
728 if ( server_expect_yn ) { 728 if ( server_expect_yn ) {
729 msg = ssprintf (msg, "HTTP OK: Status line output matched \"%s\"\n",server_expect); 729 msg = ssprintf (msg, "HTTP OK: Status line output matched \"%s\"\n",
730 server_expect);
730 if (verbose) 731 if (verbose)
731 printf ("%s\n",msg); 732 printf ("%s\n",msg);
732 733
@@ -821,9 +822,9 @@ check_http (void)
821 else if (onredirect == STATE_CRITICAL) 822 else if (onredirect == STATE_CRITICAL)
822 printf ("HTTP CRITICAL"); 823 printf ("HTTP CRITICAL");
823 time (&end_time); 824 time (&end_time);
824 msg = ssprintf (msg, ": %s - %d second response time %s%s\n", 825 msg = ssprintf (msg, ": %s - %d second response time %s%s|time=%d\n",
825 status_line, (int) (end_time - start_time), 826 status_line, (int) (end_time - start_time), timestamp,
826 timestamp, (display_html ? "</A>" : "")); 827 (display_html ? "</A>" : ""), (int) (end_time - start_time));
827 terminate (onredirect, msg); 828 terminate (onredirect, msg);
828 } /* end if (strstr (status_line, "30[0-4]") */ 829 } /* end if (strstr (status_line, "30[0-4]") */
829 830
@@ -833,9 +834,9 @@ check_http (void)
833 834
834 /* check elapsed time */ 835 /* check elapsed time */
835 time (&end_time); 836 time (&end_time);
836 msg = ssprintf (msg, "HTTP problem: %s - %d second response time %s%s\n", 837 msg = ssprintf (msg, "HTTP problem: %s - %d second response time %s%s|time=%d\n",
837 status_line, (int) (end_time - start_time), 838 status_line, (int) (end_time - start_time), timestamp,
838 timestamp, (display_html ? "</A>" : "")); 839 (display_html ? "</A>" : ""), (int) (end_time - start_time));
839 if (check_critical_time == TRUE && (end_time - start_time) > critical_time) 840 if (check_critical_time == TRUE && (end_time - start_time) > critical_time)
840 terminate (STATE_CRITICAL, msg); 841 terminate (STATE_CRITICAL, msg);
841 if (check_warning_time == TRUE && (end_time - start_time) > warning_time) 842 if (check_warning_time == TRUE && (end_time - start_time) > warning_time)
@@ -846,14 +847,14 @@ check_http (void)
846 847
847 if (strlen (string_expect)) { 848 if (strlen (string_expect)) {
848 if (strstr (page, string_expect)) { 849 if (strstr (page, string_expect)) {
849 printf ("HTTP ok: %s - %d second response time %s%s\n", 850 printf ("HTTP ok: %s - %d second response time %s%s|time=%d\n",
850 status_line, (int) (end_time - start_time), 851 status_line, (int) (end_time - start_time),
851 timestamp, (display_html ? "</A>" : "")); 852 timestamp, (display_html ? "</A>" : ""), (int) (end_time - start_time));
852 exit (STATE_OK); 853 exit (STATE_OK);
853 } 854 }
854 else { 855 else {
855 printf ("HTTP CRITICAL: string not found%s\n", 856 printf ("HTTP CRITICAL: string not found%s|time=%d\n",
856 (display_html ? "</A>" : "")); 857 (display_html ? "</A>" : ""), (int) (end_time - start_time));
857 exit (STATE_CRITICAL); 858 exit (STATE_CRITICAL);
858 } 859 }
859 } 860 }
@@ -861,15 +862,15 @@ check_http (void)
861 if (strlen (regexp)) { 862 if (strlen (regexp)) {
862 errcode = regexec (&preg, page, REGS, pmatch, 0); 863 errcode = regexec (&preg, page, REGS, pmatch, 0);
863 if (errcode == 0) { 864 if (errcode == 0) {
864 printf ("HTTP ok: %s - %d second response time %s%s\n", 865 printf ("HTTP ok: %s - %d second response time %s%s|time=%d\n",
865 status_line, (int) (end_time - start_time), 866 status_line, (int) (end_time - start_time),
866 timestamp, (display_html ? "</A>" : "")); 867 timestamp, (display_html ? "</A>" : ""), (int) (end_time - start_time));
867 exit (STATE_OK); 868 exit (STATE_OK);
868 } 869 }
869 else { 870 else {
870 if (errcode == REG_NOMATCH) { 871 if (errcode == REG_NOMATCH) {
871 printf ("HTTP CRITICAL: pattern not found%s\n", 872 printf ("HTTP CRITICAL: pattern not found%s|time=%d\n",
872 (display_html ? "</A>" : "")); 873 (display_html ? "</A>" : ""), (int) (end_time - start_time));
873 exit (STATE_CRITICAL); 874 exit (STATE_CRITICAL);
874 } 875 }
875 else { 876 else {
@@ -882,9 +883,9 @@ check_http (void)
882#endif 883#endif
883 884
884 /* We only get here if all tests have been passed */ 885 /* We only get here if all tests have been passed */
885 msg = ssprintf (msg, "HTTP ok: %s - %d second response time %s%s\n", 886 msg = ssprintf (msg, "HTTP ok: %s - %d second response time %s%s|time=%d\n",
886 status_line, (int) (end_time - start_time), 887 status_line, (int) (end_time - start_time),
887 timestamp, (display_html ? "</A>" : "")); 888 timestamp, (display_html ? "</A>" : ""), (int) (end_time - start_time));
888 terminate (STATE_OK, msg); 889 terminate (STATE_OK, msg);
889 return STATE_UNKNOWN; 890 return STATE_UNKNOWN;
890} 891}
diff --git a/plugins/check_tcp.c b/plugins/check_tcp.c
index bef0e752..c537729f 100644
--- a/plugins/check_tcp.c
+++ b/plugins/check_tcp.c
@@ -300,9 +300,9 @@ main (int argc, char **argv)
300 state_text (result), (int) (end_time - start_time), server_port); 300 state_text (result), (int) (end_time - start_time), server_port);
301 301
302 if (status) 302 if (status)
303 printf (" [%s]\n", status); 303 printf (" [%s]", status);
304 else 304
305 printf ("\n"); 305 printf ("|time=%d\n", (int) (end_time - start_time));
306 306
307 return result; 307 return result;
308} 308}