仓库指标
- Star
- (9,892 star)
- PR 合并指标
- (平均合并 2天 12小时) (30 天内合并 136 个 PR)
描述
Feature Request
Proposal:
I need a feature in http plugin to make a specific API call, so I can switch Citrix ADC partition
Current behavior:
I can only make API calls into default partition
Desired behavior:
I can draw telemetry data from all Citrix ADC partitions
Use case:
In multi-tenancy environment Citrix ADC can be divided into partitions. Usually the default partition is only for management, therefore it won't hold any significant telemetry data. To get all data it is needed to make a specific API call to switch into different partition. While I need this for Citrix ADC, I do see that such custom API call could be useful for other vendor equipment where "switch context" feature is needed.
Example:
1. Initiate session
curl -ik https://netscaler/nitro/v1/config/login -X POST -H 'Content-Type: application/json' -d '{ "login" :{"username": "netscaler", "password": "password"}}'
=============================================
2. Try to get stats - result is empty because this is the default partition
curl -ik https://netscaler/nitro/v1/stat/lbvserver -H 'Content-Type: application/json' --cookie "sessionid=%23%2387A952CDD153F6970F74BCD4BC04D2BAAE716A82809D214215AF3977A2468C81F44D56208FAFA03ECF80372E74C96A0A4D075F3919C9BDAEB061321C9B518C162ED95E301853759D610304EBBF32DDF22832C6252D8223E73EC5F1288722313EF9EDDE5E44A62CA53E32EB5F3DF21A429D92958AB59A53717B0DDB329C54; path=/nitro/v1"
HTTP/1.1 200 OK
Date: Thu, 21 Jul 2022 12:18:10 GMT
Server: Apache
X-Frame-Options: SAMEORIGIN
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Vary: Accept-Encoding
Feature-Policy: camera 'none'; microphone 'none'; geolocation 'none'
Referrer-Policy: no-referrer
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Content-Length: 57
Content-Type: application/json; charset=utf-8
{ "errorcode": 0, "message": "Done", "severity": "NONE" }
=============================================
3. See a list of partitions
curl -ik https://netscaler/nitro/v1/stat/nspartition -H 'Content-Type: application/json' --cookie "sessionid=%23%23AC159C232C72493EA59E2237A0ACB9C6ABDF459A54EC7075954360040A0A3D81D8BEF29F9FD10A7747D2366A2D5A7DB0E988F11561F5646BE827A6023DB0E5A1BCA99FFB65643CBB9AB8535E39A2F5EC9F1D4B3E2352B35C5E91D82DBB6D1144D30D7671DE6D33B850F1EE1D5057987C32D67493B1AEAA19C7367720555A; path=/nitro/v1"
HTTP/1.1 200 OK
Date: Thu, 21 Jul 2022 12:00:43 GMT
Server: Apache
X-Frame-Options: SAMEORIGIN
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Vary: Accept-Encoding
Feature-Policy: camera 'none'; microphone 'none'; geolocation 'none'
Referrer-Policy: no-referrer
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Content-Length: 3120
Content-Type: application/json; charset=utf-8
{ "errorcode": 0, "message": "Done", "severity": "NONE", "nspartition": [ { "partitionname": "mypartitionname", "maxbandwidth": "102400", "maxconnection": "50000", "maxmemory": "512", "currentbandwidth": "0", "currentconnections": "24", "memoryusagepcnt": "2", "totaldrops": "0", "dropsrate": 0, "totaltokendrops": "0", "tokendropsrate": 0, "totalconnectiondrops": "0", "connectiondropsrate": 0 } ] }
=============================================
4. Switch to partition
curl -ik https://netscaler/nitro/v1/config/nspartition?action=Switch -X POST -H 'Content-Type: application/json' -d '{ "nspartition":{ "partitionname": "mypartitionname"}}' --cookie "sessionid=%23%234982432AB20506FA9CD2229153EB6B1C5E8DB5D81CB7DAF39731C5BF125B1D82EE41A7EA7FD7FCE31DF43B5ADF925410F82820FC1D9A59A9BEABACDC0A26D62AFB46310BCD00C24E2885115876F6A087F68B3D3A862BD5BA801C01409AF614AECD1EACB161F574B33F3E03E9C3806493D7487F542EE4157F0EEC083324CA; path=/nitro/v1"
HTTP/1.1 200 OK
Date: Thu, 21 Jul 2022 12:01:34 GMT
Server: Apache
X-Frame-Options: SAMEORIGIN
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Feature-Policy: camera 'none'; microphone 'none'; geolocation 'none'
Referrer-Policy: no-referrer
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Content-Length: 0
Content-Type: text/html; charset=UTF-8
=============================================
5. Try to get stats - now we do get something
curl -ik https://netscaler/nitro/v1/stat/lbvserver -H 'Content-Type: application/json' --cookie "sessionid=%23%234982432AB20506FA9CD2229153EB6B1C5E8DB5D81CB7DAF39731C5BF125B1D82EE41A7EA7FD7FCE31DF43B5ADF925410F82820FC1D9A59A9BEABACDC0A26D62AFB46310BCD00C24E2885115876F6A087F68B3D3A862BD5BA801C01409AF614AECD1EACB161F574B33F3E03E9C3806493D7487F542EE4157F0EEC083324CA; path=/nitro/v1"
HTTP/1.1 200 OK
Date: Thu, 21 Jul 2022 12:01:49 GMT
Server: Apache
X-Frame-Options: SAMEORIGIN
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Vary: Accept-Encoding
Feature-Policy: camera 'none'; microphone 'none'; geolocation 'none'
Referrer-Policy: no-referrer
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Transfer-Encoding: chunked
Content-Type: application/json; charset=utf-8
{ "errorcode": 0, "message": "Done", "severity": "NONE", "lbvserver": [ { "name": "lb-test-ssl", "avgcltttlb": "0", "cltresponsetimeapdex": 1.000000, "vsvrsurgecount": "0", "establishedconn": "0", "inactsvcs": "0", "vslbhealth": "0", "primaryipaddress": "169.254.1.1", "primaryport": 443, "type": "SSL", "state": "DOWN", "actsvcs": "0", "cpuusagepm": "0", "tothits": "0", "hitsrate": 0, "totalrequests": "0", "requestsrate": 0, "totalresponses": "0", "responsesrate": 0, "totalrequestbytes": "0", "requestbytesrate": 0, "totalresponsebytes": "0", "responsebytesrate": 0, "totalh2requests": "0", "h2requestsrate": 0, "totalh2responses": "0", "h2responsesrate": 0, "totalpktsrecvd": "0", "pktsrecvdrate": 0, "totalpktssent": "0", "pktssentrate": 0, "curclntconnections": "0", "cursrvrconnections": "0", "curpersistencesessions": "0", "curbackuppersistencesessions": "0", "surgecount": "0", "svcsurgecount": "0", "sothreshold": "0", "totspillovers": "0", "labelledconn": "0", "pushlabel": "0", "deferredreq": "0", "deferredreqrate": 0, "invalidrequestresponse": "0", "invalidrequestresponsedropped": "0", "totvserverdownbackuphits": "0", "curmptcpsessions": "0", "cursubflowconn": "0", "totalconnreassemblyqueue75": "0", "totalconnreassemblyqueueflush": "0", "totalsvrbusyerr": "0", "svrbusyerrrate": 0, "reqretrycount": "0", "reqretrycountexceeded": "0", "httpmaxhdrszpkts": "0", "httpmaxhdrfldlenpkts": "0", "tcpmaxooopkts": "0", "totcltttlbtransactions": "0", "cltttlbtransactionsrate": 0, "toleratingttlbtransactions": "0", "toleratingttlbtransactionsrate": 0, "frustratingttlbtransactions": "0", "frustratingttlbtransactionsrate": 0 } ] }
=============================================
6. Switching back to default partition
curl -ik https://netscaler/nitro/v1/config/nspartition?action=Switch -X POST -H 'Content-Type: application/json' -d '{ "nspartition":{ "partitionname": "default"}}' --cookie "sessionid=%23%234982432AB20506FA9CD2229153EB6B1C5E8DB5D81CB7DAF39731C5BF125B1D82EE41A7EA7FD7FCE31DF43B5ADF925410F82820FC1D9A59A9BEABACDC0A26D62AFB46310BCD00C24E2885115876F6A087F68B3D3A862BD5BA801C01409AF614AECD1EACB161F574B33F3E03E9C3806493D7487F542EE4157F0EEC083324CA; path=/nitro/v1"
HTTP/1.1 200 OK
Date: Thu, 21 Jul 2022 12:02:05 GMT
Server: Apache
X-Frame-Options: SAMEORIGIN
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Feature-Policy: camera 'none'; microphone 'none'; geolocation 'none'
Referrer-Policy: no-referrer
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Content-Length: 0
Content-Type: text/html; charset=UTF-8
Partition switch is documented here: https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nspartition/#switch
Basically I need Telegraf to do steps 1 and 4 from above example in a sequence before I make any other API calls that draw data (step 5 in example). Currently Telegraf can do authentication (step 1), but it can't send custom API call mentioned in step 4, before getting real data.