![Citrix NetScaler SDX 11500 Manual Download Page 245](http://html1.mh-extra.com/html/citrix/netscaler-sdx-11500/netscaler-sdx-11500_manual_2611011245.webp)
© 1999-2017 Citrix Systems, Inc. All rights reserved.
p.245
https://docs.citrix.com
The following sample code retrieves statistics of a NetScaler instance with ID 123456a:
ns obj = new ns();
obj.id = "123456a";
ns stats = ns.get(nitroservice, obj);
Console.WriteLine("CPU Usage:" + stats.ns_cpu_usage);
Console.WriteLine("Memory Usage:" + stats.ns_memory_usage);
Console.WriteLine("Request rate/sec:" +stats.http_req);
Updat ing a
Updat ing a Resource
Resource
To update the properties of an existing resource on the appliance, do the following:
1. Set the id property to the ID of the resource to be updated.
2. Set the value for the required properties of the resource by using the corresponding property name. The result is a
resource object.
Note: These values are set locally on the client. The values are not reflected on the appliance till the object is uploaded.
3. Upload the resource object to the appliance, using the update() method.
The following sample code updates the name of the NetScaler instance with ID 123456a to 'ns_instance_new':
ns update_obj = new ns();
//Set the ID of the NetScaler to be updated
update_obj.id = "123456a";
//Get existing NetScaler details
update_obj = ns.get(nitroservice, update_obj);
//Update the name of the NetScaler to "ns_instance_new" locally
update_obj.name = "ns_instance_new";
//Upload the updated NetScaler details
ns result = ns.update(nitroservice, update_obj);
Delet ing a Resource
Delet ing a Resource
To delete an existing resource, invoke the static method delete() on the resource class, by passing the ID of the resource to
be removed, as an argument.
The following sample code deletes a NetScaler instance with ID 1:
ns obj = new ns();
obj.id = "123456a";
ns.delete(nitroservice, obj);
Bulk Operat ions
Bulk Operat ions
You can query or change multiple resources simultaneously and thus minimize network traffic. For example, you can add
multiple NetScaler appliances in the same operation.
Each resource class has methods that take an array of resources for adding, updating, and removing resources. To perform
a bulk operation, specify the details of each operation locally and then send the details at one time to the server.