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 

ParameterDescription
instanceName

Name of the adapter instance The instance name is the first entry in the adapter configuration and must be enclosed in square brackets. 

Required

Note

To run more than one instance of the adapter, specify a unique name and configuration for each adapter instance.

ConnectTimeoutMaximum time, in seconds, to wait until a connection attempt is considered unsuccessful 

Default:10
EngineType of adapter in use 

Required 

Valid value: MA::Adapter::Telnet
IdleTimeoutMaximum 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 

Specify a value for this parameter only when the adapter is on a computer that has multiple network interfaces. By default, the adapter will bind to the default interface. 

Valid values: host name or IP address

Do not specify localhost127.0.0.1, or INADDR_ANY as a value for this parameter.

LocalPortLocal port number to which the Telnet Client binds Default:ANY
LoginPromptRegular expression of the login prompt 

Required 

Default: "login[:]*$ | username[:]*$"
MapfileName 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 

Required

Example

Parser = ParseSyslog, where ParseSyslog is the unique name for a parser definition, such as the following: 
[ParseSyslog] 
Engine = MA::Parser::FixedWidth 
In the adapter definition, do not code as follows: Parser = MA::Parser::FixedWidth

PasswordPromptRegular expression that provides valid alternative password prompt text Required Default: "password[:]$"*
PromptList of alternative prompt characters 

Required 

Default: "[\$>#%]"
scriptTelnet login script 

Required 

Default: telnet.conf
RemoteHostHost name or IP address of the remote computer to which the Telnet Adapter is connecting 

Required
RemotePortPort on the remote computer to which the Telnet Adapter is connecting 

Required
RestartIntervalInterval 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:

  • 0 - No reconnect
  • 1 - Reconnect

Default:0

TelnetAuthTimeoutMaximum time, in seconds, to wait for the completion of the authentication phase 

Required
TelnetCommandCommand to run after logging on the remote computer 

Required
TelnetPasswordPassword used to connect to the remote computer 

Required
TelnetUsernameUser 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 Open link .

Was this page helpful? Yes No Submitting... Thank you

Comments