Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Install the Cloud Foundry usage report plugin
## How to install the Cloud Foundry usage report plugin for the CLI:
wget https://storage.googleapis.com/golang/go1.7.4.linux-amd64.tar.gz
tar -zxvf go1.7.4.linux-amd64.tar.gz
tar -C /usr/local -xzf go1.7.4.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin
go get github.com/cloudfoundry/cli
mkdir $HOME/work
export GOPATH=$HOME/work
go get github.com/cloudfoundry/cli
go get github.com/krujos/usagereport-plugin
cd $GOPATH/src/github.com/krujos/usagereport-plugin
go build
cf install-plugin usagereport-plugin
## To generate report:
cf usage-report
cf usage-report -f csv```
[root@uabigdata127 usagereport-plugin]# cf usage-report
Org sandbox-org is consuming 2368 MB of 102400 MB.
Space bxdm2836-space is consuming 2112 MB memory (2%) of org quota.
6 apps: 6 running 0 stopped
6 instances: 6 running, 0 stopped
You are running 6 apps in 1 org(s), with a total of 6 instances.
cf usage-report -f csv
OrgName, SpaceName, SpaceMemoryUsed, OrgMemoryQuota, AppsDeployed, AppsRunning, AppInstancesDeployed, AppInstancesRunning
sandbox-org, bxdm2836-space, 2112, 102400, 6, 6, 6, 6
cf login -a https://api.my-pcfdev.fr -u admin -p ** -o sandbox-org -s my-space
mkdir -p ~/script/cfusagereports/
cf usage-report -o sandbox-org -f csv > /root/script/cfusagereports/$(date +"%Y%m%d").cf-usage-report.csv
crontab -e
0 0 * /root/script/usagereport.sh &>/dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.