summaryrefslogtreecommitdiffstats
path: root/plugins/check_http.c
diff options
context:
space:
mode:
authorKarl DeBisschop <kdebisschop@users.sourceforge.net>2004-03-03 12:33:15 (GMT)
committerKarl DeBisschop <kdebisschop@users.sourceforge.net>2004-03-03 12:33:15 (GMT)
commit7d7ca121bcabef8ba669c99388b23c1af0ca745e (patch)
tree4c12e32aebc02ad472120456fb053299791b3f93 /plugins/check_http.c
parent3d87bf2c712e16e25956a2306383bd8a108344de (diff)
downloadmonitoring-plugins-7d7ca121bcabef8ba669c99388b23c1af0ca745e.tar.gz
begin writing some perfdata as float
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@841 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/check_http.c')
-rw-r--r--plugins/check_http.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/plugins/check_http.c b/plugins/check_http.c
index b676eec..54bbf00 100644
--- a/plugins/check_http.c
+++ b/plugins/check_http.c
@@ -120,7 +120,7 @@ int check_http (void);
120void redir (char *pos, char *status_line); 120void redir (char *pos, char *status_line);
121int server_type_check(const char *type); 121int server_type_check(const char *type);
122int server_port_check(int ssl_flag); 122int server_port_check(int ssl_flag);
123char *perfd_time (long microsec); 123char *perfd_time (double microsec);
124char *perfd_size (int page_len); 124char *perfd_size (int page_len);
125int my_recv (void); 125int my_recv (void);
126int my_close (void); 126int my_close (void);
@@ -685,7 +685,7 @@ check_http (void)
685 _(" - %s - %.3f second response time %s%s|%s %s\n"), 685 _(" - %s - %.3f second response time %s%s|%s %s\n"),
686 status_line, elapsed_time, timestamp, 686 status_line, elapsed_time, timestamp,
687 (display_html ? "</A>" : ""), 687 (display_html ? "</A>" : ""),
688 perfd_time (microsec), perfd_size (pagesize)); 688 perfd_time (elapsed_time), perfd_size (pagesize));
689 } /* end if (http_status >= 300) */ 689 } /* end if (http_status >= 300) */
690 690
691 } /* end else (server_expect_yn) */ 691 } /* end else (server_expect_yn) */
@@ -697,7 +697,7 @@ check_http (void)
697 _("HTTP problem: %s - %.3f second response time %s%s|%s %s\n"), 697 _("HTTP problem: %s - %.3f second response time %s%s|%s %s\n"),
698 status_line, elapsed_time, timestamp, 698 status_line, elapsed_time, timestamp,
699 (display_html ? "</A>" : ""), 699 (display_html ? "</A>" : ""),
700 perfd_time (microsec), perfd_size (pagesize)); 700 perfd_time (elapsed_time), perfd_size (pagesize));
701 if (check_critical_time == TRUE && elapsed_time > critical_time) 701 if (check_critical_time == TRUE && elapsed_time > critical_time)
702 die (STATE_CRITICAL, "%s", msg); 702 die (STATE_CRITICAL, "%s", msg);
703 if (check_warning_time == TRUE && elapsed_time > warning_time) 703 if (check_warning_time == TRUE && elapsed_time > warning_time)
@@ -711,13 +711,13 @@ check_http (void)
711 printf (_("HTTP OK %s - %.3f second response time %s%s|%s %s\n"), 711 printf (_("HTTP OK %s - %.3f second response time %s%s|%s %s\n"),
712 status_line, elapsed_time, 712 status_line, elapsed_time,
713 timestamp, (display_html ? "</A>" : ""), 713 timestamp, (display_html ? "</A>" : ""),
714 perfd_time (microsec), perfd_size (pagesize)); 714 perfd_time (elapsed_time), perfd_size (pagesize));
715 exit (STATE_OK); 715 exit (STATE_OK);
716 } 716 }
717 else { 717 else {
718 printf (_("CRITICAL - string not found%s|%s %s\n"), 718 printf (_("CRITICAL - string not found%s|%s %s\n"),
719 (display_html ? "</A>" : ""), 719 (display_html ? "</A>" : ""),
720 perfd_time (microsec), perfd_size (pagesize)); 720 perfd_time (elapsed_time), perfd_size (pagesize));
721 exit (STATE_CRITICAL); 721 exit (STATE_CRITICAL);
722 } 722 }
723 } 723 }
@@ -728,14 +728,14 @@ check_http (void)
728 printf (_("HTTP OK %s - %.3f second response time %s%s|%s %s\n"), 728 printf (_("HTTP OK %s - %.3f second response time %s%s|%s %s\n"),
729 status_line, elapsed_time, 729 status_line, elapsed_time,
730 timestamp, (display_html ? "</A>" : ""), 730 timestamp, (display_html ? "</A>" : ""),
731 perfd_time (microsec), perfd_size (pagesize)); 731 perfd_time (elapsed_time), perfd_size (pagesize));
732 exit (STATE_OK); 732 exit (STATE_OK);
733 } 733 }
734 else { 734 else {
735 if (errcode == REG_NOMATCH) { 735 if (errcode == REG_NOMATCH) {
736 printf (_("CRITICAL - pattern not found%s|%s %s\n"), 736 printf (_("CRITICAL - pattern not found%s|%s %s\n"),
737 (display_html ? "</A>" : ""), 737 (display_html ? "</A>" : ""),
738 perfd_time (microsec), perfd_size (pagesize)); 738 perfd_time (elapsed_time), perfd_size (pagesize));
739 exit (STATE_CRITICAL); 739 exit (STATE_CRITICAL);
740 } 740 }
741 else { 741 else {
@@ -758,7 +758,7 @@ check_http (void)
758 asprintf (&msg, _("HTTP OK %s - %d bytes in %.3f seconds %s%s|%s %s\n"), 758 asprintf (&msg, _("HTTP OK %s - %d bytes in %.3f seconds %s%s|%s %s\n"),
759 status_line, page_len, elapsed_time, 759 status_line, page_len, elapsed_time,
760 timestamp, (display_html ? "</A>" : ""), 760 timestamp, (display_html ? "</A>" : ""),
761 perfd_time (microsec), perfd_size (page_len)); 761 perfd_time (elapsed_time), perfd_size (page_len));
762 die (STATE_OK, "%s", msg); 762 die (STATE_OK, "%s", msg);
763 return STATE_UNKNOWN; 763 return STATE_UNKNOWN;
764} 764}
@@ -1045,12 +1045,12 @@ check_certificate (X509 ** certificate)
1045 1045
1046 1046
1047 1047
1048char *perfd_time (long microsec) 1048char *perfd_time (double elapsed_time)
1049{ 1049{
1050 return perfdata ("time", microsec, "us", 1050 return fperfdata ("time", elapsed_time, "s",
1051 check_warning_time, (int)(1e6*warning_time), 1051 check_warning_time, warning_time,
1052 check_critical_time, (int)(1e6*critical_time), 1052 check_critical_time, critical_time,
1053 TRUE, 0, FALSE, 0); 1053 TRUE, 0, FALSE, 0);
1054} 1054}
1055 1055
1056 1056