How capable is the `expect` & `send` in protocols.conf?
On Sun, November 5, 2023 19:40, Grant Taylor wrote:
Hi,
How capable is the
expectandsendin protocols.conf?I'm wondering if I can have multiple instances of
expectand / orsendfor 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 lineI 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
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
participants (2)
-
cleaver@terabithia.org
-
gtaylor@tnetconsulting.net