SSH Nexus
Actions22
- Command Execution Actions
- File Operations Actions
- Network Device Actions
- System Information Actions
- Connection Health Actions
Overview
This node enables executing custom SSH commands specifically on network devices such as Cisco IOS, Aruba OS, Juniper, HP ProCurve, Dell PowerConnect, MikroTik, and generic devices. It supports running any user-defined command on the target device over an SSH connection with advanced options for connection configuration, output parsing, and error handling.
Typical use cases include:
- Running diagnostic or configuration commands on network switches, routers, or access points.
- Automating network device management tasks like retrieving status, backing up configurations, or applying custom commands.
- Integrating network device control into broader automation workflows where dynamic SSH parameters or stored credentials are used.
For example, a user might execute a custom command to check interface statuses on a Cisco router or retrieve the current routing table from a Juniper device.
Properties
| Name | Meaning |
|---|---|
| Configuration Mode | Choose how to configure the SSH connection: - Use Credentials: Use stored SSH credentials (recommended for security). - Dynamic Parameters: Use dynamic parameters from previous nodes or environment variables. |
| Dynamic Host | Hostname or IP address of the network device (required if using Dynamic Parameters mode). Supports expressions and environment variables. |
| Dynamic Port | SSH port number (default 22) for the connection (used in Dynamic Parameters mode). |
| Dynamic Username | Username for SSH login (required if using Dynamic Parameters mode). Supports expressions and environment variables. |
| Dynamic Password | Password for SSH login (optional if using password authentication). Supports expressions and environment variables. |
| Dynamic Private Key | Private key content for SSH authentication (optional alternative to password). Supports expressions and environment variables. |
| Custom Command | The custom command string to execute on the network device (shown only when Resource is Network Device and Operation is Custom Command). |
| Advanced Options | Collection of additional settings: • Command Timeout (ms): Max wait time for command completion (default 30000 ms). • Output Parsing: How to parse command output: - Smart Parse (auto-detect) - JSON Only - Table Format - Raw Text (formatted) - No Parsing • Continue on Error: Whether to continue processing other items if some commands fail. • Cipher Override: Override SSH cipher selection for this operation (various secure, legacy, or specific ciphers). • Try Fallback Ciphers: Automatically try alternative ciphers if primary ones fail. • Retry Delay (ms): Delay between connection retry attempts. • Verbose Logging: Enable detailed debug logging. • Line Ending Style: Choose line ending style for command execution (CR+LF or LF). • Device Type: Select network device type for optimized command handling (Generic, Cisco IOS, Aruba OS/AP, Juniper, HP ProCurve, Dell PowerConnect, MikroTik). |
Output
The node outputs JSON objects containing the results of the executed custom command on the network device. The structure includes:
raw: The raw text output returned by the device.lines: Array of non-empty lines parsed from the raw output.wordCount: Number of words in the output.stderr: Any error output captured during command execution (usually empty if successful).exitCode: Exit code of the command (0 indicates success).command: The exact command string that was executed.deviceType: The type of network device targeted.parseOutput: The parsing mode used for the output (e.g., smart, json, table, raw, none).
If output parsing is enabled (default "smart"), the node attempts to auto-detect and format the output accordingly (e.g., JSON or table). Otherwise, it returns raw or minimally processed text.
No binary data output is produced for this operation.
Dependencies
- Requires an SSH server accessible on the target network device.
- Supports authentication via stored SSH credentials or dynamic parameters including username/password or private key.
- Uses the
node-sshlibrary for SSH connections. - Relies on internal utilities for parsing SSH output and managing device-specific command prompts.
- For credential-based mode, requires an API key or SSH credentials configured securely in n8n.
- Environment variables or expressions can be used to supply dynamic connection parameters.
Troubleshooting
- Invalid host format error: Occurs if the dynamic host contains invalid characters. Ensure the hostname or IP uses only letters, numbers, dots, and hyphens.
- Port number out of range: Port must be between 1 and 65535.
- Missing credentials: When using credentials mode, ensure SSH credentials are properly configured and available.
- Connection timeout or handshake failure: May indicate network issues, wrong credentials, or incompatible SSH ciphers. Try enabling fallback ciphers or adjusting cipher override settings.
- Potentially dangerous command detected: The node blocks execution of certain risky commands (e.g.,
rm -rf /,shutdown) to prevent accidental damage. - Empty command error: Custom command cannot be empty.
- Parsing errors: If output parsing fails, try switching to "Raw Text" or "No Parsing" modes.
- Enable mode password prompt issues: If your device requires privileged mode, ensure the enable password is set correctly in credentials or dynamic options.
- Verbose logging: Enable verbose logging in advanced options to get detailed debug information for connection and command execution troubleshooting.
Links and References
- SSH Protocol Overview
- Cisco IOS Command Reference
- Juniper Networks CLI User Guide
- ArubaOS Command Line Interface Guide
- Node SSH Library
- n8n Documentation on Credentials
This summary covers the logic and usage of the "Custom Command" operation under the "Network Device" resource in the SSH Nexus node implementation.