cancel
Showing results for 
Search instead for 
Did you mean: 

zcli using output of one command as input to another

SOLVED
paul.hare
New Contributor

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 -

1 ACCEPTED SOLUTION

Accepted Solutions
ebrandsberg
New Contributor

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

View solution in original post

4 REPLIES 4
dnahas
Contributor

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?

paul.hare
New Contributor

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.

ebrandsberg
New Contributor

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

paul.hare
New Contributor

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.