This article discusses how to determine the amount of remaining memory on Diego Cells in all versions of Tanzu Application Service for VMs (TAS for VMs).
Determining the remaining amount of memory on Diego Cells helps you determine whether there are sufficient resources for pushed applications.
When you run the command, cf push <APP>
it returns the message "Insufficient Resources". You may need to perform this command to check whether there is enough remaining memory for the application that is being pushed.
To find out the remaining amount of memory on a Diego Cell, follow the instructions below:
You can manually pull capacity stats from Diego using the cfdot
command. While this approach is works for short term troubleshooting, we do not suggest doing this for long term metric capture or monitoring solutions. Those solutions should use the firehose.
To pull the stats with cfdot
, run the following command from the BBS, Brain, or from a Diego Cell:
cfdot cell-states | jq '{cell_id, TotalResources, AvailableResources}'
This will return a JSON blob similar to the one below:
{ "cell_id": "4c24989c-4cfb-41c9-a9c6-5b07b0e67eb4", "TotalResources": { "MemoryMB": 16383, "DiskMB": 121518, "Containers": 74 }, "AvailableResources": { "MemoryMB": 13311, "DiskMB": 118446, "Containers": 71 } } ...
There are other attributes available from the command above, such as the application instances running on each Diego Cell. If you'd like to see them adjust the filter specified to jq
.
If querying a windows Diego Cell, the following can be used from within Linux Diego VMs, such as BBS or Brain.
cfdot cell-states | jq -c 'select( .cell_id == "windows cell id" ) | {cell_id, TotalResources, AvailableResources}' | jq
To pull the stats with curl
, run the following on your Cell:
curl -s https://localhost:1801/state --cert /var/vcap/jobs/rep/config/certs/tls.crt --key /var/vcap/jobs/rep/config/certs/tls.key --cacert /var/vcap/jobs/rep/config/certs/tls_ca.crt | jq '{cell_id, AvailableResources, TotalResources}'
This will return a JSON blob that looks like this:
{ "cell_id": "202cc6c3-f950-4205-a3ae-6d9d6a325e9d", "AvailableResources": { "MemoryMB": 7466, "DiskMB": 174247, "Containers": 208 }, "TotalResources": { "MemoryMB": 32174, "DiskMB": 216687, "Containers": 249 } }
There are other attributes available from the command above, such as the application instances running on each Cell. If you'd like to see them, adjust the specified filter to jq
.
curl
command:
curl -s -k https://localhost:1800/state
Older versions of PCF had an unsecured endpoint for the Diego Cell, with the same output. You can access this with the following curl
command:
curl -s -k https://localhost:1800/state