Using depend ...

2007-12-10 Thread Jacques Klein
I added "depend " lines to some of my services in my mon.cf, and 
also "dep_behavior = hm"
I am using mon-1.2.0 where I added
use strict;
use warnings;
for debugging purpose.

I get
   Use of uninitialized value in concatenation (.) or string at 
/symlnks/common/dsnmon/2.0/mond line 5324
This happens at
} elsif ($watch{$group}->{$service}{"_last_failure_time"} >= (time - 
$watch{$group}->{$service}{"dep_memory"})) {
, it seems that $watch{$group}->{$service}{"_last_failure_time"} is 
undefined.

The unix command "grep _last_failure_time mon"
$depval = $SUCCESS{$sref->{"_op_status"}} && 
($sref->{"_last_failure_time"} < (time - $sref->{"dep_memory"}));
  && ($sref->{"_last_failure_time"} < (time - 
$sref->{"dep_memory"}));
} elsif ($watch{$group}->{$service}{"_last_failure_time"} >= 
(time - $watch{$group}->{$service}{"dep_memory"})) {

shows that$sref->{"_last_failure_time"} is used but never set .


___
mon mailing list
mon@linux.kernel.org
http://linux.kernel.org/mailman/listinfo/mon


Re: Using depend ...

2007-12-10 Thread Jim Trocki
On Mon, 10 Dec 2007, Jacques Klein wrote:

> also "dep_behavior = hm"
> I am using mon-1.2.0 where I added

>
> shows that$sref->{"_last_failure_time"} is used but never set .
>

Try this patch and let me know if it helps:


--- mon 2007-12-10 13:35:43.0 -0500
+++ mon-dep 2007-12-10 13:38:48.0 -0500
@@ -1392,6 +1392,7 @@
$sref->{"_start_of_monitor"} = time if 
(!defined($sref->{"_start_of_monitor"}));
$sref->{"_alert_count"} = 0 if 
(!defined($sref->{"_alert_count"}));
$sref->{"_last_failure"} = 0 if 
(!defined($sref->{"_last_failure"}));
+   $sref->{"_last_failure_time"} = 0 if 
(!defined($sref->{"_last_failure_time"}));
$sref->{"_last_success"} = 0 if 
(!defined($sref->{"_last_success"}));
$sref->{"_last_trap"} = 0 if (!defined($sref->{"_last_trap"}));
$sref->{"_last_traphost"} = '' if 
(!defined($sref->{"_last_traphost"}));
@@ -3287,6 +3288,7 @@
$sref->{"_failure_count"}++;
$sref->{"_consec_failures"}++;
$sref->{"_last_failure"} = $tmnow;
+   $sref->{"_last_failure_time"} = $tmnow; # used by the "dep_memory" 
option
if ($sref->{"_op_status"} == $STAT_OK ||
$sref->{"_op_status"} == $STAT_UNKNOWN ||
$sref->{"_op_status"} == $STAT_UNTESTED)

___
mon mailing list
mon@linux.kernel.org
http://linux.kernel.org/mailman/listinfo/mon