On 09/12/2024 10:10, Hauke Fath wrote:
I tried to play with the smtp chat in protocols.cfg
[smtp] expect "220" send "ehlo xymonnet.localdomain\r\n" expect "250" send "quit\r\n" expect "221" options banner port 25
without success. tcpdump(8)ing the communication, I was quite surprised to find that whatever I entered for the smtp chat, I always see xymon sending a 'quit', and sendmail returning a "220" banner.
I think you've misunderstood how protocols.cfg works. Rather than definining a series of send/expects in a conversational manner, you get to specify a single "send" string and a single "expect" string (though you can omit either or both when defining your service). See "man protocols.cfg". Also, based on past mailing list posts, if you specify multiple send/expect lines for a service in protocol.cfg it looks like in practice only the last instance of each type of line in the cfg file is used, i.e. your config is equivalent to:
[smtp] send "quit\r\n" expect "221" options banner port 25
which seems to match your described behaviour.
I think you need a custom script to perform this test rather than using a service defined in protocols.cfg (NB tests of services defined in protocols.cfg are performed by xymonnet; there's no specific code for handling smtp. The only impact of naming the service "smtp" in protocols.cfg is that that's the column name used when generating the xymon report)
Adam