Quota usage

468 views
Skip to first unread message

Johannes Engelke

unread,
Mar 10, 2014, 3:47:29 AM3/10/14
to vcap...@cloudfoundry.org
Hi,
I'm not sure if I'm to stupid to google the right term. I try to findout the quota usage of an organization. Is there a more comfortable way to do this?

At the moment I'm using the output of the "cf apps" command...

Cheers
Johannes

Daniel Mikusa

unread,
Mar 10, 2014, 7:07:50 AM3/10/14
to vcap...@cloudfoundry.org
Have you tried “cf org <org-name>”?

Getting info for org <org> as <user>...
OK

<org>:
domains: <domains>
quota: <quota>
spaces: <spaces>

This is with cf v6.

$ cf -v
cf version 6.0.2-0bba99f

Is that what you’re looking for?

Dan
> To unsubscribe from this group and stop receiving emails from it, send an email to vcap-dev+u...@cloudfoundry.org.

Johannes Engelke

unread,
Mar 10, 2014, 10:42:28 AM3/10/14
to vcap...@cloudfoundry.org
Yes, but the information isn't sufficient. I get the domains, spaces
apps, etc... but nothing about the usage of Memory or anything like this
and I don't get any information about the quota plan as well. Even the
--full options doesn't help.

Cheers
Johannes
--
Viele Grüße
Johannes

___________________________________

Töginger Str. 70
84453 Mühldorf

Handy: +49 162 97 48 304
___________________________________

Daniel Mikusa

unread,
Mar 10, 2014, 11:24:01 AM3/10/14
to vcap...@cloudfoundry.org
The only other cf command that comes to mind is “cf quotas”, which only lists the available quotas on the system. It does tell you the memory limit for that quota, but it’s not specific to an org.

I’m not sure how to get more than that with the normal cf output. You can get a little more detail about the quota assigned to your org by enabling trace logging and looking at the resulting JSON.

CF_TRACE=true cf org <org>

Ex:

...
"entity": {
"name": "paid",
"non_basic_services_allowed": true,
"total_services": -1,
"total_routes": 1000,
"memory_limit": 10240,
"trial_db_allowed": false
}
...

The above shows the limits for my quota. It doesn’t show what I’m currently using though. Not sure there is one summary for that either. It’s a little bit of a pain, but I think you can get your usage info. It’s just a matter of run a few different commands and do some basic math.

I took a quick look through the tracker project and saw this story that looks similar to what you’re asking about.

https://www.pivotaltracker.com/story/show/64012986

Perhaps you could share your use case and explain more about how you’d like cf to work.

Dan

Johannes Engelke

unread,
Mar 11, 2014, 6:07:53 AM3/11/14
to vcap...@cloudfoundry.org
Thanks for your answer. 

As an Orgmanager I like to have an easy way to display the usage of my Quota (like "You are using 90% of your memory) to be able to order a bigger package or remove some instances before I get problems to scale or to spinup new applications.

Cheers.
Johannes

James Bayer

unread,
Mar 15, 2014, 10:14:34 AM3/15/14
to vcap...@cloudfoundry.org

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.

--
Thank you,

James Bayer

Guillaume Berche

unread,
Jun 11, 2014, 1:20:44 PM6/11/14
to vcap...@cloudfoundry.org
Thanks James for the info about the nice org summary endpoint

For others trying the cf curl command, note that it does not expect a prefix /  otherwise it fails with a CF-NotFound error.

$ 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}]}


What do the dev and prod refer to in mem_dev and mem_prod ? They don't seem to match spaces as in my org I don't have a prod space

$ cf spaces
Getting spaces in org orange as gberche...

name
dev


Also, it's weird that the org summary (in release v161) displays a RAM usage of 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).

Thanks in advance,

Guillaume.

$ 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

Reply all
Reply to author
Forward
0 new messages