monit-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Implement totalmemory percentage testing


From: Michel Marti
Subject: [PATCH] Implement totalmemory percentage testing
Date: Fri, 07 Jan 2005 13:46:26 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20041007 Debian/1.7.3-5

Hello all,

Is there a reason why testing for totalmemory percentage usage is not implemented in monit-cvs? The test "if totalmemory is greater than 30% then restart" results in "error -- unknown resource ID: [9]". If not, here is a patch that adds totalmemory percentage testing.

Regards,

Michel

------------------------------------------------------------------------
diff -u -r1.130 validate.c
--- validate.c  6 Jan 2005 20:51:49 -0000 1.130
+++ validate.c  7 Jan 2005 12:38:18 -0000
@@ -694,6 +694,21 @@
     }
     break;

+  case RESOURCE_ID_TOTAL_MEM_PERCENT:
+    if(Util_evalQExpression(pr->operator, s->inf->total_mem_percent, 
pr->limit)) {
+      snprintf(report, STRLEN,
+        "'%s' total mem amount of %.1f%% matches resource limit"
+        " [total mem amount%s%.1f%%]",
+        s->name, (float)s->inf->total_mem_percent/10,
+        operatorshortnames[pr->operator], (float) pr->limit/10.0);
+      okay= FALSE;
+    } else {
+      DEBUG("'%s' total mem amount check passed "
+        "[current total mem amount=%.1f%%]\n", s->name,
+        (float)s->inf->total_mem_percent/10);
+    }
+    break;
+
   default:
     log("'%s' error -- unknown resource ID: [%d]\n", s->name, pr->resource_id);
     return;
------------------------------------------------------------------------




reply via email to

[Prev in Thread] Current Thread [Next in Thread]