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
Name of the adapter instance The instance name is the first entry in the adapter configuration and must be enclosed in square brackets.
To run more than one instance of the adapter, specify a unique name and configuration for each adapter instance.
|Maximum time, in seconds, to wait until a connection attempt is considered unsuccessful |
|Type of adapter in use |
Valid value: MA::Adapter::Telnet
|Maximum time, in seconds, after which new data is expected to have arrived. |
After this time, the connection is considered unsuccessful.
Default: 15 seconds
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.
|Local port number to which the Telnet Client binds Default:ANY|
|Regular expression of the login prompt |
Default: "login[:]*$ | username[:]*$"
|Name of the MAP file used to generate events from the tokenized data |
Parser instance that must be used to parse and tokenize the client input stream
|Regular expression that provides valid alternative password prompt text Required Default: "password[:]$"*|
|List of alternative prompt characters |
|Telnet login script |
|Host name or IP address of the remote computer to which the Telnet Adapter is connecting |
|Port on the remote computer to which the Telnet Adapter is connecting |
|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).
Reestablishes a connection when it fails or is broken when it stops functioning
|Maximum time, in seconds, to wait for the completion of the authentication phase |
|Command to run after logging on the remote computer |
|Password used to connect to the remote computer |
|User name used to connect to the remote computer |
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
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.
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 .