Guidelines for configuring the TCPPort monitor
The TCPPort monitor tests TCP-based services by connecting to the service, monitoring messages received from the service and sending responses to it.
To configure a test, you define a sequence of expected messages and responses that comprise a normal interaction on that service.
For example, a standard interaction for a telnet service involves the following sequence:
- The telnet service sends a login message, prompting for a username.
- The client sends a response containing a username.
- The telnet service sends a message prompting for a password.
- The client sends a response containing a password.
- If the login attempt is successful, the telnet service sends some form of greeting message.
The monitor's WaitForn and Sendn properties define the expected messages and the responses to those messages. These properties, specified in the monitor properties file, define how the monitor interacts with the TCP service:
- WaitForn properties are regular expressions. The monitor uses them to match messages received on the monitored port.
- Sendn properties are literal strings that the monitor writes to the port.
The format for defining WaitForn and Sendn properties is:
WaitFor1: 1st received message
Send1: 1st response
WaitFor2: 2nd received message
Send2: 2nd response
...
WaitFor5: 5th received message
Send5: 5th response
When the monitor reaches the first unset WaitFor property, it stops sending and receiving. If the MonitorDisconnect property is set to 0, the monitored service must close the connection opened by the monitor otherwise the monitor will report the message Timed out waiting to read in its $message element. With many services you can close the connection by sending a quit command. If MonitorDisconnect is set to 1, the monitor disconnects after the last Send or WaitFor command completes, or the timeout is reached, whichever occurs first.