vADC Forum

Reply
New Contributor
Posts: 3
Registered: ‎10-09-2014
Accepted Solution

zcli using output of one command as input to another

So using

TrafficIPGroups.getTrafficIPGroupNames

I can get a list of all the traffic IP groups I have set up.

Is there any way to pass that list into the trafficIPGroups.setPsssiveMachine command?

I can see that the format for the command is something like TrafficIPGroups.setPassiveMachine traffic_IP_group1 node2 to set traffic_IP_group1 as passive on node2 in my lb cluster, but is there a way of passing the list instead of an individual ip group name?

I've had a look at the manual but there doesn't seem to be an example of passing the output of one command as the input of another within the zcli environment.

Thanks in advance -

Brocadian
Posts: 58
Registered: ‎11-29-2012

Re: zcli using output of one command as input to another


Paul Hare wrote:


.... is there a way of passing the list instead of an individual ip group name?...


TrafficIPGroups.getTrafficIPGroupNames?

New Contributor
Posts: 3
Registered: ‎10-09-2014

Re: zcli using output of one command as input to another

OK, achieved what I wanted to achieve with a wildcard, so TrafficIPGroups.setPassive * NODE2

What I was asking for was to return the array from TrafficIPGroupNames [tipg_1, tipg_2, ...] and then use that as the input for setting the nodes to passive, so assuming that you had an array you could do

Array[] = TrafficIPGroups.getTrafficIPGroupNames

For ( i =1; i= lengthofArray;i++){

     TrafficIPGroups.SetPassive $Array NODE2

}

I'm guessing that zcli doesn't do this, and I'm going to have to work out how to use the APIs.

New Contributor
Posts: 5
Registered: ‎06-05-2014

Re: zcli using output of one command as input to another

I have a script attached to Disabling a server when it goes offline that provides an example of leveraging zcli output to issue commands back into zcli.  It also leverages pipes so that several commands and results can be issued against a single instance of zcli, to reduce overhead during execution. Please let me know if this helps!

Erik Brandsberg

Solution Engineer

New Contributor
Posts: 3
Registered: ‎10-09-2014

Re: zcli using output of one command as input to another

Thanks Erik - looks like I might be able to do some modifications of your script with a little bash-fu.

Join the Community

Get quick and easy access to valuable resource designed to help you manage your Brocade Network.