TCPPort Monitor
The TCPPort monitor provides coverage for services that are not tested by the other monitors. It detects and responds to commands or strings on a TCP port. This monitor is particularly useful for monitoring bespoke services.
| Monitor files | Name or location |
|---|---|
| Monitor executable | nco_m_tcpport |
| Properties file | $ISHOME/etc/props/tcpport.props |
| Rules file | $ISHOME/etc/rules/tcpport.rules |
| Log file | $ISHOME/log/tcpport.log |
- 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 that contains a username.
- The telnet service sends a message that prompts a password.
- The client sends a response that contains a password.
- If the login attempt is successful, the telnet service sends some form of greeting message.
The monitor's WaitForn and Sendn properties, which are specified define the expected messages and the responses to those messages. These properties 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 that are received on the monitored port.
- Sendn properties are literal strings that the monitor writes to the port.
Note: If required, you can insert control characters into these properties by using a text editor that supports control character insertion.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 responseWhen 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 that is opened by the monitor otherwise the monitor reports the message Timed out waiting to read in its $message element. With many services, connection can be closed 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.
- Configuring the TCPPort monitor service test
-
Use the TCPPort monitor configuration parameters to define service tests.
Table 2. TCPPort configuration Field Description server The IP address of the system on which the target service is running. Example is server.mycompany.com port The port on which to connect to the target service. description A text field for providing descriptive information on the element. timeout The time, in seconds, to wait for the server to respond.
Default: 30
poll The time, in seconds, between each poll.
Default: 300
failureretests The number of times to retest before failure is indicated.
Default: 0
retestinterval The time, in seconds, to wait between each failure retest.
Default: 10
Note: Monitor the availability of thetelnetservice that runs on the hostserver.mycompany.comon port 23. Use the credentialsuserorguestto log in to the server and close the connection immediately after login. Run the test at 5-minute intervals, and set a 10-second timeout on connection attempts.1.Add the following entries to the TCPPort properties file:
WaitFor1: ".*[Ll]ogin:" Send1: "user" WaitFor2: ".*[Pp]assword:" Send2: "guest" WaitFor3: ".*%" Send3: "exit"
2.Start or Restart the TCPPort monitor.
- Regular expression matches
-
Perform a regular expression search on the information that is downloaded by entering up to 50 different regular expressions. The TCPPort monitor attempts to match the contents that are retrieved to each of the regular expressions. If a match for a specified regular expression is found, the matched lines (or as much as can fit in the monitor’s internal buffer) are returned in the corresponding
$regexpMatchnelement. If the regular expression matches more than once in the information downloaded, only the first match is returned. The status of each regular expression test is indicated by the$regexpStatusnelements. You can use the regular expression matches and their status information as criteria for service level classifications.For more information, see Table 3.
- Monitor elements
-
The following table describes the additional elements for the TCPPort monitor.
Elements indicated by an asterisk (*) are available as attributes. The names of the attributes are shown within brackets. Absence of an asterisk indicates there’s no equivalent attribute. Attributes that are shown in bracket but without an element indicates that they are only available as attributes, there’s no equivalent element.
In addition to the test results common to all elements, the TCPPort monitor generates a set of test results that contain data specific to TCPPort service tests.
Table 3. TCPPort monitor elements Element Description $bytesPerSecThe average number of bytes transferred each second. $bytesTransferredThe number of bytes uploaded or downloaded. $connectTime*(ConnectTime)The time taken to establish a connection with the target server. $downloadTime*(DownloadTime)The time taken to download data. $lastlineThere’sThe contents of the last line received from the target server. $lookupTime*(LookupTime)The time taken to obtain the IP address of the host server. $networkErrorContains any network errors during the connection. $port*(
Port)The port on the target server the monitor tried to connect to. $waitingForIf the connection terminates before the monitor completes its sequence of waits and sends, this element contains the contents of the last WaitForproperty.
- Status message
-
The TCPPort monitor provides status messages in the
ResultMessageattribute when using IBM® Application Performance Management. These messages indicate the result of the test.The following table describes the TCPPort status messages.
Table 4. TCPPort monitor status messages Message Description OKThe request succeeded. Timed out waiting to read/writeA data connection to the server was established, but it does not respond. Connection closed unexpectedlyThe connection to the server was broken. Connection failedThe monitor failed to connect to the server. For more information, see the log file. Network connect errorThere’s a problem with the network. Network error whilst reading
- Properties
-
Properties options specific to the TCPPort monitor are described in the following table.
Table 5. TCPPort properties Property name Property parameter Description Monitor Disconnect0|1Specifies that the monitor must disconnect itself after the last
SendorWaitForcommand. If the last command is aSend, the monitor disconnects immediately after the string is sent. If the last command is aWaitFor, the monitor disconnects as soon as the monitor receives a match or when the poll timeout is exceeded.0- disabled (monitor doesn’t connect)1- enabledOutputDirectorystring Specifies the output directory to use if the
OutputResultis saved.Default:
$ISHOME/var.OutputResult0|1Specifies that the monitor must save the data that it receives from the service.
0- disabled1- enabledSendnLiteral string that the monitor writes to the port. See Guidelines for configuring TCPPort monitor.
nis a number in the range 1 - 30 inclusive.singleLineMatch0|1Specifies that the monitor should return a single line match when a regular expression is matched.
0- disabled (multiple lines are matched)1- enabled (single line is matched)WaitFornRegular expression used to match commands or strings on the monitored port. For more information, see Guidelines for configuring TCPPort monitor.
nis a number 1 - 30 inclusive.
- Cipher suites
-
The
SSLCipherSuiteproperty specifies the cipher suite that is used by the TCPPORT monitor. For more information about SSL settings, see SSL setting in Internet Service Monitoring.