monit-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: parsing-error-strangeness


From: Jan-Henrik Haukeland
Subject: Re: parsing-error-strangeness
Date: Thu, 07 Aug 2003 12:21:31 +0200
User-agent: Gnus/5.1002 (Gnus v5.10.2) XEmacs/21.4 (Civil Service, linux)

Christian Hopp <address@hidden> writes:

> Having a new monit syntax is a good situation to test monit's
> parsing error behavior.

Good thing we did some syntax refactoring then :-)

>  These are just some testing results:
>
> 1) Default poll time:
>
> In case set daemon is omitted, monit does check one.  Poll time is set
> to zero?  Is that behavior okay?

Yes, the user did not request that monit should run in daemon mode so
monit runs just once. This is the same as running 'monit validate'. I
think this is in the doc, if not we should add it. BTW, based on this
I found out that if set daemon is omitted but monit is started with -I
the poll time is actually 0 and monit polls at 0 interval!! This is
much worse, it's fixed now though.


> 2) Errors at the end:
>
> Consider this monitrc, with old syntax, thus erroneous:
>
> --------------SNIP-------------
> check process crond with pidfile /var/run/crond.pid
>       depends ssh
>
> check process ssh with pidfile /var/run/sshd.pid
>       port 22 protocol ssh
> --------------SNAP-------------
>
> The error message is:
> (address@hidden) ~/compile/monit/monit> ./monit -c ../monitrc-test-short -v -I
> monit: syntax error '' at line 4
> Exit 1
>
> It should complain over line 5 and not with ''.

Hit yourself on the head :-) I had to fix the line number counting in
l.l for SERVICETOKENS you added and the reporting is better but it is
still not perfect because of this, it may be off by one or more lines:


  [ \n\t]+[^,]    {
                    lineno++;
                    unput(yytext[strlen(yytext)-1]);
                    BEGIN(INITIAL);
                  }

lineno is incremented once but since [ \n\t]+[^,] may contain more
than one \n line number is off by the number of \n + 1. I have been up
all night and is to tired to find a good solution for this, but maybe
you can?


> 3) Depends beyond errors:
>
> Now consider this monitrc, with old syntax, thus also erroneous:
>
> --------------SNIP-------------
> check process crond with pidfile /var/run/crond.pid
>       depends inetd
>
> check process ssh with pidfile /var/run/sshd.pid
>       port 22 protocol ssh
>
> check process inetd with pidfile /var/run/inetd.pid
> --------------SNAP-------------
>
> The result:
>
> (address@hidden) ~/compile/monit/monit> ./monit -c ../monitrc-test-short -v -I
> monit: syntax error 'check process ' at line 5
> monit: Error, depend service 'inetd' is not defined in the control file
> Exit 1
>
> The first error is correct, but the second depend error is false.  It
> can lead to confusion.

Fixed. Only the depend error is reported and we do not post-analyze
the depend graph if there was an error in the parser.


-- 
Jan-Henrik Haukeland




reply via email to

[Prev in Thread] Current Thread [Next in Thread]