Xymon Mailing List Archive search

How capable is the `expect` & `send` in protocols.conf?

3 messages in this thread

list Grant Taylor · Sun, 5 Nov 2023 21:40:02 -0600 ·
Hi,

How capable is the `expect` and `send` in protocols.conf?

I'm wondering if I can have multiple instances of `expect` and / or `send` for the same protocol definition.

My current use case is for monitoring of an SMTP server that's using multi-line SMTP greetings.

    220-first line
    220 second line

I want to use the following in protocols.conf but I'm not sure if it will work as desired or not.

    expect "220-"
    expect "220 "
    send "QUIT"

I'd like Xymon to send "QUIT" /after/ it receives the "220 " line (with space).


-- 
Grant. . . .
unix || die
list Japheth Cleaver · Mon, 6 Nov 2023 11:55:48 -0800 ·
quoted from Grant Taylor
On Sun, November 5, 2023 19:40, Grant Taylor wrote:
Hi,

How capable is the `expect` and `send` in protocols.conf?

I'm wondering if I can have multiple instances of `expect` and / or
`send` for the same protocol definition.

My current use case is for monitoring of an SMTP server that's using
multi-line SMTP greetings.

    220-first line
    220 second line

I want to use the following in protocols.conf but I'm not sure if it
will work as desired or not.

    expect "220-"
    expect "220 "
    send "QUIT"

I'd like Xymon to send "QUIT" /after/ it receives the "220 " line (with
space).

Grant,

Unfortunately, xymonnet does not implement the full expect framework.
Based on a re-examination of xymonnet.c and contest.c, I believe we're
just sending the 'send' buffer once, and then collecting whatever is
available in response. The actual comparison (to the "expect" line) looks
to be done later on, when we're deciding colors and creating the status
message results.

IIRC, the lack of delay in waiting for results has caused problems in some
tests before... possibly specifically with SMTP, actually.

(HTTP requests aren't handled the same way, and will always return the
full payload back if configured to retrieve the results.)

-jc
list Grant Taylor · Tue, 7 Nov 2023 00:16:12 -0600 ·
On 11/6/23 1:55?PM, J.C. Cleaver wrote:
Grant,
Hi J.C.
Unfortunately, xymonnet does not implement the full expect framework.
Thank you for confirming.

I suspected that was going to be the case.
Based on a re-examination of xymonnet.c and contest.c, I believe we're just sending the 'send' buffer once, and then collecting whatever is available in response. The actual comparison (to the "expect" line) looks to be done later on, when we're deciding colors and creating the status message results.
That makes sense.

It would be nice if there was a "waitfor" or something like that to not send immediately.

But I understand and support going for simplicity here.
IIRC, the lack of delay in waiting for results has caused problems in some tests before... possibly specifically with SMTP, actually.
Ya.  The type of testing that I'm doing is common anti-spam technique.

I tweaked the anti-spam filter to allow Xymon to send commands immediately.
(HTTP requests aren't handled the same way, and will always return the full payload back if configured to retrieve the results.)
ACK


-- 
Grant. . . .
unix || die