]> git.pld-linux.org Git - packages/cacti-plugin-thold.git/commitdiff
Division by zero error fix
authorJacek Konieczny <jajcus@jajcus.net>
Tue, 11 Dec 2012 16:50:10 +0000 (17:50 +0100)
committerJacek Konieczny <jajcus@jajcus.net>
Tue, 11 Dec 2012 16:50:10 +0000 (17:50 +0100)
The plugin would fail with:

> PHP Warning:  Division by zero in /usr/share/cacti/plugins/thold/thold_functions.php on line 1590

when a baseline threshold was breached and no re-alert interval was
defined for that threshold.

cacti-plugin-thold-division_by_zero.patch [new file with mode: 0644]
cacti-plugin-thold.spec

diff --git a/cacti-plugin-thold-division_by_zero.patch b/cacti-plugin-thold-division_by_zero.patch
new file mode 100644 (file)
index 0000000..547ffbe
--- /dev/null
@@ -0,0 +1,12 @@
+diff -dur cacti-plugin-thold-0.4.9.orig/thold/thold_functions.php cacti-plugin-thold-0.4.9/thold/thold_functions.php
+--- cacti-plugin-thold-0.4.9.orig/thold/thold_functions.php    2012-12-11 17:47:07.000000000 +0100
++++ cacti-plugin-thold-0.4.9/thold/thold_functions.php 2012-12-11 17:48:34.789180077 +0100
+@@ -1587,7 +1587,7 @@
+                       thold_debug('Threshold Baseline check breached');
+                       /* re-alert? */
+-                      $ra = ($item['bl_fail_count'] > $bl_fail_trigger && ($item['bl_fail_count'] % ($item['repeat_alert'] == '' ? $realert : $item['repeat_alert'])) == 0);
++                      $ra = ($item['bl_fail_count'] > $bl_fail_trigger && ($item['bl_fail_count'] % ($item['repeat_alert'] == 0 ? $realert : $item['repeat_alert'])) == 0);
+                       $notify = ($item['bl_fail_count'] == $bl_fail_trigger || $ra);
index 31c856a55ff09af33e102e2867be201163dcda3a..f425ca5941a9f20e8e41a946480a2bd81230da64 100644 (file)
@@ -11,6 +11,7 @@ Group:                Applications/WWW
 Source0:       http://docs.cacti.net/_media/plugin:thold-v%{version}-3.tgz
 # Source0-md5: 18fa28a60cafa0d9821fb5d9a8cf7823
 Patch0:                %{name}-undefined_variable_subject.patch
+Patch1:                %{name}-division_by_zero.patch
 URL:           http://docs.cacti.net/plugin:thold
 BuildRequires: rpm-php-pearprov >= 4.4.2-11
 Requires:      cacti
@@ -48,6 +49,7 @@ mv %{plugin}/{LICENSE,README} .
 %{__rm} thold/includes/.settings.php.swp
 
 %patch0 -p1
+%patch1 -p1
 
 %install
 rm -rf $RPM_BUILD_ROOT
This page took 0.078562 seconds and 4 git commands to generate.