Re: Alerts during exclude_period

2002-04-05 Thread Joe Rhett


> I changed this logic to 
> 
>   elsif ($var eq "exclude_period")
>   {
>   if (inPeriod (time, $args) == -1)
>   {
>   close(CFG);
>   }
>   }
>   else
>   {
>   close(CFG);
>   }
> 
> so that CFG is not closed when time period is valid and exclude_period is
> being processed further.

Augh. Just for readability, why not...?

elsif ($var ne "exclude_period")
{
close(CFG);
}
else   # $var eq exclude_period
{
if (inPeriod (time, $args) == -1)
{
close(CFG);
}
# Else remain open and process
}

-- 
Joe Rhett  Chief Geek
[EMAIL PROTECTED]  ISite Services, Inc.



Re: Alerts during exclude_period

2002-04-05 Thread Shchuka, Konstantin

On Fri, Apr 05, 2002 at 09:01:21AM -0800, Andrew Ryan wrote:
> This patch is interesting since it doesn't really seem to change the logic 
> of the code, just the syntax (splitting out into another conditional). I'm 
> probably just missing something, can you explain the patch?

The patch does change the logic.

The original logic was:

elsif ($var eq "exclude_period" && inPeriod (time, $args) == -1)
{
close (CFG);
}
else
{
close (CFG);
}


Please note that CFG is getting closed in else part when we are
processing exclude_period and time period is valid.

I changed this logic to 

elsif ($var eq "exclude_period")
{
if (inPeriod (time, $args) == -1)
{
close(CFG);
}
}
else
{
close(CFG);
}

so that CFG is not closed when time period is valid and exclude_period is
being processed further.


> 
> Also, please diff -u or diff -c so readers of your patches can stay sane 
> while reading them :)
> 

Sorry about that, will use that in the future.

Best, -Kastus


-- 
Konstantin 'Kastus' Shchuka
Unix System Administrator
ePocrates Inc.
tel 650.232.4886
fax 650.592.6995

PS Just in case, a unified diff:

--- /usr/local/lib/mon/mon-ORIG Fri Dec 14 12:55:44 2001
+++ /usr/local/lib/mon/mon  Fri Dec 14 14:49:20 2001
@@ -1458,10 +1458,13 @@
$args = $ex;
}
 
-   elsif ($var eq "exclude_period" && inPeriod (time, $args) == -1)
+   elsif ($var eq "exclude_period" )
{
-   close (CFG);
-   return "cf error: malformed exclude_period '$args' (the specified 
time period is not valid as per Time::Period::inPeriod), line $line_num";
+   if (inPeriod (time, $args) == -1)
+   {
+   close (CFG);
+   return "cf error: malformed exclude_period '$args' 
+(the specified time period is not valid as per Time::Period::inPeriod), line 
+$line_num";
+   }
}
 
else



Re: Alerts during exclude_period

2002-04-05 Thread Andrew Ryan

This patch is interesting since it doesn't really seem to change the logic 
of the code, just the syntax (splitting out into another conditional). I'm 
probably just missing something, can you explain the patch?

Also, please diff -u or diff -c so readers of your patches can stay sane 
while reading them :)


thanks,
andrew

At 01:11 PM 4/4/02 -0800, Shchuka, Konstantin wrote:

>I've had to patch mon to make it process exclude_period configuration
>properly. Here is the diff:
>
>1461c1461
><   elsif ($var eq "exclude_period" && inPeriod (time, $args) 
>== -1)
>---
> >   elsif ($var eq "exclude_period" )
>1463,1464c1463,1467
><   close (CFG);
><   return "cf error: malformed exclude_period '$args' 
>(the specified time period is not valid as per Time::Period::inPeriod), 
>line $line_num";
>---
> >   if (inPeriod (time, $args) == -1)
> >   {
> >   close (CFG);
> >   return "cf error: malformed 
> exclude_period '$args' (the specified time period is not valid as per 
> Time::Period::inPeriod), line $line_num";
> >   }
>
>
>--
>Konstantin 'Kastus' Shchuka
>Unix System Administrator
>ePocrates Inc.
>tel 650.232.4886
>fax 650.592.6995




Re: Alerts during exclude_period

2002-04-05 Thread Kevin Ivory

"Shchuka, Konstantin" wrote:
> I've had to patch mon to make it process exclude_period configuration
> properly. Here is the diff:

Thank you. That looks good. I will give it a try.

Best regards,
Kevin
-- 
  _  |  Kevin Ivory  |  Tel: +49-551-3741
 |_ |\ | |  Service Network GmbH |  Fax: +49-551-379
 ._|ER  | \|ET   |  Bahnhofsallee 1b |  mailto:[EMAIL PROTECTED]
Service Network  |  37081 Goettingen |http://www.SerNet.de/



Re: Alerts during exclude_period

2002-04-04 Thread Shchuka, Konstantin

On Thu, Apr 04, 2002 at 01:17:54PM +0200, Kevin Ivory wrote:
> We are getting too many false alarms, especially from services
> with excluded times. The clock on the mon-server is definitely
> okay. Below I have two configuration examples for services
> where we still get alarms at 5:00am resp. 6:00am (the checked
> services are restarted at those times). Have we got the
> configuration wrong? (How to correctly debug?)
> 
> service squid
>  description xxx proxy
> depend xxx-proxy:ping
> interval 2m
> monitor tcp.monitor -p 3128
> period wd {Sun-Sat}
> #   exclude_period hr {4:55am-5:10am}
> exclude_period hr {4am-6am}
> alertafter 2
> alertevery 12h
> alert mail.alert monwatch
> upalert mail.alert -u monwatch
> 
> service xxxping
>  description xxx ping
> depend xyz-xxx:ping
> interval 10m
> monitor fping.monitor -r 3 -t 6000 server ;;
> period wd {Sun-Sat}
> exclude_period hr {5am-7am}
> alertafter 2
> alertevery 12h
> alert mail.alert monwatch
> upalert mail.alert -u monwatch
> 
> Best regards
> Kevin
> -- 
>   _  |  Kevin Ivory  |  Tel: +49-551-3741
>  |_ |\ | |  Service Network GmbH |  Fax: +49-551-379
>  ._|ER  | \|ET   |  Bahnhofsallee 1b |  mailto:[EMAIL PROTECTED]
> Service Network  |  37081 Goettingen |http://www.SerNet.de/

I've had to patch mon to make it process exclude_period configuration
properly. Here is the diff:

1461c1461
<   elsif ($var eq "exclude_period" && inPeriod (time, $args) == -1)
---
>   elsif ($var eq "exclude_period" )
1463,1464c1463,1467
<   close (CFG);
<   return "cf error: malformed exclude_period '$args' (the specified 
time period is not valid as per Time::Period::inPeriod), line $line_num";
---
>   if (inPeriod (time, $args) == -1)
>   {
>   close (CFG);
>   return "cf error: malformed exclude_period '$args' 
>(the specified time period is not valid as per Time::Period::inPeriod), line 
>$line_num";
>   }


-- 
Konstantin 'Kastus' Shchuka
Unix System Administrator
ePocrates Inc.
tel 650.232.4886
fax 650.592.6995



Alerts during exclude_period

2002-04-04 Thread Kevin Ivory

We are getting too many false alarms, especially from services
with excluded times. The clock on the mon-server is definitely
okay. Below I have two configuration examples for services
where we still get alarms at 5:00am resp. 6:00am (the checked
services are restarted at those times). Have we got the
configuration wrong? (How to correctly debug?)

service squid
 description xxx proxy
depend xxx-proxy:ping
interval 2m
monitor tcp.monitor -p 3128
period wd {Sun-Sat}
#   exclude_period hr {4:55am-5:10am}
exclude_period hr {4am-6am}
alertafter 2
alertevery 12h
alert mail.alert monwatch
upalert mail.alert -u monwatch

service xxxping
 description xxx ping
depend xyz-xxx:ping
interval 10m
monitor fping.monitor -r 3 -t 6000 server ;;
period wd {Sun-Sat}
exclude_period hr {5am-7am}
alertafter 2
alertevery 12h
alert mail.alert monwatch
upalert mail.alert -u monwatch

Best regards
Kevin
-- 
  _  |  Kevin Ivory  |  Tel: +49-551-3741
 |_ |\ | |  Service Network GmbH |  Fax: +49-551-379
 ._|ER  | \|ET   |  Bahnhofsallee 1b |  mailto:[EMAIL PROTECTED]
Service Network  |  37081 Goettingen |http://www.SerNet.de/