SSH Settings

 

PowerChute Network Shutdown can be configured to execute commands on a remote host via an SSH connection. To create an SSH action, click Add Action and configure the following:

  1. Name: A unique name for each SSH action of a length less than or equal to 255 ASCII characters.
  2. Configure one of the following authentication methods:
    • User Name and Password: Enter the user name and password to connect to the remote host.
    • User Name, SSH Key File Path and SSH Key File Password: Specify the path to a shared SSH key. This option requires you to generate an SSH key and copy it to your target systems. See SSH Command File Location.
  3. IP Addresses/FQDN and Port: The IP address or Fully Qualified Domain Name (FQDN) and port of the target SSH component.
  4. Path to SSH command file: You must specify the full path name of the command file, including the disk drive or volume number. See SSH Command File Location.
  5. SSH Action Delay: Enter the amount of time, in seconds, that PowerChute will wait before connecting to the remote host and begin sending commands. The default value is 0.
  6. SSH Action Duration: Enter the amount of time, in seconds, for the SSH action to complete before proceeding with the rest of the shutdown sequence.

    Using the SSH Action Duration field, you must allow sufficient time for all your SSH actions to complete.

  7. Execute SSH Action:
    • On Startup: Execute the SSH command file when the PowerChute service re-starts. In an advanced configuration, the SSH command file is executed when the critical UPS event is resolved.
    • Before VM Shutdown: Execute the SSH command file before the User VM Migration and Shutdown step.
    • Before Host Shutdown: Execute the SSH command file before host shutdown.
    • After Host Shutdown: Execute the SSH command file after host shutdown.

  8. Enable SSH Action: Allows you to enable or disable the configured SSH action. This checkbox is enabled by default when a new SSH action is created.

NOTES:

  • PowerChute takes the command file provided and passes it line-by-line to the remote host over an SSH connection. As a result, incomplete lines may be interpreted incorrectly by the remote host. You must ensure that your SSH command file contains complete lines and commands so the remote host can interpret the file correctly.
  • The line ending style of the command file must match that of the PowerChute target host operating system. For example, a command file configured on PowerChute running on a Windows host must contain Windows style text line endings.
  • Recognized command prompts are:
    • $ (Linux)
    • # (Linux admin/root)
    • > (Windows, or RPDU)
  • Custom command prompts can be added via the PowerChute configuration file (pcnsconfig.ini) by adding the "ssh_prompt_regex" setting to the [SSHAction] section. For example: to add a custom command prompt of "~", add "ssh_prompt_regex = \~\s".
  • The PowerChute Event Log only displays that an SSH action has completed. The Event Log does not show if the SSH action has completed successfully or not.
  • If a value is specified in the SSH Action Delay field, the Event Log does not log that an SSH action is running with a configured delay.


SSH Command File Location

The SSH key file, if configured, and command file must be located in the user_files folder, or a sub-folder, in the PowerChute installation directory. If the default installation directory was chosen during installation, this location will be:

  • C:\Program Files\APC\PowerChute\user_files for Windows systems

  • /opt/APC/PowerChute/user_files/ for Linux systems

NOTE: If you are upgrading to PowerChute v5.2, any key files and/or command files used in a previous version of PowerChute must be manually added to the user_files folder. If the files are not added to the directory, you will see the below errors in the Event Log:

ERROR: The ini contains an invalid value for ssh_command_file_path in section SSHAction0.

ERROR: The ini contains an invalid value for ssh_keyfile_path in section SSHAction0.

It is strongly recommended you validate your configuration after an upgrade.


SSH Settings in an Advanced UPS Configuration

In an Advanced UPS configuration, SSH actions can be enabled and disabled for each UPS setup.

The checked.jpg symbol indicates that an SSH action is enabled in the main SSH Settings screen. To run an SSH action for a particular UPS setup, enable the checkbox next to the  checked.jpg symbol.

SSH actions that are not enabled do not display the  checked.jpg symbol. These disabled actions will not be executed if enabled for a UPS setup.