Jump to content
Welcome to our new Citrix community!

API Call to Disable Service Group Member


Erick Larin

Recommended Posts

I'm confused:Do you want to add a member to servicegroup, remove a member, or a disable a member?

You asked about disabling, but then mentioned its not what you are trying to do.  What would you like to do and we can maybe help?

Are you trying to write a conditional to make the change?

 

Hopefully the below commands will help you (final 4 examples are curl posts to disable servicegroup and servicegroup member examples)

==================

For reference:  Regular CLI for servicegroup management is as follows, to help you match up tasks to what you will then need to accomplish in nitro later:

add servicegroup svcg_demo1 HTTP

# binding service members by ip/ports...will use existing unnamed servers or create one if needed

bind servicegroup svcg_demo1 10.10.10.101 80

bind servicegroup svcg_demo1 10.10.10.102 80

bind servicegroup svcg_demo1 -monitorName ping

# binding a member that already exists, generates an error

bind servicegroup svcg_demo1 10.10.10.102 80

    ERROR: Resource already exists

# to remove a member binding:

unbind servicgroup svcg_demo1 10.10.10.102  80

 

# disable entire servicegroup

disable servicegroup svcg_demo1

 

# to enable/disable member while still retaining the member in the group; disabling will remove it from lb destinations just like disabling a service; but doesn't lose the association to the group

disable servicegroup svcg_demo1 10.10.10.102 80      #(Ip and port required to target specific member)

enable servicegroup svcg_demo1 10.10.10.102 80       # restores use of member, pending a healthy monitor state is also returned

 

====

Basic nitro references (a few): (paths only for the gets below)

# show servicegroup members associated with servicegroup svcg_demo1

/nitro/v1/config/servicegroup_servicegroupmember_binding?args=servicegroupname:svcg_demo1

# alternate methods; for specific service groups...

/nitro/v1/config/servicegroup_servicegroupmember_binding/svcg_demo1

/nitro/v1/config/servicegroup_servicegroupmember_binding/svcg_demo2

 

# retrieve list of members enabled vs disabled (which reflects if you the admin enabled/disabled member;  svrstate reflects up/down status which could be due to the disabled state OR failed probes; not shown in commands below)

### So in this demo i have member 1 (10.10.10.102 disabled) and 10.10.10.101 enabled

/nitro/v1/config/servicegroup_servicegroupmember_binding?args=servicegroupname:svcg_demo1&filter=state:enabled

/nitro/v1/config/servicegroup_servicegroupmember_binding?args=servicegroupname:svcg_demo1&filter=state:disabled

 

#   alternates for above

/nitro/v1/config/servicegroup_servicegroupmember_binding/svcg_demo1?filter=state:enabled

/nitro/v1/config/servicegroup_servicegroupmember_binding/svcg_demo1?filter=state:disabled

 

# To retrieve the status of a specific member of the servicegroup by IP:  

/nitro/v1/config/servicegroup_servicegroupmember_binding/svcg_demo1?filter=ip:10.10.10.101

/nitro/v1/config/servicegroup_servicegroupmember_binding/svcg_demo1?filter=ip:10.10.10.102

 

# Now: CURL commands to show servicegroup, disable servicegroup (whole), and then enable/disable servicegroup member (refer to original CLI for additional examples).

# NOTE:  Using the builtin CURL in windows powershell (For win 10), nothing I did could get the json header to work. Switching to cygwin curl library worked like a charm. (it was driving me crazy to figure out why the posts wouldn't work)

svcg_demo1 HTTP with two members:  10.10.10.101:80 and 10.10.10.102:80 (I created members by IP and not by name...whichever will work below).

 

# get servicegroup <svcg_name>: svcg_demo1

curl.exe -s -i -X GET -u <creds>  http://<NSIP>/nitro/v1/config/servicegroup?args=servicegroupname:svcg_demo1

 

# disable servicegroup <svcg_name>: svcg_demo1

#  CLI:  disable servicegroup <svcg_name> and no server:Port will disable group as a whole
curl.exe -s -i -u <creds> -H "Content-Type: application/vnd.com.citrix.netscaler.servicegroup+json" -X POST -d  '{"servicegroup":{"servicegroupname":"svcg_demo1"}}' http://<NSIP>/nitro/v1/config/servicegroup?action=disable

 

# disable servicegroup member for <svcg_name>:<member servername/port>:  svcg_demo1:10.10.10.102:80

# CLI:  disable servicegroup <svcg_name> <servername/ip> <port> will disable a specific member of servicegroup

curl.exe -s -i -u <creds> -H "Content-Type: application/vnd.com.citrix.netscaler.servicegroup+json" -X POST -d  '{"servicegroup":{"servicegroupname":"svcg_demo1","servername":"10.10.10.102","port":"80"}}' http://<NSIP>/nitro/v1/config/servicegroup?action=disable

 

# enable servicegroup member ....

# CLI:  disable servicegroup <svcg_name> <servername/ip> <port> will disable a specific member of servicegroup

curl.exe -s -i -u <creds> -H "Content-Type: application/vnd.com.citrix.netscaler.servicegroup+json" -X POST -d  '{"servicegroup":{"servicegroupname":"svcg_demo1","servername":"10.10.10.102","port":"80"}}' http://<NSIP>/nitro/v1/config/servicegroup?action=enable

 

 

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...