Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.
Introduction
One of the useful things that you can do with an IBM Concert Workflows workflow is to execute SSH commands to retrieve status, restart services, run commands, etc. In this article, I will cover how to pass different variables that you define within CW's Start block into a SSH command using the CW SSH block.
The Scenario
I want to create a "Service Control" workflow that allows someone to check and control the status of certain running services on a linux system without having to manually login and do so.
Steps Involved
On the linux command line, I would check the status of the snmpd service using the following: systemctl status snmpd
Let's do it!
I first start with a new empty workflow:
We create our two variables "service_name" and "command" and set the default settings for each. We also check the "In" box for each, allowing us to pass different values into these variables (e.g. I want to restart the snmpd service, not just view status".
We want to control what the user can do and which services they have access to. To do this, for the two variables we just created, we change the type to "enum" and then define the acceptable parameters for each.
Next, let's add a SSH block to our workflow. It's found in the "Common"->"SSH" API endpoints list.
Here we will add the "authKey" setting using the "Authentication" we defined (not pictured here).
Hmmmm! All didn't go as expected. Let's see what happened and how to fix it.
Going into "Flat Layout" mode, we can look at our SSH_1 block to see how the command is configured.
Now let's try re-running our workflow to see if our luck is any better!
Copy