there is an endpoint that nicely summarizes that information at/v2/organizations/ORGUIDHERE/summary
if you don’t know your org guid, you can use CF_TRACE=true with commands that use the org like cf org ORGNAMEHERE
you’ll notice that we still have “dev” and “prod” memory distinctions which are a relic of something not used any longer. the dev memory is the one to look at. the value is in MB. you still need to do the summary of all of the spaces, but it’s very little math and this info is retrieved in one api request if you know the org guid.
we can certainly improve on this as i don't think http://apidocs.cfapps.io/ has this endpoint documented yet.
$ cf curl /v2/organizations/c5706d49-d6d5-4980-a5d8-80689c315b28/summary
{
"guid": "c5706d49-d6d5-4980-a5d8-80689c315b28",
"name": "jbayer-normal-org",
"status": "active",
"spaces": [{
"guid": "67588493-59ec-47dc-8ce1-916fbda278c0",
"name": "development",
"service_count": 7,
"app_count": 7,
"mem_dev_total": 512,
"mem_prod_total": 0
}, {
"guid": "1391bbcc-152f-437d-9d9b-5474ff7d6070",
"name": "production",
"service_count": 0,
"app_count": 0,
"mem_dev_total": 0,
"mem_prod_total": 0
}, {
"guid": "be9aac8a-41b4-49ad-a554-db9a20e9b019",
"name": "staging",
"service_count": 2,
"app_count": 3,
"mem_dev_total": 0,
"mem_prod_total": 0
}]
}
To unsubscribe from this group and stop receiving emails from it, send an email to vcap-dev+u...@cloudfoundry.org.
$ cf curl v2/organizations/f9618d36-2e2a-4277-9ad0-c8e645474041/summary
{"guid":"f9618d36-2e2a-4277-9ad0-c8e645474041","name":"orange","status":"active","spaces":[{"guid":"26208802-2c1b-4ffb-bfe1-45fdcff75304","name":"dev","service_count":1,"app_count"
:7,"mem_dev_total":7168,"mem_prod_total":0}]}
$ cf spaces
Getting spaces in org orange as gberche...
name
dev
7168 MB on a total of whereas the cf push rejects new pushes. Are stopped apps or failed app instances taken into account when computing used quota ? (more details below).$ cf quotas
Getting quotas as gberche...
OK
name memory limit routes service instances paid service plans
default 10G 1000 100 allowed
$ cf apps
Getting apps in org orange / space dev as gberche...
OK
name requested state instances memory
myapp started 1/1 1G
jeeprobe stopped 0/2 1G
hawtio-weblo stopped 0/1 1G
arwmdemo started 3/3 1G
styx started 1/1 1G
icf started 0/1 1G
demo started 1/1 1G$ cf push exceed-quota-jeeprobe -p ./paas-probe-jee-ear-1.0.32-SNAPSHOT.ear
Creating app exceed-quota-jeeprobe in org orange / space dev as gberche...
FAILED
Server error, status code: 400, error code: 100005, message: You have exceeded your organization's memory limit.
$ CF_TRACE=true cf push exceed-quota-jeeprobe -p ./paas-probe-jee-ear-1.0.32-SNAPSHOT.ear
[...]
POST /v2/apps?async=true HTTP/1.1
Host: api.my.org
Accept: application/json
Authorization: [PRIVATE DATA HIDDEN]
Content-Type: application/json
User-Agent: go-cli 6.1.2-6a013ca / windows
{"name":"exceed-quota-jeeprobe","space_guid":"26208802-2c1b-4ffb-bfe1-45fdcff75304"}
RESPONSE: [2014-06-11T19:16:40+02:00]
HTTP/1.1 400 Bad Request
Content-Length: 168
Cache-Control: proxy-revalidate
Connection: Keep-Alive
Content-Type: application/json;charset=utf-8
Date: Wed, 11 Jun 2014 17:16:40 GMT
Proxy-Connection: Keep-Alive
Server: nginx
Via: 1.1 proxy-mur.idf.fr.ftgroup
X-Content-Type-Options: nosniff
X-Vcap-Request-Id: 2be60db5-72fc-4754-95b2-4714d22aa539
{"code":100005,"description":"You have exceeded your organization's memory limit.","error_code":"CF-AppMemoryQuotaExceed