Package: monit
Version: 1:4.10.1-4
Severity: important

Under certain circumstances on some VPSes monit can't do process
monitoring due to a zero cpu count - this is now fixed upstream, and I
have attached a patch that fixes the debian package for this issue.

Thanks,
-- 
Brett Parker
diff -rNU4 debian/monit-4.10.1/debian/changelog mine/monit-4.10.1/debian/changelog
--- debian/monit-4.10.1/debian/changelog	2009-03-02 09:49:47.000000000 +0000
+++ mine/monit-4.10.1/debian/changelog	2009-03-02 09:47:03.000000000 +0000
@@ -1,4 +1,17 @@
+monit (1:4.10.1-4+lenny0.1) stable; urgency=low
+
+  * Real fix for the CPU count bug - if we get 0 CPUs report 1.
+
+ -- Brett Parker <idu...@sommitrealweird.co.uk>  Sat, 28 Feb 2009 16:32:34 +0000
+
+monit (1:4.10.1-4+lenny0) stable; urgency=low
+
+   * Adds patch to stop divide by zero bug taken from the trunk
+
+ -- Brett Parker <idu...@sommitrealweird.co.uk>  Wed, 25 Feb 2009 15:38:10 +0000
+
+
 monit (1:4.10.1-4) unstable; urgency=low
 
   * Patch for config file location was not applied (Closes: #479357)
     (thanks to DVZ-Team <dv-zent...@fh-giessen.de>)
diff -rNU4 debian/monit-4.10.1/debian/patches/00list mine/monit-4.10.1/debian/patches/00list
--- debian/monit-4.10.1/debian/patches/00list	2009-03-02 09:49:47.000000000 +0000
+++ mine/monit-4.10.1/debian/patches/00list	2009-03-02 09:47:03.000000000 +0000
@@ -1,2 +1,3 @@
 config_file_relocation
 monit.1-debian-path
+cpu_count_fix
diff -rNU4 debian/monit-4.10.1/debian/patches/cpu_count_fix.dpatch mine/monit-4.10.1/debian/patches/cpu_count_fix.dpatch
--- debian/monit-4.10.1/debian/patches/cpu_count_fix.dpatch	1970-01-01 01:00:00.000000000 +0100
+++ mine/monit-4.10.1/debian/patches/cpu_count_fix.dpatch	2009-03-02 09:47:03.000000000 +0000
@@ -0,0 +1,26 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## cpu_count_fix.dpatch nicked from the 5.0 beta branch
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: No description.
+
+...@dpatch@
+--- monit-4.10.1.a/process/sysdep_LINUX.c	2007-07-29 21:23:26.000000000 +0100
++++ monit-4.10.1.b/process/sysdep_LINUX.c	2009-02-28 16:22:54.910031274 +0000
+@@ -134,12 +134,15 @@
+     DEBUG("system statistic error -- cannot get real memory amount\n");
+     return FALSE;
+   }
+ 
+-  if((num_cpus = sysconf(_SC_NPROCESSORS_CONF)) == -1)
++  if((num_cpus = sysconf(_SC_NPROCESSORS_CONF)) < 0)
+   {
+     DEBUG("system statistic error -- cannot get cpu count: %s\n", STRERROR);
+     return FALSE;
++  } else if (num_cpus == 0) {
++    DEBUG("system reports cpu count 0, setting dummy cpu count 1\n");
++    num_cpus = 1;
+   }
+ 
+   if((page_size = sysconf(_SC_PAGESIZE)) <= 0) {
+     DEBUG("system statistic error -- cannot get page size: %s\n", STRERROR);

Reply via email to