Prometheus metrics for CPU/Memory usage of apps deployed in a Cloud foundry space
Clone the repo somewhere (preferably outside your GOPATH):
$ git clone [email protected]:hsdp/cfprom
$ cd cfprom
$ go build .
This produce a logproxy binary exectable read for use
Alternatively, you can use the included Dockerfile to build a docker image which can be deployed to CF directly.
$ git clone [email protected]:hsdp/cfprom
$ cd cfprom
$ docker build -t cfprom .
Deploy cfprom to any CF space and it will create a Prometheus /metrics
endpoint which can be scraped. It uses the CF API to fetch statistics on all running applications. Currently it requires credentials of a CF account with the Auditor
role or better.
The following environment variables are used
Variable | Required | Description |
---|---|---|
CF_USERNAME | N | The CF login to use |
CF_PASSWORD | N | The CF password to use |
PASSWORD | N | The cfprom password |
When the PASSWORD
environment is set both the /metrics
and /bootstrap
endpoint will be protected by Basic Authentication. The username is always cfprom
If you do not wish to add CF_USERNAME
and CF_PASSWORD
to the environment you can bootstrap cfprom by posting the username and password to the /bootstrap
endpoint:
curl -X POST https://cfprom.<your_cf_domain>/bootstrap -d '{"username":"admin","password":"SuperS3cret"}'
Only after sending the correct credentials will cfprom be able to start collecting metrics. Note that this a tradeoff between security and convenience. You will have to bootstrap again if cfprom gets restarted or restaged for whatever reason.
Apache. Also see the NOTICE file.