Execute command on a storage device

I was trying to execute some health check commands on a storage device.

In the usual scenario I can ssh and execute commands like ‘sysconfig’ or ‘version’

From StackStorm, is there a way I can achieve this?

The problem I’m facing is; I always need to use username and password for ssh and even though I enter the same while executing command, it returns nothing.

you can run remote commands using Remote Command Runner. More on that Action Runners — StackStorm 3.1.0 documentation

can you paste your command and its output here?

following is a sample command that you can run from stackstorm to execute a command on a remote host using ssh with username and password.

st2 run core.remote hosts=<ip-address/hostname> cmd="sysconfig" username="<ssh-username>" password="<ssh-password>"

1 Like

Hello Sheshagiri,

Thanks for your reply, but I had tried the same.

When I execute a command in the said way, it gives me following error

 failed: false
    return_code: 0
    stderr: export not found.  Type '?' for a list of commands
    stdout: ''
    succeeded: true

But if I do a ssh, provide password and execute command, I get proper response.

that output means st2 successfully ran your command, but the command as such failed and that error is captured in stderr. I’m not sure of the entire command but looking at the error(particularly “export not found”) it appears that export command is not a valid command on that system. As the error says you can try running “?” to see the list of valid commands :slight_smile:

That said if you are trying to set environment variables you can use env=“key=value1,key2=value” to the above-mentioned command. If you are trying to run a script please take a look at this Action Runners — StackStorm 3.1.0 documentation