Xymon Mailing List Archive search

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

list Japheth Cleaver
Mon, 6 Nov 2023 11:55:48 -0800
Message-Id: <user-364b3e1a6c3a@xymon.invalid>

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