SSH to remote host not working #5636
-
I have stackstorm configured in Ubuntu VM. And I'm integrating stackstorm with alert-manager for auto remediation. When the alert triggers it matches the rule and trigger the action given. So my action is trying to login to the remote host which is triggering the alert and perform some actions. However SSH to remote host is not working. What needs to be done here to get the SSH working. I'm getting the below error while executing the action. stderr': '05/02/2022 08:37:45 AM Executing the script\n05/02/2022 08:37:45 AM Trying to ssh on host <IP ADDRESS>\nTraceback (most recent call last):\n File "/opt/stackstorm/st2/lib/python3.8/site-packages/python_runner/python_action_wrapper.py", line 395, in \n obj.run()\n File "/opt/stackstorm/st2/lib/python3.8/site-packages/python_runner/python_action_wrapper.py", line 214, in run\n output = action.run(**self._parameters)\n File "/opt/stackstorm/packs/demo/actions/kafka_demo_disk_action.py", line 44, in run\n status, output = ssh_connect(host)\n File "/opt/stackstorm/packs/demo/actions/kafka_demo_disk_action.py", line 62, in ssh_connect\n k = paramiko.RSAKey.from_private_key_file("/home/ubuntu/.ssh/stackstorm-admin-kafka.pem")\n File "/opt/stackstorm/st2/lib/python3.8/site-packages/paramiko/pkey.py", line 235, in from_private_key_file\n key = cls(filename=filename, password=password)\n File "/opt/stackstorm/st2/lib/python3.8/site-packages/paramiko/rsakey.py", line 55, in init\n self._from_private_key_file(filename, password)\n File "/opt/stackstorm/st2/lib/python3.8/site-packages/paramiko/rsakey.py", line 175, in _from_private_key_file\n data = self._read_private_key_file("RSA", filename, password)\n File "/opt/stackstorm/st2/lib/python3.8/site-packages/paramiko/pkey.py", line 307, in _read_private_key_file\n with open(filename, "r") as f:\nFileNotFoundError: [Errno 2] No such file or directory: '/home/ubuntu/.ssh/stackstorm-admin-kafka.pem'\n', 'exit_code': 1, 'result': 'None'} |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 2 replies
-
The error message you should pay attention to is:
Looks like the SSH key file you're trying to use doesn't exist? |
Beta Was this translation helpful? Give feedback.
-
@armab how can I configure my stackstorm to SSH to remote host? |
Beta Was this translation helpful? Give feedback.
-
@armab I have done the troubleshooting as per the doc.
But still I'm getting below error :
In which server it's looking for '/home/ubuntu/.ssh/stackstorm-admin-kafka.pem' |
Beta Was this translation helpful? Give feedback.
-
In the action there was a reference to the SSH key in that particular location. I have changed that, its sorted now. Thanks for the help @armab |
Beta Was this translation helpful? Give feedback.
The error message you should pay attention to is:
Looks like the SSH key file you're trying to use doesn't exist?