In the last blog we went over powerful HTTP language support for NITRO (/blogs/2011/08/05/nitro-apis-fun-over-http/). Let us now understand how dynamic the behavior and response could be given the HTTP query support. HTTP protocol has extensive query language and with NITRO we utilize the query part for powerful operations on NetScaler resources. The query language enables us to do operations and filtering in most simplified manner which would otherwise require a lengthy program or script to do same. Filtering has excellent use cases whenever we talk about large configuration on NetScaler as it reduces the data transfer, saves bandwidth and results in better response time overall. Similarly other query parameters have their own significance and results in dynamic output based on use cases.

Following are examples of what we can do with the query support.

  • Finding out total number of LB vservers

–        http://<nsip>/nitro/v1/config/lbvserver?count=yes

  • Summary view of LB vservers

–        http://<nsip>/nitro/v1/config/lbvserver?view=summary

  • LB vservers with servicetype/protocol as SSL

–        http://<nsip>/nitro/v1/config/lbvserver?filter=servicetype:ssl

  • LB vservers configured on port 80

–        http://10.102.31.13/nitro/v1/config/lbvserver?filter=port:80

  • LB vservers currently in DOWN state

–        http://10.102.31.13/nitro/v1/config/lbvserver?filter=curstate:DOWN

  • LB vservers configured with Persistence type as SOURCEIP

–        http://10.102.31.13/nitro/v1/config/lbvserver?filter=persistencetype:SOURCEIP

  • LB vservers configured with LB method as Least Connection

–        http://10.102.31.13/nitro/v1/config/lbvserver?filter=lbmethod:LEASTCONNECTION

  • Rewrite policies with rule as TRUE

–        http://10.102.31.13/nitro/v1/config/rewritepolicy?filter=rule:true

  • Rewrite policies which have hit UNDEF any time

–        http://10.102.31.13/nitro/v1/config/rewritepolicy?filter=undefhits:1

  • Rewrite policies which are not in-built or system generated

–        http://10.102.31.13/nitro/v1/config/rewritepolicy?filter=isdefault:false

  • System command policies with action as ALLOW

–        http://10.102.31.13/nitro/v1/config/systemcmdpolicy?filter=action:ALLOW

  • Display only 1 LB vserver per page

–        http://10.102.31.13/nitro/v1/config/lbvserver?pagesize=1

  • For large configuration fetch 2nd page with 10 records

–        http://<nsip>/nitro/v1/config/lbvserver?pageno=2&pagesize=10

  • SNMP OIDs for service as entity type

–        http://10.102.31.13/nitro/v1/config/snmpoid?args=entitytype:service

  • All LB vserver with format as XML

–        http://<nsip>/nitro/v1/config/lbvserver?format=xml

Overall the query support with NITRO makes it much more simpler and convenient to use as compared to writing similar logic in a scripting or programming language.