Hi Marc! Here's my request/answer using curl -v:
$ curl -v -H "X-Auth-Token: my_token" https://rackspace_api.url/current | python -m json.tool * Adding handle: conn: 0xe08fb0 * Adding handle: send: 0 * Adding handle: recv: 0 * Curl_addHandleToPipeline: length: 1 * - Conn 0 (0xe08fb0) send_pipe: 1, recv_pipe: 0 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* About to connect() to rackspace_api.url port 443 (#0) * Trying 174.143.139.141... * Connected to rackspace_api.url (ip) port 443 (#0) * Initializing NSS with certpath: sql:/etc/pki/nssdb * CAfile: /etc/pki/tls/certs/ca-bundle.crt CApath: none * SSL connection using SSL_RSA_WITH_RC4_128_SHA * Server certificate: * subject: CN=rackspace_api.url,OU=Domain Validated,OU=Thawte SSL123 certificate,OU=Go to https://www.thawte.com/repository/index.html,O=rackspace_api.url * start date: Nov 18 00:00:00 2010 GMT * expire date: Nov 17 23:59:59 2015 GMT * common name: rackspace_api.url * issuer: CN=Thawte DV SSL CA,OU=Domain Validated SSL,O="Thawte, Inc.",C=US > GET /v1.0/account_id/loadbalancers/lb_id/usage/current HTTP/1.1 > User-Agent: curl/7.33.0 > Host: rackspace_api.url > Accept: */* > X-Auth-Token: my_token > < HTTP/1.1 200 OK < Content-Type: application/json < Via: 1.1 Rackspace Cloud Load Balancer API v1.19.28 (Repose/2.11.0) < Content-Length: 7265 < Date: Mon, 10 Feb 2014 15:47:28 GMT * Server Jetty(8.0.y.z-SNAPSHOT) is not blacklisted < Server: Jetty(8.0.y.z-SNAPSHOT) < { [data not shown] 53 7265 53 3884 0 0 7158 0 0:00:01 --:--:-- 0:00:01 7100 7265 100 7265 0 0 12349 0 --:--:-- --:--:-- --:--:-- 12376 * Connection #0 to host rackspace_api.url left intact { "links": [], "loadBalancerUsageRecords": [ { "averageNumConnections": 17.5, "averageNumConnectionsSsl": 0.0, "endTime": "2014-02-09T17:00:00Z", "id": id; "incomingTransfer": 3816105, "incomingTransferSsl": 0, "numPolls": 12, "numVips": 1, "outgoingTransfer": 529684773, "outgoingTransferSsl": 0, "sslMode": "OFF", "startTime": "2014-02-09T16:00:00Z", "vipType": "PUBLIC" }, ..and so on.. But, I got a doubt in the next item, now I've this set up in collectd.conf <Plugin curl_json> <URL "https://rackspace_api.url/usage/current"> Instance "Load_Balancer" Header "X-Auth-Token: my_token" <Key "LoadBalancerUsageRecords/*/averageNumConnections"> Type "connections" </Key> .. I've defined a Header with my token_id to make it work (it was the only way I found). So, you suggest I add another Header value? and I'm still not sure which would it be, I see a GET header but is it? Thanks again! On 10 February 2014 10:22, Marc Fournier <[email protected]>wrote: > Excerpts from Mariano González's message of 2014-02-06 13:32:56 +0100: > > Hi Marc. > > > > The request I run manually is: > > > > curl -H "X-Auth-Token: my_token" > > https://API_url/1.0/account_id/loadbalancers/lb_id/usage/current | > python > > -m json.tool > > > > And collectd uses the curl_json plugin, which I don't know what it > requests > > (I assume it uses curl, but I'm not sure how). > > > > Could you guide me on how to tcdump this connections please? > > Actually, ngrep is a similar tool which output is easier to read when > you're only interested in the "application layer". Try: > > sudo ngrep -d any -W byline port 80 > > I see you're using https though. If you can't switch to plain http, you can > probably forget about dumping the network traffic. > > "curl -v" will show you what headers are sent in the HTTP(s) request. Then > try to use collectd's "Header" option to the curl_json plugin and make it > match the headers sent by the curl CLI tool. > > As the curl CLI tool works, I'm pretty sure what you are attempting is > feasible. It's just a matter of finding the correct parameters. > > Marc > -- Mariano Gabriel González
_______________________________________________ collectd mailing list [email protected] http://mailman.verplant.org/listinfo/collectd
