Telnet Adapter
The Telnet Adapter is a Telnet client that can connect to a Telnet Server to receive a data stream. The adapter passes the data stream to a parser. The parser parses the data stream into data tokens, which the mapping function converts into events.
Use the Telnet Adapter in the following situations:
- Interactivity is required. (The adapter logs on, submits a command, and receives output.)
- The process that is being monitored by the adapter is not meant to stop (such as log file monitoring).
The Telnet Adapter operates on the following principles:
- The Telnet Adapter uses the "interpret as command" functions DO, DONT, WILL, and WONT.
- The Telnet Adapter uses "suppress go ahead" (SGA) to decrease negotiation time.
- To eliminate looping problems with SGA, each command is accepted or rejected only once, and the reply is consistent every time.
- The current Telnet Adapter supports a minimal set of Telnet Negotiation commands. Almost every proposal (DO) that the Telnet Adapter receives from its peer is replied to with a negation (WONT).
The following table describes the Telnet Adapter parameters:
Telnet Adapter configuration parameters
Parameter | Description | |
---|---|---|
instanceName | Name of the adapter instance The instance name is the first entry in the adapter configuration and must be enclosed in square brackets. Note To run more than one instance of the adapter, specify a unique name and configuration for each adapter instance. | |
ConnectTimeout | Maximum time, in seconds, to wait until a connection attempt is considered unsuccessful Default:10 | |
Engine | Type of adapter in use Required Valid value: MA::Adapter::Telnet | |
IdleTimeout | Maximum time, in seconds, after which new data is expected to have arrived. After this time, the connection is considered unsuccessful. Default: 15 seconds | |
LocalHost | Local IP address on a computer with multiple network interfaces to which the Telnet Adapter binds Do not specify localhost, 127.0.0.1, or INADDR_ANY as a value for this parameter. | |
LocalPort | Local port number to which the Telnet Client binds Default:ANY | |
LoginPrompt | Regular expression of the login prompt Required Default: "login[:]*$ | username[:]*$" | |
Mapfile | Name of the MAP file used to generate events from the tokenized data Required | |
Parser | Parser instance that must be used to parse and tokenize the client input stream
| |
PasswordPrompt | Regular expression that provides valid alternative password prompt text Required Default: "password[:]$"* | |
Prompt | List of alternative prompt characters Required Default: "[\$>#%]" | |
script | Telnet login script Required Default: telnet.conf | |
RemoteHost | Host name or IP address of the remote computer to which the Telnet Adapter is connecting Required | |
RemotePort | Port on the remote computer to which the Telnet Adapter is connecting Required | |
RestartInterval | Interval at which the Telnet Adapter reattempts to bind to the local port if that port is busy when the adapter makes its first bind attempt This interval also can be used for any other rescheduling that happens within the adapter (such as rescheduling timeout or termination). Default:60 | |
RestartWhenDone | Reestablishes a connection when it fails or is broken when it stops functioning Valid values:
Default:0 | |
TelnetAuthTimeout | Maximum time, in seconds, to wait for the completion of the authentication phase Required | |
TelnetCommand | Command to run after logging on the remote computer Required | |
TelnetPassword | Password used to connect to the remote computer Required | |
TelnetUsername | User name used to connect to the remote computer Required |
The following figure shows a sample Telnet Adapter configuration, as it would appear in the mcxa.conf file.
Sample Telnet Adapter configuration
[MyTelnet] #name of Adapter instance
Engine = MA::Adapter::Telnet
Parser = SeparatorParser
# Use the parser you want for the output
MapFile = mctelnet.map
RestartInterval = 60 # Interval used when an error occurs
# Or when Adapter restarts
IdleTimeout = 15 # Close the connection when no data has
# been received for 10 seconds (implicit restart)
ConnectTimeout = 10 # Restart if the connection takes longer
# Than 10 seconds to complete
RemoteHost = localhost # Which host to connect to
RemotePort = 23 # Which port (23 = telnetd port)
TelnetAuthTimeout = 15
TelnetUsername = myusername # Username for login
TelnetPassword = mypasswd # Password for login
TelnetCommand = "ls -l" # Command to execute after login
Diagnostics
All Telnet Adapter errors are logged as events. Optionally, you can enable tracing by setting the tracing parameters in the global section of the mcxa.conf file.
The Telnet Adapter can generate an ERR_RECV
error, which indicates that an error occurred when receiving data from the server. For more information, see the event that is created for this error.
Note
If you suspect problems with the Telnet Negotiation commands, monitor the Telnet option negotiation process by enabling Trace level 6. For information about tracing, see Enabling tracing .
Comments
Log in or register to comment.