]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
DW:
authorwessels <>
Mon, 26 Jun 2000 07:38:37 +0000 (07:38 +0000)
committerwessels <>
Mon, 26 Jun 2000 07:38:37 +0000 (07:38 +0000)
 - Make statAvgTick() print WARNINGS at debug level 0 if memory usage,
   response time, or page faults exceed admin-defined thresholds.

src/cf.data.pre
src/stat.cc
src/structs.h

index 1a395f72617e9de37e6a5337085e996ef35e4f85..3e1466900aee13c5c2efa840db519a7d744ea319 100644 (file)
@@ -1,6 +1,6 @@
 
 #
-# $Id: cf.data.pre,v 1.189 2000/06/25 22:41:21 wessels Exp $
+# $Id: cf.data.pre,v 1.190 2000/06/26 01:38:37 wessels Exp $
 #
 #
 # SQUID Internet Object Cache  http://squid.nlanr.net/Squid/
@@ -3194,5 +3194,37 @@ DOC_START
        You can add up to 20 additional "extension" methods here.
 DOC_END
 
+NAME: high_response_time_warning
+TYPE: int
+COMMENT: (msec)
+LOC: Config.warnings.high_rptm
+DEFAULT: 0
+DOC_START
+       If the one-minute median response time exceeds this value,
+       Squid prints a WARNING with debug level 0 to get the
+       administrators attention.  The value is in milliseconds.
+DOC_END
+
+NAME: high_page_fault_warning
+TYPE: int
+LOC: Config.warnings.high_pf
+DEFAULT: 0
+DOC_START
+       If the one-minute average page fault rate exceeds this
+       value, Squid prints a WARNING with debug level 0 to get
+       the administrators attention.  The value is in page faults
+       per second.
+DOC_END
+
+NAME: high_memory_warning
+TYPE: b_size_t
+LOC: Config.warnings.high_memory
+DEFAULT: 0
+DOC_START
+       If the memory usage (as determined by mallinfo) exceeds
+       value, Squid prints a WARNING with debug level 0 to get
+       the administrators attention.
+DOC_END
+
 EOF
 
index 7af228f63d1fe030269c310b10f675da37aec0e3..34ce9e0c996469cd8e5718285716f934b9ca7cc4 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: stat.cc,v 1.328 2000/05/16 07:09:34 wessels Exp $
+ * $Id: stat.cc,v 1.329 2000/06/26 01:38:37 wessels Exp $
  *
  * DEBUG: section 18    Cache Manager Statistics
  * AUTHOR: Harvest Derived
@@ -903,6 +903,31 @@ statAvgTick(void *notused)
        statCountersCopy(t, c);
        NCountHourHist++;
     }
+    if (Config.warnings.high_rptm > 0) {
+       int i = (int) statMedianSvc(1, MEDIAN_HTTP);
+       if (Config.warnings.high_rptm < i)
+           debug(18, 0) ("WARNING: Median response time is %d milliseconds\n", i);
+    }
+    if (Config.warnings.high_pf) {
+       int i = (CountHist[0].page_faults - CountHist[1].page_faults);
+       double dt = tvSubDsec(CountHist[0].timestamp, CountHist[1].timestamp);
+       if (i > 0 && dt > 0.0)
+           i /= (int) dt;
+       if (Config.warnings.high_pf < i)
+           debug(18, 0) ("WARNING: Page faults occuring at %d/sec\n", i);
+    }
+    if (Config.warnings.high_memory) {
+       int i = 0;
+#if HAVE_MSTATS && HAVE_GNUMALLOC_H
+       struct mstats ms = mstats();
+       i = ms.bytes_total;
+#elif HAVE_MALLINFO && HAVE_STRUCT_MALLINFO
+       struct mallinfo mp = mallinfo();
+       i = mp.arena;
+#endif
+       if (Config.warnings.high_pf < i)
+           debug(18, 0) ("WARNING: Memory usage at %d MB\n", i >> 20);
+    }
 }
 
 static void
index a401f96bedab48cb37a18a51a19d8d524883ae85..09ee833f1952e659bae9e4567f5317c00584faa3 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: structs.h,v 1.341 2000/06/25 22:41:22 wessels Exp $
+ * $Id: structs.h,v 1.342 2000/06/26 01:38:38 wessels Exp $
  *
  *
  * SQUID Internet Object Cache  http://squid.nlanr.net/Squid/
@@ -499,6 +499,11 @@ struct _SquidConfig {
     } digest;
 #endif
     wordlist *ext_methods;
+    struct {
+       int high_rptm;
+       int high_pf;
+       int high_memory;
+    } warnings;
 };
 
 struct _SquidConfig2 {