E-2D: How to Soft Shutdown or Reboot Machines via SSH Commands When an Event Triggers
Access the Web Interface and select Events > Smart Alerts. Create a new Event, for example, a temperature sensor that passes the threshold of 90°F. After configuring the Event, group, and notification settings, expand the Remote SSH Commands tab.
Remote address: Enter the IP address or host name of the Linux or Unix computer to be sent a command via SSH connection.
Enable command on event triggered: Place a checkmark here to send a command when this Event is triggered.
Command on triggered: Enter an SSH command to be sent to the remote address when this Even is triggered (e.g. "poweroff" and "reboot")
Enable command on event cleared: Place a checkmark in this box to send a command when this Event is cleared
Command on cleared: Enter SSH command to be sent to the remote address when this Event is cleared
The computer side also has some requirements for this setup to work.
The computer needs to have an SSH server installed and running. It needs to accept connection as "root". (On some installations of Linux, the "root" connection may be disabled by default.)
The SSH connection will be done without a password as it uses authentication keys. To install the authentication key of the E-2D on a computer, download the public key from the Administration > System > RSA Public key page on the Web Interface. The downloaded file will have the default name id_rsa.pub.
On the computer that will receive the SSH command, log in as root, and from the directory where the file was downloaded, type the command:
$ cat id_rsa.pub >> root/.ssh/authorized_keys
Then, to make the change take effect, restart the SSH server by typing:
$ sudo service ssh restart