I'm trying to configure exclude_period for some services and it does not work.
This is an extract of my configuration file:
watch test2
service telnet
description test of exclude
interval 1m
monitor tcp.monitor -p 23
exclude_period hr {11am} min {41-45}
period _ANYTIME_
alert snpp.alert _UNIXONCALL_PAGER_
alert netpage.alert _MY_ATT_
This one produces an error :
Error in config file found:
cf error: unknown syntax [exclude_period hr {11am} min {41-45}], line 350
If I put exclude_period line after "period" line, there are no errors,
but service is being tested within excluded period.
If I try to put the exclude line right after "service" line, I get the same
unknown syntax error.
I browsed the mon code for exclude_period string, and I got puzzled by the following:
elsif ($var eq "exclude_period" && 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
{
close (CFG);
return "cf error: unknown syntax [$l], line $line_num";
}
$sref->{$var} = $args;
I think this construction is incorrect. If $var is "exclude_period" and
period in the $args is specified correctly, else part executes producing
"unknown syntax" error message. The statement setting exclude_period in $sref hash
is never executed.
This is the only place processing exclude_period from configuration file that I found.
I'm using version $ProjectVersion: mon-0-99-2.6 $
$ProjectDate: Sat, 08 Sep 2001 10:07:44 -0400 $
Is it a bug or what?
--
Konstantin 'Kastus' Shchuka
Unix System Administrator
ePocrates Inc.
tel 650.232.4886
fax 650.592.6995