Re: How to automatically collecting physical capacity and used capacity.

Would something like curl be sufficient to authenticate into the management API and run the capacity method?

So you would first run:

curl -L –location-trusted -k https://10.1.83.51:4443/login -u “root:Password12345” -v

admin@ecs-obj-1-1:~> curl -L –location-trusted -k https://10.1.83.51:4443/login -u “root:ChangeMe” -v

* Hostname was NOT found in DNS cache

* Trying 10.1.83.51…

* Connected to 10.1.83.51 (10.1.83.51) port 4443 (#0)

* successfully set certificate verify locations:

* CAfile: none

CApath: /etc/ssl/certs/

* SSLv3, TLS handshake, Client hello (1):

* SSLv3, TLS handshake, Server hello (2):

* SSLv3, TLS handshake, CERT (11):

* SSLv3, TLS handshake, Server key exchange (12):

* SSLv3, TLS handshake, Server finished (14):

* SSLv3, TLS handshake, Client key exchange (16):

* SSLv3, TLS change cipher, Client hello (1):

* SSLv3, TLS handshake, Finished (20):

* SSLv3, TLS change cipher, Client hello (1):

* SSLv3, TLS handshake, Finished (20):

* SSL connection using TLSv1.0 / ECDHE-RSA-AES256-SHA

* Server certificate:

* subject: C=US; ST=FL; L=hop; O=dell; CN=meatgrinder.com; emailAddress=joseph.conery@dell.com

* start date: 2017-03-14 18:12:35 GMT

* expire date: 2017-04-13 18:12:35 GMT

* issuer: C=US; ST=FL; L=hop; O=dell; CN=meatgrinder.com; emailAddress=joseph.conery@dell.com

* SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.

* Server auth using Basic with user ‘root’

> GET /login HTTP/1.1

> Authorization: Basic cm9vdDpDaGFuZ2VNZQ==

> User-Agent: curl/7.37.0

> Host: 10.1.83.51:4443

> Accept: */*

>

< HTTP/1.1 200 OK

< Date: Mon, 19 Jun 2017 22:07:40 GMT

< Content-Type: application/xml

< Content-Length: 93

< Connection: keep-alive

< X-SDS-AUTH-TOKEN: BAAcNUlUekhnR2NGQnVIdTArOUpKTUJ0QytVc0tBPQMAjAQASHVybjpzdG9yYWdlb3M6VmlydHVhbERhdGFDZW50ZXJEYXRhOjQwN2I2YjZjLWJkYTQtNGJhNC04OWY3LTIyMGFjM2Q5YzA0NAIADTE0OTc4NTQyOTczNjkDAC51cm46VG9rZW46ZmRiN2RkM2ItN2Q3ZC00Mzc2LWFmMzItZTNmNDc0ZjBhYzU3AgAC0A8=

And then pass that token in the next call like so to get capacity:

admin@ecs-obj-1-1:~> curl -L –location-trusted -k https://10.1.83.51:4443/object/capacity -H “X-SDS-AUTH-TOKEN: BAAcNUlUekhnR2NGQnVIdTArOUpKTUJ0QytVc0tBPQMAjAQASHVybjpzdG9yYWdlb3M6VmlydHVhbERhdGFDZW50ZXJEYXRhOjQwN2I2YjZjLWJkYTQtNGJhNC04OWY3LTIyMGFjM2Q5YzA0NAIADTE0OTc4NTQyOTczNjkDAC51cm46VG9rZW46ZmRiN2RkM2ItN2Q3ZC00Mzc2LWFmMzItZTNmNDc0ZjBhYzU3AgAC0A8=” -v

* Hostname was NOT found in DNS cache

* Trying 10.1.83.51…

* Connected to 10.1.83.51 (10.1.83.51) port 4443 (#0)

* successfully set certificate verify locations:

* CAfile: none

CApath: /etc/ssl/certs/

* SSLv3, TLS handshake, Client hello (1):

* SSLv3, TLS handshake, Server hello (2):

* SSLv3, TLS handshake, CERT (11):

* SSLv3, TLS handshake, Server key exchange (12):

* SSLv3, TLS handshake, Server finished (14):

* SSLv3, TLS handshake, Client key exchange (16):

* SSLv3, TLS change cipher, Client hello (1):

* SSLv3, TLS handshake, Finished (20):

* SSLv3, TLS change cipher, Client hello (1):

* SSLv3, TLS handshake, Finished (20):

* SSL connection using TLSv1.0 / ECDHE-RSA-AES256-SHA

* Server certificate:

* subject: C=US; ST=FL; L=hop; O=dell; CN=meatgrinder.com; emailAddress=joseph.conery@dell.com

* start date: 2017-03-14 18:12:35 GMT

* expire date: 2017-04-13 18:12:35 GMT

* issuer: C=US; ST=FL; L=hop; O=dell; CN=meatgrinder.com; emailAddress=joseph.conery@dell.com

* SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.

> GET /object/capacity HTTP/1.1

> User-Agent: curl/7.37.0

> Host: 10.1.83.51:4443

> Accept: */*

> X-SDS-AUTH-TOKEN: BAAcNUlUekhnR2NGQnVIdTArOUpKTUJ0QytVc0tBPQMAjAQASHVybjpzdG9yYWdlb3M6VmlydHVhbERhdGFDZW50ZXJEYXRhOjQwN2I2YjZjLWJkYTQtNGJhNC04OWY3LTIyMGFjM2Q5YzA0NAIADTE0OTc4NTQyOTczNjkDAC51cm46VG9rZW46ZmRiN2RkM2ItN2Q3ZC00Mzc2LWFmMzItZTNmNDc0ZjBhYzU3AgAC0A8=

>

< HTTP/1.1 200 OK

< Date: Mon, 19 Jun 2017 22:09:24 GMT

< Content-Type: application/xml

< Content-Length: 176

< Connection: keep-alive

<

* Connection #0 to host 10.1.83.51 left intact

<?xml version=”1.0″ encoding=”UTF-8″ standalone=”yes”?><cluster_capacity><totalFree_gb>243051</totalFree_gb><totalProvisioned_gb>334800</totalProvisioned_gb></cluster_capacity>

Related:

Leave a Reply