SlideShare ist ein Scribd-Unternehmen logo
1 von 65
Downloaden Sie, um offline zu lesen
EXPLORINGTHE CLOUD FOUNDRY API
FOR FUN AND OPS
Josh Kruck

professional doer of things
github.com/krujos
@krujos
WHO AM I?
• Today
• pivotal customer success
• cf cli plugin author
• service broker author
• lots of little utilities for getting shit done
• Past
• a lot of storage and application management
• Why
• use software to make work more fun and be happier
maybe
you have
heard?
https://lynxbat.files.wordpress.com/2012/06/api.jpg
apidocs.cloudfoundry.org
done. good game. thanks everyone!
http://www.wired.com/2013/11/pivotal-one/
now what?
SOME IDEAS
• apps (dashboard, provisioner, automation, crypt keeper)
• cli plugins
• scripts (why aren’t you writing a cli plugin?)
• A one time thing? (jq will change your life)
SCRIPTS ARE AN ANTI PATTERN
CLI plugins FTW!
What are the things that got API on
them?
Service Brokers(more of a spec really)
Lots of other people talk about service brokers and how to author them, i won’t be covering them.
UAA(User Account and Authentication Server)
This is where we go to login. If you’re writing CLI plugins and scripts, it’s a non issue, but for any kind of app we’ll have to deal with it.
Firehose(the tattletale)
the emitter of most of the things
Collector(older tattletale)
emits a lot of the readable things
Cloud Controller(the brains)
The CC is where we got to listen and act.
but wait!
Router(eventually)
A feature that’s coming down the pipe is “router services”. While I don’t have anything to say on this today it is something to be aware of. It will allow us to do some inline
things at the router that we previously had to insert between our LB’s and routers.
THE DETAILS
UAA(User Account and Authentication Server)
This is where we go to login. If you’re writing CLI plugins and scripts, it’s a non issue, but for any kind of app we’ll have to deal with it.
WHEN/WHY DO WE INTERACT WITH
UAA?
• When we’re writing an application and DON’T want to inherit the
credentials of the user
• Dashboards, system automation and on boarding
System automation examples: 

	 Clean up orphaned services

	 Check for rouge users

	 Reports (new URL’s for nessus, apps pushed in the last day, crash summaries… whatevs).
WHEN/WHY DO WE INTERACT WITH
UAA?
• When we’re writing an (web) application and we DO want to inherit
the credentials of the user
• cli plugins and scripts can usually get this for free
System automation examples: 

	 Onboarding, cleanup, CI stuff (slackbots)
UN HUMANS
• For apps that do not act on behalf of a human we use
client_credentials
• See the OAuth 2.0 spec for more information
• https://tools.ietf.org/html/rfc6749#section-1.3.4
• http://tools.ietf.org/html/rfc6749#section-4.4
If you google, you will find people who have translated this into somewhat more complicated english than the spec provides.
GO
uri, _ := url.Parse(uaaURI.String() + "/oauth/token?
grant_type=client_credentials")
creds := &UaaClientCredentials{
uaaURI: uri,
clientID: clientID,
clientSecret: clientSecret,
}
client := http.Client{tls.Config{}}
req, _ := http.NewRequest("POST", creds.uaaURI.String(), nil)
req.SetBasicAuth(creds.clientID, creds.clientSecret)
resp, _ := client.Do(req)
auth = requests.auth.HTTPBasicAuth(client_id, client_secret)
r = requests.post(
url=uaa_uri,
headers={'accept': 'application/json'},
params={'grant_type': ‘client_credentials'},
auth=client_auth)
PYTHON
both of those examples assume certificate validation, see the docs for skipping it.
➜ curl “https://user:pass@uaa.mycf.xip.io/oauth/token" -d
grant_type=client_credentials -X POST | jq “.”
{
"access_token": “eyJhbG…C6Fvww”,
"token_type": "bearer",
"expires_in": 43199,
"scope": "doppler.firehose",
"jti": "2d56398d-ba65-4dbd-9f43-4d1a302709a1"
}
STOP WITHYOURTRICKERY AND GIVE
ME A SHELL MAN
THE IMPORTANTTHINGS
1. UAA exposes an API protected by HTTP Basic Auth that gives us a token

http(s)://uaa.example.com/oauth/token
2. We use a client_id & client_secret for auth
3. We pass it the grant type as a parameter

grant_type=client_credentials
4. It gives us back a token and time to live
note that you can indeed send your credentials in clear text. that’s a bad idea.

you can, and should prevent http requests from getting to uaa as your traffic can be sniffed.
UAA IS FOR PEOPLETOO?
• CLI Plugins you’ve already assumed the identity of the user
• Scripts should use & assume the identity of the logged in user via cf
curl
• password_grant otherwise (but srsly, why do it the hard way?)
• Web apps use the regular OAuth flow
For applications that act on behalf of humans we have a few options. 

For scripts cf curl is a good option as it means you can avoid (hopefully) managing usernames and passwords in the scripts.
require 'bundler'
require 'sinatra'
require 'omniauth'
require 'omniauth-uaa-oauth2'
use Rack::Session::Cookie, :secret => ‘its a secret'
use OmniAuth::Builder do
provider :cloudfoundry, 'app', 'appclientsecret',
{:auth_server_url => “https://login.run.cf.io", :token_server_url => “https://
uaa.run.cf.io"}
end
class App < Sinatra::Base
get '/' do
<ul><li><a href='/auth/cloudfoundry'>Sign in with Cloud Foundry</a></li></ul>
end
get '/auth/cloudfoundry/callback' do
content_type 'application/json'
request.env['omniauth.auth'].to_hash.to_json rescue "No Data"
end
get '/auth/failure' do
content_type 'text/plain'
request.env['omniauth.auth'].to_hash.inspect rescue "No Data"
end
end
run App.new
This one doesn’t do a redirect like I normally do, use has to click the auth link.
Firehose(the tattletale)
WHAT ISTHE FIREHOSE?
• The firehose is where we go to listen
• Combined stream of logs from all apps, plus metrics data from CF
components
• Exposed as a web socket endpoint
• Accessed via doppler.firehose scope
The scope means it’s unlikely your user accounts have access to it. 

Login w/ admin

Or create user in uaac.
WHATS INTHE FIREHOSE
• A lot, but not everything
• https://github.com/cloudfoundry/loggregator/wiki/Firehose-Metric-Catalog
• https://docs.google.com/spreadsheets/d/176yIaJChXEmvm-
CjybmwopdRGQfDGrSzo3J_Mx8mMnk/edit#gid=472741134
• heartbeats are being removed (rejoice!)
• https://lists.cloudfoundry.org/archives/list/cf-dev@lists.cloudfoundry.org/message/
EPTBPAJLBV4LAG72GOSK3KYO7MKZPL7B/
I find the most interesting things in the firehose to be http related. I can tell the status of every request in and out of the system, as well as it’s response time. This helps
me paint a picture of “normal”. It also helps me figure out “lights are on but no one’s home” situations. CF health check just make a connection on a socket, they don’t
check http response codes. So the firehose http metrics give me a good view of what my users are seeing.
HOWTO DISCOVER STUFF?
• noaa firehose sample app and grep
• ➜ export DOPPLER_ADDR=wss://doppler.10.244.0.34.xip.io:443
• ➜ CF_ACCESS_TOKEN=`cf oauth-token | grep bearer` ./firehose_sample
• https://github.com/cloudfoundry/noaa/blob/master/firehose_sample/
main.go
*note the app ignores cert validation errors.
WHAT’S INTERESTING
• POST’s to the Cloud Controller
origin:"router__0" eventType:HttpStartStop timestamp:1439755833436264212
deployment:"cf-warden" job:"router_z1" index:"0" ip:"10.244.0.22"
httpStartStop:<startTimestamp:1439755833419943436 stopTimestamp:
1439755833436264212 requestId:<low:8452822747789629966 high:
15632988695117975649 > peerType:Client method:POST uri:"api.10.244.0.34.xip.io/
v2/organizations" remoteAddress:"10.0.2.15:39470" userAgent:"go-cli
6.11.2-2a26d55 / darwin" statusCode:201 contentLength:1298
parentRequestId:<low:5137755037457773227 high:6003671325381183557 >
instanceId:"10.244.0.134:9022" >
WHAT’S INTERESTING
• POST’s to the Cloud Controller
origin:"router__0" eventType:HttpStartStop timestamp:1439755833436264212 …
peerType:Client method:POST uri:"api.10.244.0.34.xip.io/v2/organizations"
remoteAddress:"10.0.2.15:39470" userAgent:"go-cli 6.11.2-2a26d55 / darwin"
statusCode:201 … >
Someone just created an org successfully.
WHATS INTERESTING
➜ egrep "method:PUT|method:POST" /tmp/firehose.out | egrep -v "uaa|login"
origin:"router__0" eventType:HttpStartStop timestamp:1439756656563113538 deployment:"cf-warden" job:"router_z1" index:"0" ip:"10.244.0.22"
httpStartStop:<startTimestamp:1439756656523306795 stopTimestamp:1439756656563113538 requestId:<low:5639804705379164088 high:13655764414813434448 >
peerType:Client method:POST uri:"api.10.244.0.34.xip.io/v2/apps" remoteAddress:"10.0.2.15:43117" userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201
contentLength:1485 parentRequestId:<low:9677111003368022686 high:16762836456174757743 > instanceId:"10.244.0.134:9022" >
origin:"router__0" eventType:HttpStartStop timestamp:1439756656563296157 deployment:"cf-warden" job:"router_z1" index:"0" ip:"10.244.0.22"
httpStartStop:<startTimestamp:1439756656523150050 stopTimestamp:1439756656563296157 requestId:<low:9677111003368022686 high:16762836456174757743 >
peerType:Server method:POST uri:"api.10.244.0.34.xip.io/v2/apps" remoteAddress:"10.0.2.15:43117" userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201
contentLength:1485 >
origin:"router__0" eventType:HttpStartStop timestamp:1439756656712256742 deployment:"cf-warden" job:"router_z1" index:"0" ip:"10.244.0.22"
httpStartStop:<startTimestamp:1439756656666492905 stopTimestamp:1439756656712256742 requestId:<low:8304746205643063272 high:4491838666105706059 >
peerType:Client method:PUT uri:"api.10.244.0.34.xip.io/v2/apps/d2cd4770-64e0-44fe-a997-f2e7e6dc5c79/routes/15879527-b813-4165-9b04-8dc3f5af2a31"
remoteAddress:"10.0.2.15:43129" userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201 contentLength:1503 parentRequestId:<low:16449840403178608098 high:
13013670532211215483 > instanceId:"10.244.0.134:9022" >
origin:"legacy" eventType:LogMessage deployment:"cf-warden" job:"api_z1" index:"0" ip:"10.244.0.134" logMessage:<message:"Updated app with guid
d2cd4770-64e0-44fe-a997-f2e7e6dc5c79 ({"route"=>"15879527-b813-4165-9b04-8dc3f5af2a31"})" message_type:OUT timestamp:143975
6656694498836 app_id:"d2cd4770-64e0-44fe-a997-f2e7e6dc5c79" source_type:"API" source_instance:"0" >
origin:"router__0" eventType:HttpStartStop timestamp:1439756656712519692 deployment:"cf-warden" job:"router_z1" index:"0" ip:"10.244.0.22"
httpStartStop:<startTimestamp:1439756656666355668 stopTimestamp:1439756656712519692 requestId:<low:16449840403178608098 high:13013670532211215483 >
peerType:Server method:PUT uri:"api.10.244.0.34.xip.io/v2/apps/d2cd4770-64e0-44fe-a997-f2e7e6dc5c79/routes/15879527-b813-4165-9b04-8dc3f5af2a31"
remoteAddress:"10.0.2.15:43129" userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201 contentLength:1503 >
origin:"router__0" eventType:HttpStartStop timestamp:1439756656786930549 deployment:"cf-warden" job:"router_z1" index:"0" ip:"10.244.0.22"
httpStartStop:<startTimestamp:1439756656765375916 stopTimestamp:1439756656786930549 requestId:<low:15224145774697211575 high:9071476560656655465 >
peerType:Client method:PUT uri:"api.10.244.0.34.xip.io/v2/apps/d2cd4770-64e0-44fe-a997-f2e7e6dc5c79/bits" remoteAddress:"10.0.2.15:43133" userAgent:"go-cli
6.11.2-2a26d55 / darwin" statusCode:201 contentLength:270 parentRequestId:<low:13565402856673872720 high:11582024932942486143 > instanceId:"10.244.0.134:9022"
>
origin:"router__0" eventType:HttpStartStop timestamp:1439756656787167491 deployment:"cf-warden" job:"router_z1" index:"0" ip:"10.244.0.22"
httpStartStop:<startTimestamp:1439756656765234958 stopTimestamp:1439756656787167491 requestId:<low:13565402856673872720 high:11582024932942486143 >
peerType:Server method:PUT uri:"api.10.244.0.34.xip.io/v2/apps/d2cd4770-64e0-44fe-a997-f2e7e6dc5c79/bits" remoteAddress:"10.0.2.15:43133" userAgent:"go-cli
6.11.2-2a26d55 / darwin" statusCode:201 contentLength:270 >
origin:"router__0" eventType:HttpStartStop timestamp:1439756663113749547 deployment:"cf-warden" job:"router_z1" index:"0" ip:"10.244.0.22"
httpStartStop:<startTimestamp:1439756661872770559 stopTimestamp:1439756663113749547 requestId:<low:10468161744519186019 high:3081438611027230039 >
peerType:Client method:PUT uri:"api.10.244.0.34.xip.io/v2/apps/d2cd4770-64e0-44fe-a997-f2e7e6dc5c79" remoteAddress:"10.0.2.15:43167" userAgent:"go-cli
6.11.2-2a26d55 / darwin" statusCode:201 contentLength:4073 parentRequestId:<low:16375959389728685162 high:5351609031812398929 > instanceId:"10.244.0.134:9022"
>
origin:"router__0" eventType:HttpStartStop timestamp:1439756663114085243 deployment:"cf-warden" job:"router_z1" index:"0" ip:"10.244.0.22"
httpStartStop:<startTimestamp:1439756661872568200 stopTimestamp:1439756663114085243 requestId:<low:16375959389728685162 high:5351609031812398929 >
peerType:Server method:PUT uri:"api.10.244.0.34.xip.io/v2/apps/d2cd4770-64e0-44fe-a997-f2e7e6dc5c79" remoteAddress:"10.0.2.15:43167" userAgent:"go-cli
6.11.2-2a26d55 / darwin" statusCode:201 contentLength:4073 >
lets distill this and just look at app interactions
WHATS INTERESTING
timestamp:1439756656563113538 httpStartStop:<startTimestamp:1439756656523306795 stopTimestamp:1439756656563113538
peerType:Client method:POST uri:"api.10.244.0.34.xip.io/v2/apps" remoteAddress:"10.0.2.15:43117" userAgent:"go-cli
6.11.2-2a26d55 / darwin" statusCode:201 instanceId:"10.244.0.134:9022" >
timestamp:1439756656563296157 httpStartStop:<startTimestamp:1439756656523150050 stopTimestamp:1439756656563296157
peerType:Server method:POST uri:"api.10.244.0.34.xip.io/v2/apps" remoteAddress:"10.0.2.15:43117" userAgent:"go-cli
6.11.2-2a26d55 / darwin" statusCode:201 >
timestamp:1439756656712256742 httpStartStop:<startTimestamp:1439756656666492905 stopTimestamp:1439756656712256742
peerType:Client method:PUT uri:"api.10.244.0.34.xip.io/v2/apps/d2cd4770-64e0-44fe-a997-f2e7e6dc5c79/routes/15879527-
b813-4165-9b04-8dc3f5af2a31" remoteAddress:"10.0.2.15:43129" userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201
instanceId:"10.244.0.134:9022" >
timestamp:1439756656712519692 httpStartStop:<startTimestamp:1439756656666355668 stopTimestamp:1439756656712519692
peerType:Server method:PUT uri:"api.10.244.0.34.xip.io/v2/apps/d2cd4770-64e0-44fe-a997-f2e7e6dc5c79/routes/15879527-
b813-4165-9b04-8dc3f5af2a31" remoteAddress:"10.0.2.15:43129" userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201 >
timestamp:1439756656786930549 httpStartStop:<startTimestamp:1439756656765375916 stopTimestamp:1439756656786930549
peerType:Client method:PUT uri:"api.10.244.0.34.xip.io/v2/apps/d2cd4770-64e0-44fe-a997-f2e7e6dc5c79/bits"
remoteAddress:"10.0.2.15:43133" userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201 instanceId:"10.244.0.134:9022" >
timestamp:1439756656787167491 httpStartStop:<startTimestamp:1439756656765234958 stopTimestamp:1439756656787167491
peerType:Server method:PUT uri:"api.10.244.0.34.xip.io/v2/apps/d2cd4770-64e0-44fe-a997-f2e7e6dc5c79/bits"
remoteAddress:"10.0.2.15:43133" userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201 >
timestamp:1439756663113749547 httpStartStop:<startTimestamp:1439756661872770559 stopTimestamp:1439756663113749547
peerType:Client method:PUT uri:"api.10.244.0.34.xip.io/v2/apps/d2cd4770-64e0-44fe-a997-f2e7e6dc5c79"
remoteAddress:"10.0.2.15:43167" userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201 instanceId:"10.244.0.134:9022" >
timestamp:1439756663114085243 httpStartStop:<startTimestamp:1439756661872568200 stopTimestamp:1439756663114085243
peerType:Server method:PUT uri:"api.10.244.0.34.xip.io/v2/apps/d2cd4770-64e0-44fe-a997-f2e7e6dc5c79"
remoteAddress:"10.0.2.15:43167" userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201 >
lets distill further and just grab some of the fields we’re interested in. We can see some requests being passed through the system by looking at the http traffic. Kind of a
poor mans after the fact zipkin.
WHATS INTERESTING
timestamp:1439756656563113538 httpStartStop:<startTimestamp:1439756656523306795 stopTimestamp:1439756656563113538
peerType:Client method:POST uri:"api.10.244.0.34.xip.io/v2/apps" remoteAddress:"10.0.2.15:43117" userAgent:"go-cli
6.11.2-2a26d55 / darwin" statusCode:201 instanceId:"10.244.0.134:9022" >
timestamp:1439756656563296157 httpStartStop:<startTimestamp:1439756656523150050 stopTimestamp:1439756656563296157
peerType:Server method:POST uri:"api.10.244.0.34.xip.io/v2/apps" remoteAddress:"10.0.2.15:43117" userAgent:"go-cli
6.11.2-2a26d55 / darwin" statusCode:201 >
timestamp:1439756656712256742 httpStartStop:<startTimestamp:1439756656666492905 stopTimestamp:1439756656712256742
peerType:Client method:PUT uri:"api.10.244.0.34.xip.io/v2/apps/d2cd4770-64e0-44fe-a997-f2e7e6dc5c79/routes/15879527-
b813-4165-9b04-8dc3f5af2a31" remoteAddress:"10.0.2.15:43129" userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201
instanceId:"10.244.0.134:9022" >
timestamp:1439756656712519692 httpStartStop:<startTimestamp:1439756656666355668 stopTimestamp:1439756656712519692
peerType:Server method:PUT uri:"api.10.244.0.34.xip.io/v2/apps/d2cd4770-64e0-44fe-a997-f2e7e6dc5c79/routes/15879527-
b813-4165-9b04-8dc3f5af2a31" remoteAddress:"10.0.2.15:43129" userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201 >
timestamp:1439756656786930549 httpStartStop:<startTimestamp:1439756656765375916 stopTimestamp:1439756656786930549
peerType:Client method:PUT uri:"api.10.244.0.34.xip.io/v2/apps/d2cd4770-64e0-44fe-a997-f2e7e6dc5c79/bits"
remoteAddress:"10.0.2.15:43133" userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201 instanceId:"10.244.0.134:9022" >
timestamp:1439756656787167491 httpStartStop:<startTimestamp:1439756656765234958 stopTimestamp:1439756656787167491
peerType:Server method:PUT uri:"api.10.244.0.34.xip.io/v2/apps/d2cd4770-64e0-44fe-a997-f2e7e6dc5c79/bits"
remoteAddress:"10.0.2.15:43133" userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201 >
timestamp:1439756663113749547 httpStartStop:<startTimestamp:1439756661872770559 stopTimestamp:1439756663113749547
peerType:Client method:PUT uri:"api.10.244.0.34.xip.io/v2/apps/d2cd4770-64e0-44fe-a997-f2e7e6dc5c79"
remoteAddress:"10.0.2.15:43167" userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201 instanceId:"10.244.0.134:9022" >
timestamp:1439756663114085243 httpStartStop:<startTimestamp:1439756661872568200 stopTimestamp:1439756663114085243
peerType:Server method:PUT uri:"api.10.244.0.34.xip.io/v2/apps/d2cd4770-64e0-44fe-a997-f2e7e6dc5c79"
remoteAddress:"10.0.2.15:43167" userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201 >
So now we can see that we have a client talking to a server and a server talking to a server
WHATS INTERESTING
timestamp:1439756656563113538 httpStartStop:<startTimestamp:1439756656523306795
stopTimestamp:1439756656563113538 peerType:Client method:POST uri:"api.10.244.0.34.xip.io/
v2/apps" remoteAddress:"10.0.2.15:43117" userAgent:"go-cli 6.11.2-2a26d55 / darwin"
statusCode:201 instanceId:"10.244.0.134:9022" >
timestamp:1439756656712256742 httpStartStop:<startTimestamp:1439756656666492905
stopTimestamp:1439756656712256742 peerType:Client method:PUT uri:"api.10.244.0.34.xip.io/
v2/apps/d2cd4770-64e0-44fe-a997-f2e7e6dc5c79/routes/15879527-b813-4165-9b04-8dc3f5af2a31"
remoteAddress:"10.0.2.15:43129" userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201
instanceId:"10.244.0.134:9022" >
timestamp:1439756656786930549 httpStartStop:<startTimestamp:1439756656765375916
stopTimestamp:1439756656786930549 peerType:Client method:PUT uri:"api.10.244.0.34.xip.io/
v2/apps/d2cd4770-64e0-44fe-a997-f2e7e6dc5c79/bits" remoteAddress:"10.0.2.15:43133"
userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201 instanceId:"10.244.0.134:9022" >
timestamp:1439756663113749547 httpStartStop:<startTimestamp:1439756661872770559
stopTimestamp:1439756663113749547 peerType:Client method:PUT uri:"api.10.244.0.34.xip.io/
v2/apps/d2cd4770-64e0-44fe-a997-f2e7e6dc5c79" remoteAddress:"10.0.2.15:43167"
userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201 instanceId:"10.244.0.134:9022" >
lets distill further, to just client operations.
WHATS INTERESTING
timestamp:1439756656563113538 httpStartStop:<startTimestamp:1439756656523306795
stopTimestamp:1439756656563113538 peerType:Client method:POST uri:"api.10.244.0.34.xip.io/
v2/apps" remoteAddress:"10.0.2.15:43117" userAgent:"go-cli 6.11.2-2a26d55 / darwin"
statusCode:201 instanceId:"10.244.0.134:9022" >
timestamp:1439756656712256742 httpStartStop:<startTimestamp:1439756656666492905
stopTimestamp:1439756656712256742 peerType:Client method:PUT uri:"api.10.244.0.34.xip.io/
v2/apps/d2cd4770-64e0-44fe-a997-f2e7e6dc5c79/routes/15879527-b813-4165-9b04-8dc3f5af2a31"
remoteAddress:"10.0.2.15:43129" userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201
instanceId:"10.244.0.134:9022" >
timestamp:1439756656786930549 httpStartStop:<startTimestamp:1439756656765375916
stopTimestamp:1439756656786930549 peerType:Client method:PUT uri:"api.10.244.0.34.xip.io/
v2/apps/d2cd4770-64e0-44fe-a997-f2e7e6dc5c79/bits" remoteAddress:"10.0.2.15:43133"
userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201 instanceId:"10.244.0.134:9022" >
timestamp:1439756663113749547 httpStartStop:<startTimestamp:1439756661872770559
stopTimestamp:1439756663113749547 peerType:Client method:PUT uri:"api.10.244.0.34.xip.io/
v2/apps/d2cd4770-64e0-44fe-a997-f2e7e6dc5c79" remoteAddress:"10.0.2.15:43167"
userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201 instanceId:"10.244.0.134:9022" >
Lets make sure we’re tracing one user’s experience through the system.

note the port changed? Why? I suspect the CLI had to open a new connection..
WHATS INTERESTING
timestamp:1439756656563113538 httpStartStop:<startTimestamp:1439756656523306795
stopTimestamp:1439756656563113538 peerType:Client method:POST uri:"api.10.244.0.34.xip.io/
v2/apps" remoteAddress:"10.0.2.15:43117" userAgent:"go-cli 6.11.2-2a26d55 / darwin"
statusCode:201 instanceId:"10.244.0.134:9022" >
timestamp:1439756656712256742 httpStartStop:<startTimestamp:1439756656666492905
stopTimestamp:1439756656712256742 peerType:Client method:PUT uri:"api.10.244.0.34.xip.io/
v2/apps/d2cd4770-64e0-44fe-a997-f2e7e6dc5c79/routes/15879527-b813-4165-9b04-8dc3f5af2a31"
remoteAddress:"10.0.2.15:43129" userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201
instanceId:"10.244.0.134:9022" >
timestamp:1439756656786930549 httpStartStop:<startTimestamp:1439756656765375916
stopTimestamp:1439756656786930549 peerType:Client method:PUT uri:"api.10.244.0.34.xip.io/
v2/apps/d2cd4770-64e0-44fe-a997-f2e7e6dc5c79/bits" remoteAddress:"10.0.2.15:43133"
userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201 instanceId:"10.244.0.134:9022" >
timestamp:1439756663113749547 httpStartStop:<startTimestamp:1439756661872770559
stopTimestamp:1439756663113749547 peerType:Client method:PUT uri:"api.10.244.0.34.xip.io/
v2/apps/d2cd4770-64e0-44fe-a997-f2e7e6dc5c79" remoteAddress:"10.0.2.15:43167"
userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201 instanceId:"10.244.0.134:9022" >
lets distill further, to just client operations, we can trace one user’s experience through the system.

How long did their operation take? (6.5 seconds), firehose timestamps are nano seconds.
WHATS INTERESTING
timestamp:1439756656563113538 httpStartStop:<startTimestamp:1439756656523306795
stopTimestamp:1439756656563113538 peerType:Client method:POST uri:"api.10.244.0.34.xip.io/
v2/apps" remoteAddress:"10.0.2.15:43117" userAgent:"go-cli 6.11.2-2a26d55 / darwin"
statusCode:201 instanceId:"10.244.0.134:9022" >
timestamp:1439756656712256742 httpStartStop:<startTimestamp:1439756656666492905
stopTimestamp:1439756656712256742 peerType:Client method:PUT uri:"api.10.244.0.34.xip.io/
v2/apps/d2cd4770-64e0-44fe-a997-f2e7e6dc5c79/routes/15879527-b813-4165-9b04-8dc3f5af2a31"
remoteAddress:"10.0.2.15:43129" userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201
instanceId:"10.244.0.134:9022" >
timestamp:1439756656786930549 httpStartStop:<startTimestamp:1439756656765375916
stopTimestamp:1439756656786930549 peerType:Client method:PUT uri:"api.10.244.0.34.xip.io/
v2/apps/d2cd4770-64e0-44fe-a997-f2e7e6dc5c79/bits" remoteAddress:"10.0.2.15:43133"
userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201 instanceId:"10.244.0.134:9022" >
timestamp:1439756663113749547 httpStartStop:<startTimestamp:1439756661872770559
stopTimestamp:1439756663113749547 peerType:Client method:PUT uri:"api.10.244.0.34.xip.io/
v2/apps/d2cd4770-64e0-44fe-a997-f2e7e6dc5c79" remoteAddress:"10.0.2.15:43167"
userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201 instanceId:"10.244.0.134:9022" >
What did they do what was the output? 

First one crates the app. 

second one uploads the bits

third one does a state change to start apps.
WHY ISTHAT INTERESTING?
• If I can learn what normal interaction patterns are, I can identify
abnormal ones and investigate
• Are apps failing to start after a push?
• For all teams?
to me anyway.

this lets us identify and view actions across the entirety of the user base. 

Could you do this with platform logs? Probably. The beauty of the firehose is it gives you all of it, I omitted the logs from my example for readability and dramatic effect.
Collector(older tattletale)
WHAT ISTHE COLLECTOR
• The collector is the “legacy” aggregator of CF metrics
• No log messages
• Grabbed all the /varz and /healthz data
• The collector still has a lot of relevant runtime information in it
• available_stagers, healthy, system.cpu.wait
Most of the collector usage is for dashboards.
WHAT ISTHE COLLECTOR FOR
• It’s also how we export metrics in open source via historian plugins
• https://github.com/cloudfoundry/collector/tree/master/lib/collector/
historian
• Vendors (well Pivotal at least) have their own spin
• Pivotal Ops Metrics (JMX)
The historian plugins change the way data is presented. They are usually monitoring solution specific.
COLLECTOR DOWNSIDE
• Vendors don’t install all the plugins in their distribution
• Consumption can be irritating, lots of guesswork
• You may end up pretending to be a historian plugin, or consuming
ones output.
Cloud Controller(the brains)
The CC is where we got to listen and act.
CLOUD CONTROLLER
• The CC API is what we talk to the most
• api.run.pivotal.io
• The CC API is where we go to act and report
THE CC API IS UNSURPRISING
• Which is to say, the api has all of the things you would expect
• /v2/apps
• /v3/apps (experimental)
• /v2/organizations
• /v2/events
• /v2/spaces
or kinda boring
API DETAILS
• the v3 api is totes HATEOAS compliant!!!
• the v2 api has some links conventions
THE APITEAM COMMITTEDTO
MAINTAINING BACKWARDS COMPATIBILITY
• v3 api’s will have v2 compatibility layers
• I was there, they said it at cf summit, it’s like they wrote it in their
own blood
API DETAILS
• The v2 api is very, very, very verbose
• The v3 api is more targeted
API DETAILS
• v3 api is fun to talk about, but as of today much of it doesn’t exist
outside of documentation.
• we will see some examples later.
Pitfalls and gotchas
http://imgur.com/gallery/LaJ9Kmo
VERSIONS
does thing you read about exist in your
version
EXPERIMENTAL REALLY MEANS
EXPERIMENTAL.
Theres a good chance it won’t be there (or be the same) in your
vendors next release
(I’m looking at you async service broker api)
SOMETIMES IT’S NOT PRETTY
➜ cf curl /v2/apps/<a guid> | grep buildpack
"buildpack": null,
"detected_buildpack": "PHP",
TOKENS MUST BE ACQUIRED
ANDTHEY EXPIRE
https://github.com/cloudfoundry/cf-uaa-lib (Ruby)
https://github.com/cloudfoundry/omniauth-uaa-oauth2 (more ruby)
https://github.com/krujos/uaaclientcredentials (Go)
CLIENTSVS USERS
https://docs.google.com/document/d/1YU01vrGmIhSHCKOFIRY7EhU8qCbUHJsw3ZXgdnUIfeI/edit
TODO: move that somewhere permanent, and more public.
What’s a client?
What’s a user?
UAA
http? https?
be safe!
SCOPES,AUTHORITY ANDTHE
GRANTING OF POWER
SO HOW DO I BUILD ATHING?
• it starts with cf curl and jq
• or the firehose and grep
• lets see what the firehose has to say about started apps?
export DOPPLER_ADDR=wss://doppler.10.244.0.34.xip.io:443

CF_ACCESS_TOKEN=`cf oauth-token | grep bearer` ./firehose_sample | grep -i started

cf stop hello-node

cf start hello-node
• how about orphaned user provided services?
cf cups my-svc -p '{"foo":"bar"}'

cf curl /v2/user_provided_service_instances

cf curl `cf curl /v2/user_provided_service_instances | jq -r '.resources[0].entity.service_bindings_url'` | jq ‘.total_results'

Think about what we would have had to do to report on that with the CLI?
• lets look at something more complex.
• how many ai’s are you running?
• How does the usage-report plugin work?
• https://github.com/krujos/usagereport-plugin
demo the plugin

sometimes its about mashing things up

Why is how many ai’s your running a hard question to answer?

Why is how many ai’s your running an important question to answer?

	 As someone who’s paying for IT charge back, am I paying too much?

How much ram am I consuming, are my quotas right?

make note of the lack of auth, plugin assumes current user, works for everyone based on their cf access.



magic starts here: https://github.com/krujos/usagereport-plugin/blob/master/usagereport.go#L57

https://github.com/krujos/usagereport-plugin/blob/master/apihelper/apihelper.go
• What’s fun? what should we try to figure out?

Weitere ähnliche Inhalte

Was ist angesagt?

Serverless in production, an experience report (codemotion milan)
Serverless in production, an experience report (codemotion milan)Serverless in production, an experience report (codemotion milan)
Serverless in production, an experience report (codemotion milan)Yan Cui
 
Nightwatch at Tilt
Nightwatch at TiltNightwatch at Tilt
Nightwatch at TiltDave King
 
High Performance JavaScript (CapitolJS 2011)
High Performance JavaScript (CapitolJS 2011)High Performance JavaScript (CapitolJS 2011)
High Performance JavaScript (CapitolJS 2011)Nicholas Zakas
 
Effectively Testing Services - Burlington Ruby Conf
Effectively Testing Services - Burlington Ruby ConfEffectively Testing Services - Burlington Ruby Conf
Effectively Testing Services - Burlington Ruby Confneal_kemp
 
High Performance JavaScript 2011
High Performance JavaScript 2011High Performance JavaScript 2011
High Performance JavaScript 2011Nicholas Zakas
 
APIs, now and in the future
APIs, now and in the futureAPIs, now and in the future
APIs, now and in the futureChris Mills
 
APIs for modern web apps
APIs for modern web appsAPIs for modern web apps
APIs for modern web appsChris Mills
 
Usability in the GeoWeb
Usability in the GeoWebUsability in the GeoWeb
Usability in the GeoWebDave Bouwman
 
Web versus Native: round 1!
Web versus Native: round 1!Web versus Native: round 1!
Web versus Native: round 1!Chris Mills
 
Empowering the "mobile web"
Empowering the "mobile web"Empowering the "mobile web"
Empowering the "mobile web"Chris Mills
 
High Performance Snippets
High Performance SnippetsHigh Performance Snippets
High Performance SnippetsSteve Souders
 
How to build observability into a serverless application
How to build observability into a serverless applicationHow to build observability into a serverless application
How to build observability into a serverless applicationYan Cui
 
EuroPython 2011 - How to build complex web applications having fun?
EuroPython 2011 - How to build complex web applications having fun?EuroPython 2011 - How to build complex web applications having fun?
EuroPython 2011 - How to build complex web applications having fun?Andrew Mleczko
 
Testing Web Applications
Testing Web ApplicationsTesting Web Applications
Testing Web ApplicationsSeth McLaughlin
 
ForwardJS 2017 - Fullstack end-to-end Test Automation with node.js
ForwardJS 2017 -  Fullstack end-to-end Test Automation with node.jsForwardJS 2017 -  Fullstack end-to-end Test Automation with node.js
ForwardJS 2017 - Fullstack end-to-end Test Automation with node.jsMek Srunyu Stittri
 
Laravel Forge: Hello World to Hello Production
Laravel Forge: Hello World to Hello ProductionLaravel Forge: Hello World to Hello Production
Laravel Forge: Hello World to Hello ProductionJoe Ferguson
 
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx France 2016
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx France 2016Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx France 2016
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx France 2016Matt Raible
 
Cross-platform logging and analytics
Cross-platform logging and analyticsCross-platform logging and analytics
Cross-platform logging and analyticsDrew Crawford
 
Join the darkside: Selenium testing with Nightwatch.js
Join the darkside: Selenium testing with Nightwatch.jsJoin the darkside: Selenium testing with Nightwatch.js
Join the darkside: Selenium testing with Nightwatch.jsSeth McLaughlin
 

Was ist angesagt? (20)

Serverless in production, an experience report (codemotion milan)
Serverless in production, an experience report (codemotion milan)Serverless in production, an experience report (codemotion milan)
Serverless in production, an experience report (codemotion milan)
 
Nightwatch at Tilt
Nightwatch at TiltNightwatch at Tilt
Nightwatch at Tilt
 
High Performance JavaScript (CapitolJS 2011)
High Performance JavaScript (CapitolJS 2011)High Performance JavaScript (CapitolJS 2011)
High Performance JavaScript (CapitolJS 2011)
 
Effectively Testing Services - Burlington Ruby Conf
Effectively Testing Services - Burlington Ruby ConfEffectively Testing Services - Burlington Ruby Conf
Effectively Testing Services - Burlington Ruby Conf
 
Cache is King
Cache is KingCache is King
Cache is King
 
High Performance JavaScript 2011
High Performance JavaScript 2011High Performance JavaScript 2011
High Performance JavaScript 2011
 
APIs, now and in the future
APIs, now and in the futureAPIs, now and in the future
APIs, now and in the future
 
APIs for modern web apps
APIs for modern web appsAPIs for modern web apps
APIs for modern web apps
 
Usability in the GeoWeb
Usability in the GeoWebUsability in the GeoWeb
Usability in the GeoWeb
 
Web versus Native: round 1!
Web versus Native: round 1!Web versus Native: round 1!
Web versus Native: round 1!
 
Empowering the "mobile web"
Empowering the "mobile web"Empowering the "mobile web"
Empowering the "mobile web"
 
High Performance Snippets
High Performance SnippetsHigh Performance Snippets
High Performance Snippets
 
How to build observability into a serverless application
How to build observability into a serverless applicationHow to build observability into a serverless application
How to build observability into a serverless application
 
EuroPython 2011 - How to build complex web applications having fun?
EuroPython 2011 - How to build complex web applications having fun?EuroPython 2011 - How to build complex web applications having fun?
EuroPython 2011 - How to build complex web applications having fun?
 
Testing Web Applications
Testing Web ApplicationsTesting Web Applications
Testing Web Applications
 
ForwardJS 2017 - Fullstack end-to-end Test Automation with node.js
ForwardJS 2017 -  Fullstack end-to-end Test Automation with node.jsForwardJS 2017 -  Fullstack end-to-end Test Automation with node.js
ForwardJS 2017 - Fullstack end-to-end Test Automation with node.js
 
Laravel Forge: Hello World to Hello Production
Laravel Forge: Hello World to Hello ProductionLaravel Forge: Hello World to Hello Production
Laravel Forge: Hello World to Hello Production
 
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx France 2016
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx France 2016Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx France 2016
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx France 2016
 
Cross-platform logging and analytics
Cross-platform logging and analyticsCross-platform logging and analytics
Cross-platform logging and analytics
 
Join the darkside: Selenium testing with Nightwatch.js
Join the darkside: Selenium testing with Nightwatch.jsJoin the darkside: Selenium testing with Nightwatch.js
Join the darkside: Selenium testing with Nightwatch.js
 

Andere mochten auch

Certificate of Achievement
Certificate of AchievementCertificate of Achievement
Certificate of AchievementMichael Mazzer
 
VIRTUALLEARNING ENVIRONMENT AND VIRTUALLABS IN EDUCATION FIELD
VIRTUALLEARNING ENVIRONMENT AND VIRTUALLABS IN EDUCATION FIELD VIRTUALLEARNING ENVIRONMENT AND VIRTUALLABS IN EDUCATION FIELD
VIRTUALLEARNING ENVIRONMENT AND VIRTUALLABS IN EDUCATION FIELD vijithachikku
 
1. establish the school year's learning curriculum.final
1. establish the school year's learning curriculum.final1. establish the school year's learning curriculum.final
1. establish the school year's learning curriculum.finalTeaching Teachers Literacy
 
Omega-3 DHA Nutrition & Application - Nutrition SC Bangkok Seminar 18 Sep 200...
Omega-3 DHA Nutrition & Application - Nutrition SC Bangkok Seminar 18 Sep 200...Omega-3 DHA Nutrition & Application - Nutrition SC Bangkok Seminar 18 Sep 200...
Omega-3 DHA Nutrition & Application - Nutrition SC Bangkok Seminar 18 Sep 200...Poh Len Pek
 
Fundamentos basicos del mantenimiento conceptos basicos del mantenimiento
Fundamentos basicos del mantenimiento  conceptos basicos del mantenimientoFundamentos basicos del mantenimiento  conceptos basicos del mantenimiento
Fundamentos basicos del mantenimiento conceptos basicos del mantenimientoJose Rodriguez
 
Glycogen storage disease LB
Glycogen storage disease LBGlycogen storage disease LB
Glycogen storage disease LBLeul Biruk
 
Post partum hemorrhage LB
Post partum hemorrhage LBPost partum hemorrhage LB
Post partum hemorrhage LBLeul Biruk
 
Rdr n° 00478 2017 drelp suspension de labores escolares hasta el 24 de marzo
Rdr n° 00478   2017 drelp suspension de labores escolares hasta el 24 de marzoRdr n° 00478   2017 drelp suspension de labores escolares hasta el 24 de marzo
Rdr n° 00478 2017 drelp suspension de labores escolares hasta el 24 de marzoLuis Coca Lazo
 
TICycosas Trabajo sobre Powerpoint
TICycosas Trabajo sobre PowerpointTICycosas Trabajo sobre Powerpoint
TICycosas Trabajo sobre PowerpointDiego Ballesol
 

Andere mochten auch (14)

Certificate of Achievement
Certificate of AchievementCertificate of Achievement
Certificate of Achievement
 
Pharma CRM - Critical Role of FLMs
Pharma CRM - Critical Role of FLMsPharma CRM - Critical Role of FLMs
Pharma CRM - Critical Role of FLMs
 
VIRTUALLEARNING ENVIRONMENT AND VIRTUALLABS IN EDUCATION FIELD
VIRTUALLEARNING ENVIRONMENT AND VIRTUALLABS IN EDUCATION FIELD VIRTUALLEARNING ENVIRONMENT AND VIRTUALLABS IN EDUCATION FIELD
VIRTUALLEARNING ENVIRONMENT AND VIRTUALLABS IN EDUCATION FIELD
 
1. establish the school year's learning curriculum.final
1. establish the school year's learning curriculum.final1. establish the school year's learning curriculum.final
1. establish the school year's learning curriculum.final
 
Omega-3 DHA Nutrition & Application - Nutrition SC Bangkok Seminar 18 Sep 200...
Omega-3 DHA Nutrition & Application - Nutrition SC Bangkok Seminar 18 Sep 200...Omega-3 DHA Nutrition & Application - Nutrition SC Bangkok Seminar 18 Sep 200...
Omega-3 DHA Nutrition & Application - Nutrition SC Bangkok Seminar 18 Sep 200...
 
02. letra-s-de-sopa
02. letra-s-de-sopa02. letra-s-de-sopa
02. letra-s-de-sopa
 
Fundamentos basicos del mantenimiento conceptos basicos del mantenimiento
Fundamentos basicos del mantenimiento  conceptos basicos del mantenimientoFundamentos basicos del mantenimiento  conceptos basicos del mantenimiento
Fundamentos basicos del mantenimiento conceptos basicos del mantenimiento
 
Glycogen storage disease LB
Glycogen storage disease LBGlycogen storage disease LB
Glycogen storage disease LB
 
Post partum hemorrhage LB
Post partum hemorrhage LBPost partum hemorrhage LB
Post partum hemorrhage LB
 
Nbr 10152 1987-conforto acústico
Nbr 10152 1987-conforto acústicoNbr 10152 1987-conforto acústico
Nbr 10152 1987-conforto acústico
 
Diomedes
DiomedesDiomedes
Diomedes
 
Rdr n° 00478 2017 drelp suspension de labores escolares hasta el 24 de marzo
Rdr n° 00478   2017 drelp suspension de labores escolares hasta el 24 de marzoRdr n° 00478   2017 drelp suspension de labores escolares hasta el 24 de marzo
Rdr n° 00478 2017 drelp suspension de labores escolares hasta el 24 de marzo
 
TICycosas Trabajo sobre Powerpoint
TICycosas Trabajo sobre PowerpointTICycosas Trabajo sobre Powerpoint
TICycosas Trabajo sobre Powerpoint
 
Msc thesis Anagnostopulos Danai Iris
Msc thesis Anagnostopulos Danai IrisMsc thesis Anagnostopulos Danai Iris
Msc thesis Anagnostopulos Danai Iris
 

Ähnlich wie Cloud Foundry API for Fun and Ops

DEF CON 23 - BRENT - white hacking web apps wp
DEF CON 23 - BRENT - white hacking web apps wpDEF CON 23 - BRENT - white hacking web apps wp
DEF CON 23 - BRENT - white hacking web apps wpFelipe Prado
 
Chris Mathias Presents Advanced API Design Considerations at LA CTO Forum
Chris Mathias Presents Advanced API Design Considerations at LA CTO ForumChris Mathias Presents Advanced API Design Considerations at LA CTO Forum
Chris Mathias Presents Advanced API Design Considerations at LA CTO ForumChris Mathias
 
OAuth for QuickBooks Online REST Services
OAuth for QuickBooks Online REST ServicesOAuth for QuickBooks Online REST Services
OAuth for QuickBooks Online REST ServicesIntuit Developer
 
JOSA TechTalks - RESTful API Concepts and Best Practices
JOSA TechTalks - RESTful API Concepts and Best PracticesJOSA TechTalks - RESTful API Concepts and Best Practices
JOSA TechTalks - RESTful API Concepts and Best PracticesJordan Open Source Association
 
How to get along with HATEOAS without letting the bad guys steal your lunch -...
How to get along with HATEOAS without letting the bad guys steal your lunch -...How to get along with HATEOAS without letting the bad guys steal your lunch -...
How to get along with HATEOAS without letting the bad guys steal your lunch -...YK Chang
 
Rest API with Swagger and NodeJS
Rest API with Swagger and NodeJSRest API with Swagger and NodeJS
Rest API with Swagger and NodeJSLuigi Saetta
 
DevOps on AWS: Deep Dive on Continuous Delivery and the AWS Developer Tools
DevOps on AWS: Deep Dive on Continuous Delivery and the AWS Developer ToolsDevOps on AWS: Deep Dive on Continuous Delivery and the AWS Developer Tools
DevOps on AWS: Deep Dive on Continuous Delivery and the AWS Developer ToolsAmazon Web Services
 
AD113 Speed Up Your Applications w/ Nginx and PageSpeed
AD113  Speed Up Your Applications w/ Nginx and PageSpeedAD113  Speed Up Your Applications w/ Nginx and PageSpeed
AD113 Speed Up Your Applications w/ Nginx and PageSpeededm00se
 
Dev ops on aws deep dive on continuous delivery - Toronto
Dev ops on aws deep dive on continuous delivery - TorontoDev ops on aws deep dive on continuous delivery - Toronto
Dev ops on aws deep dive on continuous delivery - TorontoAmazon Web Services
 
DevOps On AWS - Deep Dive on Continuous Delivery
DevOps On AWS - Deep Dive on Continuous DeliveryDevOps On AWS - Deep Dive on Continuous Delivery
DevOps On AWS - Deep Dive on Continuous DeliveryMikhail Prudnikov
 
HashiCorp Vault configuration as code via HashiCorp Terraform- stories from t...
HashiCorp Vault configuration as code via HashiCorp Terraform- stories from t...HashiCorp Vault configuration as code via HashiCorp Terraform- stories from t...
HashiCorp Vault configuration as code via HashiCorp Terraform- stories from t...Andrey Devyatkin
 
API Security - OWASP top 10 for APIs + tips for pentesters
API Security - OWASP top 10 for APIs + tips for pentestersAPI Security - OWASP top 10 for APIs + tips for pentesters
API Security - OWASP top 10 for APIs + tips for pentestersInon Shkedy
 
Eliminating Secret Sprawl in the Cloud with HashiCorp Vault - 07.11.2018
Eliminating Secret Sprawl in the Cloud with HashiCorp Vault - 07.11.2018Eliminating Secret Sprawl in the Cloud with HashiCorp Vault - 07.11.2018
Eliminating Secret Sprawl in the Cloud with HashiCorp Vault - 07.11.2018HashiCorp
 
Build your APIs with apigility
Build your APIs with apigilityBuild your APIs with apigility
Build your APIs with apigilityChristian Varela
 
Logic apps and PowerApps - Integrate across your APIs
Logic apps and PowerApps - Integrate across your APIsLogic apps and PowerApps - Integrate across your APIs
Logic apps and PowerApps - Integrate across your APIsSriram Hariharan
 

Ähnlich wie Cloud Foundry API for Fun and Ops (20)

Redundant devops
Redundant devopsRedundant devops
Redundant devops
 
API SECURITY
API SECURITYAPI SECURITY
API SECURITY
 
DEF CON 23 - BRENT - white hacking web apps wp
DEF CON 23 - BRENT - white hacking web apps wpDEF CON 23 - BRENT - white hacking web apps wp
DEF CON 23 - BRENT - white hacking web apps wp
 
Chris Mathias Presents Advanced API Design Considerations at LA CTO Forum
Chris Mathias Presents Advanced API Design Considerations at LA CTO ForumChris Mathias Presents Advanced API Design Considerations at LA CTO Forum
Chris Mathias Presents Advanced API Design Considerations at LA CTO Forum
 
Crafting APIs
Crafting APIsCrafting APIs
Crafting APIs
 
OAuth for QuickBooks Online REST Services
OAuth for QuickBooks Online REST ServicesOAuth for QuickBooks Online REST Services
OAuth for QuickBooks Online REST Services
 
JOSA TechTalks - RESTful API Concepts and Best Practices
JOSA TechTalks - RESTful API Concepts and Best PracticesJOSA TechTalks - RESTful API Concepts and Best Practices
JOSA TechTalks - RESTful API Concepts and Best Practices
 
How to get along with HATEOAS without letting the bad guys steal your lunch -...
How to get along with HATEOAS without letting the bad guys steal your lunch -...How to get along with HATEOAS without letting the bad guys steal your lunch -...
How to get along with HATEOAS without letting the bad guys steal your lunch -...
 
Rest API with Swagger and NodeJS
Rest API with Swagger and NodeJSRest API with Swagger and NodeJS
Rest API with Swagger and NodeJS
 
DevOps on AWS: Deep Dive on Continuous Delivery and the AWS Developer Tools
DevOps on AWS: Deep Dive on Continuous Delivery and the AWS Developer ToolsDevOps on AWS: Deep Dive on Continuous Delivery and the AWS Developer Tools
DevOps on AWS: Deep Dive on Continuous Delivery and the AWS Developer Tools
 
AD113 Speed Up Your Applications w/ Nginx and PageSpeed
AD113  Speed Up Your Applications w/ Nginx and PageSpeedAD113  Speed Up Your Applications w/ Nginx and PageSpeed
AD113 Speed Up Your Applications w/ Nginx and PageSpeed
 
Dev ops on aws deep dive on continuous delivery - Toronto
Dev ops on aws deep dive on continuous delivery - TorontoDev ops on aws deep dive on continuous delivery - Toronto
Dev ops on aws deep dive on continuous delivery - Toronto
 
DevOps On AWS - Deep Dive on Continuous Delivery
DevOps On AWS - Deep Dive on Continuous DeliveryDevOps On AWS - Deep Dive on Continuous Delivery
DevOps On AWS - Deep Dive on Continuous Delivery
 
HashiCorp Vault configuration as code via HashiCorp Terraform- stories from t...
HashiCorp Vault configuration as code via HashiCorp Terraform- stories from t...HashiCorp Vault configuration as code via HashiCorp Terraform- stories from t...
HashiCorp Vault configuration as code via HashiCorp Terraform- stories from t...
 
Hacking mobile apps
Hacking mobile appsHacking mobile apps
Hacking mobile apps
 
API Security - OWASP top 10 for APIs + tips for pentesters
API Security - OWASP top 10 for APIs + tips for pentestersAPI Security - OWASP top 10 for APIs + tips for pentesters
API Security - OWASP top 10 for APIs + tips for pentesters
 
Eliminating Secret Sprawl in the Cloud with HashiCorp Vault - 07.11.2018
Eliminating Secret Sprawl in the Cloud with HashiCorp Vault - 07.11.2018Eliminating Secret Sprawl in the Cloud with HashiCorp Vault - 07.11.2018
Eliminating Secret Sprawl in the Cloud with HashiCorp Vault - 07.11.2018
 
[Struyf] Automate Your Tasks With Azure Functions
[Struyf] Automate Your Tasks With Azure Functions[Struyf] Automate Your Tasks With Azure Functions
[Struyf] Automate Your Tasks With Azure Functions
 
Build your APIs with apigility
Build your APIs with apigilityBuild your APIs with apigility
Build your APIs with apigility
 
Logic apps and PowerApps - Integrate across your APIs
Logic apps and PowerApps - Integrate across your APIsLogic apps and PowerApps - Integrate across your APIs
Logic apps and PowerApps - Integrate across your APIs
 

Kürzlich hochgeladen

Understanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM ArchitectureUnderstanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM Architecturerahul_net
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Mater
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceBrainSell Technologies
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationBradBedford3
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commercemanigoyal112
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Cizo Technology Services
 
Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLionel Briand
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprisepreethippts
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Developmentvyaparkranti
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...Akihiro Suda
 
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptxReal-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptxRTS corp
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 

Kürzlich hochgeladen (20)

Understanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM ArchitectureUnderstanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM Architecture
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. Salesforce
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion Application
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commerce
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
 
Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and Repair
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprise
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Development
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
 
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptxReal-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 

Cloud Foundry API for Fun and Ops

  • 1. EXPLORINGTHE CLOUD FOUNDRY API FOR FUN AND OPS Josh Kruck
 professional doer of things github.com/krujos @krujos
  • 2. WHO AM I? • Today • pivotal customer success • cf cli plugin author • service broker author • lots of little utilities for getting shit done • Past • a lot of storage and application management • Why • use software to make work more fun and be happier
  • 6. done. good game. thanks everyone! http://www.wired.com/2013/11/pivotal-one/
  • 8. SOME IDEAS • apps (dashboard, provisioner, automation, crypt keeper) • cli plugins • scripts (why aren’t you writing a cli plugin?) • A one time thing? (jq will change your life)
  • 9. SCRIPTS ARE AN ANTI PATTERN CLI plugins FTW!
  • 10. What are the things that got API on them?
  • 11. Service Brokers(more of a spec really) Lots of other people talk about service brokers and how to author them, i won’t be covering them.
  • 12. UAA(User Account and Authentication Server) This is where we go to login. If you’re writing CLI plugins and scripts, it’s a non issue, but for any kind of app we’ll have to deal with it.
  • 13. Firehose(the tattletale) the emitter of most of the things
  • 14. Collector(older tattletale) emits a lot of the readable things
  • 15. Cloud Controller(the brains) The CC is where we got to listen and act.
  • 16. but wait! Router(eventually) A feature that’s coming down the pipe is “router services”. While I don’t have anything to say on this today it is something to be aware of. It will allow us to do some inline things at the router that we previously had to insert between our LB’s and routers.
  • 18. UAA(User Account and Authentication Server) This is where we go to login. If you’re writing CLI plugins and scripts, it’s a non issue, but for any kind of app we’ll have to deal with it.
  • 19. WHEN/WHY DO WE INTERACT WITH UAA? • When we’re writing an application and DON’T want to inherit the credentials of the user • Dashboards, system automation and on boarding System automation examples: Clean up orphaned services Check for rouge users Reports (new URL’s for nessus, apps pushed in the last day, crash summaries… whatevs).
  • 20. WHEN/WHY DO WE INTERACT WITH UAA? • When we’re writing an (web) application and we DO want to inherit the credentials of the user • cli plugins and scripts can usually get this for free System automation examples: Onboarding, cleanup, CI stuff (slackbots)
  • 21. UN HUMANS • For apps that do not act on behalf of a human we use client_credentials • See the OAuth 2.0 spec for more information • https://tools.ietf.org/html/rfc6749#section-1.3.4 • http://tools.ietf.org/html/rfc6749#section-4.4 If you google, you will find people who have translated this into somewhat more complicated english than the spec provides.
  • 22. GO uri, _ := url.Parse(uaaURI.String() + "/oauth/token? grant_type=client_credentials") creds := &UaaClientCredentials{ uaaURI: uri, clientID: clientID, clientSecret: clientSecret, } client := http.Client{tls.Config{}} req, _ := http.NewRequest("POST", creds.uaaURI.String(), nil) req.SetBasicAuth(creds.clientID, creds.clientSecret) resp, _ := client.Do(req)
  • 23. auth = requests.auth.HTTPBasicAuth(client_id, client_secret) r = requests.post( url=uaa_uri, headers={'accept': 'application/json'}, params={'grant_type': ‘client_credentials'}, auth=client_auth) PYTHON both of those examples assume certificate validation, see the docs for skipping it.
  • 24. ➜ curl “https://user:pass@uaa.mycf.xip.io/oauth/token" -d grant_type=client_credentials -X POST | jq “.” { "access_token": “eyJhbG…C6Fvww”, "token_type": "bearer", "expires_in": 43199, "scope": "doppler.firehose", "jti": "2d56398d-ba65-4dbd-9f43-4d1a302709a1" } STOP WITHYOURTRICKERY AND GIVE ME A SHELL MAN
  • 25. THE IMPORTANTTHINGS 1. UAA exposes an API protected by HTTP Basic Auth that gives us a token
 http(s)://uaa.example.com/oauth/token 2. We use a client_id & client_secret for auth 3. We pass it the grant type as a parameter
 grant_type=client_credentials 4. It gives us back a token and time to live note that you can indeed send your credentials in clear text. that’s a bad idea. you can, and should prevent http requests from getting to uaa as your traffic can be sniffed.
  • 26. UAA IS FOR PEOPLETOO? • CLI Plugins you’ve already assumed the identity of the user • Scripts should use & assume the identity of the logged in user via cf curl • password_grant otherwise (but srsly, why do it the hard way?) • Web apps use the regular OAuth flow For applications that act on behalf of humans we have a few options. For scripts cf curl is a good option as it means you can avoid (hopefully) managing usernames and passwords in the scripts.
  • 27. require 'bundler' require 'sinatra' require 'omniauth' require 'omniauth-uaa-oauth2' use Rack::Session::Cookie, :secret => ‘its a secret' use OmniAuth::Builder do provider :cloudfoundry, 'app', 'appclientsecret', {:auth_server_url => “https://login.run.cf.io", :token_server_url => “https:// uaa.run.cf.io"} end class App < Sinatra::Base get '/' do <ul><li><a href='/auth/cloudfoundry'>Sign in with Cloud Foundry</a></li></ul> end get '/auth/cloudfoundry/callback' do content_type 'application/json' request.env['omniauth.auth'].to_hash.to_json rescue "No Data" end get '/auth/failure' do content_type 'text/plain' request.env['omniauth.auth'].to_hash.inspect rescue "No Data" end end run App.new This one doesn’t do a redirect like I normally do, use has to click the auth link.
  • 29. WHAT ISTHE FIREHOSE? • The firehose is where we go to listen • Combined stream of logs from all apps, plus metrics data from CF components • Exposed as a web socket endpoint • Accessed via doppler.firehose scope The scope means it’s unlikely your user accounts have access to it. Login w/ admin Or create user in uaac.
  • 30. WHATS INTHE FIREHOSE • A lot, but not everything • https://github.com/cloudfoundry/loggregator/wiki/Firehose-Metric-Catalog • https://docs.google.com/spreadsheets/d/176yIaJChXEmvm- CjybmwopdRGQfDGrSzo3J_Mx8mMnk/edit#gid=472741134 • heartbeats are being removed (rejoice!) • https://lists.cloudfoundry.org/archives/list/cf-dev@lists.cloudfoundry.org/message/ EPTBPAJLBV4LAG72GOSK3KYO7MKZPL7B/ I find the most interesting things in the firehose to be http related. I can tell the status of every request in and out of the system, as well as it’s response time. This helps me paint a picture of “normal”. It also helps me figure out “lights are on but no one’s home” situations. CF health check just make a connection on a socket, they don’t check http response codes. So the firehose http metrics give me a good view of what my users are seeing.
  • 31. HOWTO DISCOVER STUFF? • noaa firehose sample app and grep • ➜ export DOPPLER_ADDR=wss://doppler.10.244.0.34.xip.io:443 • ➜ CF_ACCESS_TOKEN=`cf oauth-token | grep bearer` ./firehose_sample • https://github.com/cloudfoundry/noaa/blob/master/firehose_sample/ main.go *note the app ignores cert validation errors.
  • 32. WHAT’S INTERESTING • POST’s to the Cloud Controller origin:"router__0" eventType:HttpStartStop timestamp:1439755833436264212 deployment:"cf-warden" job:"router_z1" index:"0" ip:"10.244.0.22" httpStartStop:<startTimestamp:1439755833419943436 stopTimestamp: 1439755833436264212 requestId:<low:8452822747789629966 high: 15632988695117975649 > peerType:Client method:POST uri:"api.10.244.0.34.xip.io/ v2/organizations" remoteAddress:"10.0.2.15:39470" userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201 contentLength:1298 parentRequestId:<low:5137755037457773227 high:6003671325381183557 > instanceId:"10.244.0.134:9022" >
  • 33. WHAT’S INTERESTING • POST’s to the Cloud Controller origin:"router__0" eventType:HttpStartStop timestamp:1439755833436264212 … peerType:Client method:POST uri:"api.10.244.0.34.xip.io/v2/organizations" remoteAddress:"10.0.2.15:39470" userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201 … > Someone just created an org successfully.
  • 34. WHATS INTERESTING ➜ egrep "method:PUT|method:POST" /tmp/firehose.out | egrep -v "uaa|login" origin:"router__0" eventType:HttpStartStop timestamp:1439756656563113538 deployment:"cf-warden" job:"router_z1" index:"0" ip:"10.244.0.22" httpStartStop:<startTimestamp:1439756656523306795 stopTimestamp:1439756656563113538 requestId:<low:5639804705379164088 high:13655764414813434448 > peerType:Client method:POST uri:"api.10.244.0.34.xip.io/v2/apps" remoteAddress:"10.0.2.15:43117" userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201 contentLength:1485 parentRequestId:<low:9677111003368022686 high:16762836456174757743 > instanceId:"10.244.0.134:9022" > origin:"router__0" eventType:HttpStartStop timestamp:1439756656563296157 deployment:"cf-warden" job:"router_z1" index:"0" ip:"10.244.0.22" httpStartStop:<startTimestamp:1439756656523150050 stopTimestamp:1439756656563296157 requestId:<low:9677111003368022686 high:16762836456174757743 > peerType:Server method:POST uri:"api.10.244.0.34.xip.io/v2/apps" remoteAddress:"10.0.2.15:43117" userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201 contentLength:1485 > origin:"router__0" eventType:HttpStartStop timestamp:1439756656712256742 deployment:"cf-warden" job:"router_z1" index:"0" ip:"10.244.0.22" httpStartStop:<startTimestamp:1439756656666492905 stopTimestamp:1439756656712256742 requestId:<low:8304746205643063272 high:4491838666105706059 > peerType:Client method:PUT uri:"api.10.244.0.34.xip.io/v2/apps/d2cd4770-64e0-44fe-a997-f2e7e6dc5c79/routes/15879527-b813-4165-9b04-8dc3f5af2a31" remoteAddress:"10.0.2.15:43129" userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201 contentLength:1503 parentRequestId:<low:16449840403178608098 high: 13013670532211215483 > instanceId:"10.244.0.134:9022" > origin:"legacy" eventType:LogMessage deployment:"cf-warden" job:"api_z1" index:"0" ip:"10.244.0.134" logMessage:<message:"Updated app with guid d2cd4770-64e0-44fe-a997-f2e7e6dc5c79 ({"route"=>"15879527-b813-4165-9b04-8dc3f5af2a31"})" message_type:OUT timestamp:143975 6656694498836 app_id:"d2cd4770-64e0-44fe-a997-f2e7e6dc5c79" source_type:"API" source_instance:"0" > origin:"router__0" eventType:HttpStartStop timestamp:1439756656712519692 deployment:"cf-warden" job:"router_z1" index:"0" ip:"10.244.0.22" httpStartStop:<startTimestamp:1439756656666355668 stopTimestamp:1439756656712519692 requestId:<low:16449840403178608098 high:13013670532211215483 > peerType:Server method:PUT uri:"api.10.244.0.34.xip.io/v2/apps/d2cd4770-64e0-44fe-a997-f2e7e6dc5c79/routes/15879527-b813-4165-9b04-8dc3f5af2a31" remoteAddress:"10.0.2.15:43129" userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201 contentLength:1503 > origin:"router__0" eventType:HttpStartStop timestamp:1439756656786930549 deployment:"cf-warden" job:"router_z1" index:"0" ip:"10.244.0.22" httpStartStop:<startTimestamp:1439756656765375916 stopTimestamp:1439756656786930549 requestId:<low:15224145774697211575 high:9071476560656655465 > peerType:Client method:PUT uri:"api.10.244.0.34.xip.io/v2/apps/d2cd4770-64e0-44fe-a997-f2e7e6dc5c79/bits" remoteAddress:"10.0.2.15:43133" userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201 contentLength:270 parentRequestId:<low:13565402856673872720 high:11582024932942486143 > instanceId:"10.244.0.134:9022" > origin:"router__0" eventType:HttpStartStop timestamp:1439756656787167491 deployment:"cf-warden" job:"router_z1" index:"0" ip:"10.244.0.22" httpStartStop:<startTimestamp:1439756656765234958 stopTimestamp:1439756656787167491 requestId:<low:13565402856673872720 high:11582024932942486143 > peerType:Server method:PUT uri:"api.10.244.0.34.xip.io/v2/apps/d2cd4770-64e0-44fe-a997-f2e7e6dc5c79/bits" remoteAddress:"10.0.2.15:43133" userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201 contentLength:270 > origin:"router__0" eventType:HttpStartStop timestamp:1439756663113749547 deployment:"cf-warden" job:"router_z1" index:"0" ip:"10.244.0.22" httpStartStop:<startTimestamp:1439756661872770559 stopTimestamp:1439756663113749547 requestId:<low:10468161744519186019 high:3081438611027230039 > peerType:Client method:PUT uri:"api.10.244.0.34.xip.io/v2/apps/d2cd4770-64e0-44fe-a997-f2e7e6dc5c79" remoteAddress:"10.0.2.15:43167" userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201 contentLength:4073 parentRequestId:<low:16375959389728685162 high:5351609031812398929 > instanceId:"10.244.0.134:9022" > origin:"router__0" eventType:HttpStartStop timestamp:1439756663114085243 deployment:"cf-warden" job:"router_z1" index:"0" ip:"10.244.0.22" httpStartStop:<startTimestamp:1439756661872568200 stopTimestamp:1439756663114085243 requestId:<low:16375959389728685162 high:5351609031812398929 > peerType:Server method:PUT uri:"api.10.244.0.34.xip.io/v2/apps/d2cd4770-64e0-44fe-a997-f2e7e6dc5c79" remoteAddress:"10.0.2.15:43167" userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201 contentLength:4073 > lets distill this and just look at app interactions
  • 35. WHATS INTERESTING timestamp:1439756656563113538 httpStartStop:<startTimestamp:1439756656523306795 stopTimestamp:1439756656563113538 peerType:Client method:POST uri:"api.10.244.0.34.xip.io/v2/apps" remoteAddress:"10.0.2.15:43117" userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201 instanceId:"10.244.0.134:9022" > timestamp:1439756656563296157 httpStartStop:<startTimestamp:1439756656523150050 stopTimestamp:1439756656563296157 peerType:Server method:POST uri:"api.10.244.0.34.xip.io/v2/apps" remoteAddress:"10.0.2.15:43117" userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201 > timestamp:1439756656712256742 httpStartStop:<startTimestamp:1439756656666492905 stopTimestamp:1439756656712256742 peerType:Client method:PUT uri:"api.10.244.0.34.xip.io/v2/apps/d2cd4770-64e0-44fe-a997-f2e7e6dc5c79/routes/15879527- b813-4165-9b04-8dc3f5af2a31" remoteAddress:"10.0.2.15:43129" userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201 instanceId:"10.244.0.134:9022" > timestamp:1439756656712519692 httpStartStop:<startTimestamp:1439756656666355668 stopTimestamp:1439756656712519692 peerType:Server method:PUT uri:"api.10.244.0.34.xip.io/v2/apps/d2cd4770-64e0-44fe-a997-f2e7e6dc5c79/routes/15879527- b813-4165-9b04-8dc3f5af2a31" remoteAddress:"10.0.2.15:43129" userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201 > timestamp:1439756656786930549 httpStartStop:<startTimestamp:1439756656765375916 stopTimestamp:1439756656786930549 peerType:Client method:PUT uri:"api.10.244.0.34.xip.io/v2/apps/d2cd4770-64e0-44fe-a997-f2e7e6dc5c79/bits" remoteAddress:"10.0.2.15:43133" userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201 instanceId:"10.244.0.134:9022" > timestamp:1439756656787167491 httpStartStop:<startTimestamp:1439756656765234958 stopTimestamp:1439756656787167491 peerType:Server method:PUT uri:"api.10.244.0.34.xip.io/v2/apps/d2cd4770-64e0-44fe-a997-f2e7e6dc5c79/bits" remoteAddress:"10.0.2.15:43133" userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201 > timestamp:1439756663113749547 httpStartStop:<startTimestamp:1439756661872770559 stopTimestamp:1439756663113749547 peerType:Client method:PUT uri:"api.10.244.0.34.xip.io/v2/apps/d2cd4770-64e0-44fe-a997-f2e7e6dc5c79" remoteAddress:"10.0.2.15:43167" userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201 instanceId:"10.244.0.134:9022" > timestamp:1439756663114085243 httpStartStop:<startTimestamp:1439756661872568200 stopTimestamp:1439756663114085243 peerType:Server method:PUT uri:"api.10.244.0.34.xip.io/v2/apps/d2cd4770-64e0-44fe-a997-f2e7e6dc5c79" remoteAddress:"10.0.2.15:43167" userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201 > lets distill further and just grab some of the fields we’re interested in. We can see some requests being passed through the system by looking at the http traffic. Kind of a poor mans after the fact zipkin.
  • 36. WHATS INTERESTING timestamp:1439756656563113538 httpStartStop:<startTimestamp:1439756656523306795 stopTimestamp:1439756656563113538 peerType:Client method:POST uri:"api.10.244.0.34.xip.io/v2/apps" remoteAddress:"10.0.2.15:43117" userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201 instanceId:"10.244.0.134:9022" > timestamp:1439756656563296157 httpStartStop:<startTimestamp:1439756656523150050 stopTimestamp:1439756656563296157 peerType:Server method:POST uri:"api.10.244.0.34.xip.io/v2/apps" remoteAddress:"10.0.2.15:43117" userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201 > timestamp:1439756656712256742 httpStartStop:<startTimestamp:1439756656666492905 stopTimestamp:1439756656712256742 peerType:Client method:PUT uri:"api.10.244.0.34.xip.io/v2/apps/d2cd4770-64e0-44fe-a997-f2e7e6dc5c79/routes/15879527- b813-4165-9b04-8dc3f5af2a31" remoteAddress:"10.0.2.15:43129" userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201 instanceId:"10.244.0.134:9022" > timestamp:1439756656712519692 httpStartStop:<startTimestamp:1439756656666355668 stopTimestamp:1439756656712519692 peerType:Server method:PUT uri:"api.10.244.0.34.xip.io/v2/apps/d2cd4770-64e0-44fe-a997-f2e7e6dc5c79/routes/15879527- b813-4165-9b04-8dc3f5af2a31" remoteAddress:"10.0.2.15:43129" userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201 > timestamp:1439756656786930549 httpStartStop:<startTimestamp:1439756656765375916 stopTimestamp:1439756656786930549 peerType:Client method:PUT uri:"api.10.244.0.34.xip.io/v2/apps/d2cd4770-64e0-44fe-a997-f2e7e6dc5c79/bits" remoteAddress:"10.0.2.15:43133" userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201 instanceId:"10.244.0.134:9022" > timestamp:1439756656787167491 httpStartStop:<startTimestamp:1439756656765234958 stopTimestamp:1439756656787167491 peerType:Server method:PUT uri:"api.10.244.0.34.xip.io/v2/apps/d2cd4770-64e0-44fe-a997-f2e7e6dc5c79/bits" remoteAddress:"10.0.2.15:43133" userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201 > timestamp:1439756663113749547 httpStartStop:<startTimestamp:1439756661872770559 stopTimestamp:1439756663113749547 peerType:Client method:PUT uri:"api.10.244.0.34.xip.io/v2/apps/d2cd4770-64e0-44fe-a997-f2e7e6dc5c79" remoteAddress:"10.0.2.15:43167" userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201 instanceId:"10.244.0.134:9022" > timestamp:1439756663114085243 httpStartStop:<startTimestamp:1439756661872568200 stopTimestamp:1439756663114085243 peerType:Server method:PUT uri:"api.10.244.0.34.xip.io/v2/apps/d2cd4770-64e0-44fe-a997-f2e7e6dc5c79" remoteAddress:"10.0.2.15:43167" userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201 > So now we can see that we have a client talking to a server and a server talking to a server
  • 37. WHATS INTERESTING timestamp:1439756656563113538 httpStartStop:<startTimestamp:1439756656523306795 stopTimestamp:1439756656563113538 peerType:Client method:POST uri:"api.10.244.0.34.xip.io/ v2/apps" remoteAddress:"10.0.2.15:43117" userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201 instanceId:"10.244.0.134:9022" > timestamp:1439756656712256742 httpStartStop:<startTimestamp:1439756656666492905 stopTimestamp:1439756656712256742 peerType:Client method:PUT uri:"api.10.244.0.34.xip.io/ v2/apps/d2cd4770-64e0-44fe-a997-f2e7e6dc5c79/routes/15879527-b813-4165-9b04-8dc3f5af2a31" remoteAddress:"10.0.2.15:43129" userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201 instanceId:"10.244.0.134:9022" > timestamp:1439756656786930549 httpStartStop:<startTimestamp:1439756656765375916 stopTimestamp:1439756656786930549 peerType:Client method:PUT uri:"api.10.244.0.34.xip.io/ v2/apps/d2cd4770-64e0-44fe-a997-f2e7e6dc5c79/bits" remoteAddress:"10.0.2.15:43133" userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201 instanceId:"10.244.0.134:9022" > timestamp:1439756663113749547 httpStartStop:<startTimestamp:1439756661872770559 stopTimestamp:1439756663113749547 peerType:Client method:PUT uri:"api.10.244.0.34.xip.io/ v2/apps/d2cd4770-64e0-44fe-a997-f2e7e6dc5c79" remoteAddress:"10.0.2.15:43167" userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201 instanceId:"10.244.0.134:9022" > lets distill further, to just client operations.
  • 38. WHATS INTERESTING timestamp:1439756656563113538 httpStartStop:<startTimestamp:1439756656523306795 stopTimestamp:1439756656563113538 peerType:Client method:POST uri:"api.10.244.0.34.xip.io/ v2/apps" remoteAddress:"10.0.2.15:43117" userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201 instanceId:"10.244.0.134:9022" > timestamp:1439756656712256742 httpStartStop:<startTimestamp:1439756656666492905 stopTimestamp:1439756656712256742 peerType:Client method:PUT uri:"api.10.244.0.34.xip.io/ v2/apps/d2cd4770-64e0-44fe-a997-f2e7e6dc5c79/routes/15879527-b813-4165-9b04-8dc3f5af2a31" remoteAddress:"10.0.2.15:43129" userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201 instanceId:"10.244.0.134:9022" > timestamp:1439756656786930549 httpStartStop:<startTimestamp:1439756656765375916 stopTimestamp:1439756656786930549 peerType:Client method:PUT uri:"api.10.244.0.34.xip.io/ v2/apps/d2cd4770-64e0-44fe-a997-f2e7e6dc5c79/bits" remoteAddress:"10.0.2.15:43133" userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201 instanceId:"10.244.0.134:9022" > timestamp:1439756663113749547 httpStartStop:<startTimestamp:1439756661872770559 stopTimestamp:1439756663113749547 peerType:Client method:PUT uri:"api.10.244.0.34.xip.io/ v2/apps/d2cd4770-64e0-44fe-a997-f2e7e6dc5c79" remoteAddress:"10.0.2.15:43167" userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201 instanceId:"10.244.0.134:9022" > Lets make sure we’re tracing one user’s experience through the system. note the port changed? Why? I suspect the CLI had to open a new connection..
  • 39. WHATS INTERESTING timestamp:1439756656563113538 httpStartStop:<startTimestamp:1439756656523306795 stopTimestamp:1439756656563113538 peerType:Client method:POST uri:"api.10.244.0.34.xip.io/ v2/apps" remoteAddress:"10.0.2.15:43117" userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201 instanceId:"10.244.0.134:9022" > timestamp:1439756656712256742 httpStartStop:<startTimestamp:1439756656666492905 stopTimestamp:1439756656712256742 peerType:Client method:PUT uri:"api.10.244.0.34.xip.io/ v2/apps/d2cd4770-64e0-44fe-a997-f2e7e6dc5c79/routes/15879527-b813-4165-9b04-8dc3f5af2a31" remoteAddress:"10.0.2.15:43129" userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201 instanceId:"10.244.0.134:9022" > timestamp:1439756656786930549 httpStartStop:<startTimestamp:1439756656765375916 stopTimestamp:1439756656786930549 peerType:Client method:PUT uri:"api.10.244.0.34.xip.io/ v2/apps/d2cd4770-64e0-44fe-a997-f2e7e6dc5c79/bits" remoteAddress:"10.0.2.15:43133" userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201 instanceId:"10.244.0.134:9022" > timestamp:1439756663113749547 httpStartStop:<startTimestamp:1439756661872770559 stopTimestamp:1439756663113749547 peerType:Client method:PUT uri:"api.10.244.0.34.xip.io/ v2/apps/d2cd4770-64e0-44fe-a997-f2e7e6dc5c79" remoteAddress:"10.0.2.15:43167" userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201 instanceId:"10.244.0.134:9022" > lets distill further, to just client operations, we can trace one user’s experience through the system. How long did their operation take? (6.5 seconds), firehose timestamps are nano seconds.
  • 40. WHATS INTERESTING timestamp:1439756656563113538 httpStartStop:<startTimestamp:1439756656523306795 stopTimestamp:1439756656563113538 peerType:Client method:POST uri:"api.10.244.0.34.xip.io/ v2/apps" remoteAddress:"10.0.2.15:43117" userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201 instanceId:"10.244.0.134:9022" > timestamp:1439756656712256742 httpStartStop:<startTimestamp:1439756656666492905 stopTimestamp:1439756656712256742 peerType:Client method:PUT uri:"api.10.244.0.34.xip.io/ v2/apps/d2cd4770-64e0-44fe-a997-f2e7e6dc5c79/routes/15879527-b813-4165-9b04-8dc3f5af2a31" remoteAddress:"10.0.2.15:43129" userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201 instanceId:"10.244.0.134:9022" > timestamp:1439756656786930549 httpStartStop:<startTimestamp:1439756656765375916 stopTimestamp:1439756656786930549 peerType:Client method:PUT uri:"api.10.244.0.34.xip.io/ v2/apps/d2cd4770-64e0-44fe-a997-f2e7e6dc5c79/bits" remoteAddress:"10.0.2.15:43133" userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201 instanceId:"10.244.0.134:9022" > timestamp:1439756663113749547 httpStartStop:<startTimestamp:1439756661872770559 stopTimestamp:1439756663113749547 peerType:Client method:PUT uri:"api.10.244.0.34.xip.io/ v2/apps/d2cd4770-64e0-44fe-a997-f2e7e6dc5c79" remoteAddress:"10.0.2.15:43167" userAgent:"go-cli 6.11.2-2a26d55 / darwin" statusCode:201 instanceId:"10.244.0.134:9022" > What did they do what was the output? First one crates the app. second one uploads the bits third one does a state change to start apps.
  • 41. WHY ISTHAT INTERESTING? • If I can learn what normal interaction patterns are, I can identify abnormal ones and investigate • Are apps failing to start after a push? • For all teams? to me anyway. this lets us identify and view actions across the entirety of the user base. Could you do this with platform logs? Probably. The beauty of the firehose is it gives you all of it, I omitted the logs from my example for readability and dramatic effect.
  • 43. WHAT ISTHE COLLECTOR • The collector is the “legacy” aggregator of CF metrics • No log messages • Grabbed all the /varz and /healthz data • The collector still has a lot of relevant runtime information in it • available_stagers, healthy, system.cpu.wait Most of the collector usage is for dashboards.
  • 44. WHAT ISTHE COLLECTOR FOR • It’s also how we export metrics in open source via historian plugins • https://github.com/cloudfoundry/collector/tree/master/lib/collector/ historian • Vendors (well Pivotal at least) have their own spin • Pivotal Ops Metrics (JMX) The historian plugins change the way data is presented. They are usually monitoring solution specific.
  • 45. COLLECTOR DOWNSIDE • Vendors don’t install all the plugins in their distribution • Consumption can be irritating, lots of guesswork • You may end up pretending to be a historian plugin, or consuming ones output.
  • 46. Cloud Controller(the brains) The CC is where we got to listen and act.
  • 47. CLOUD CONTROLLER • The CC API is what we talk to the most • api.run.pivotal.io • The CC API is where we go to act and report
  • 48. THE CC API IS UNSURPRISING • Which is to say, the api has all of the things you would expect • /v2/apps • /v3/apps (experimental) • /v2/organizations • /v2/events • /v2/spaces or kinda boring
  • 49. API DETAILS • the v3 api is totes HATEOAS compliant!!! • the v2 api has some links conventions
  • 50. THE APITEAM COMMITTEDTO MAINTAINING BACKWARDS COMPATIBILITY • v3 api’s will have v2 compatibility layers • I was there, they said it at cf summit, it’s like they wrote it in their own blood
  • 51. API DETAILS • The v2 api is very, very, very verbose • The v3 api is more targeted
  • 52. API DETAILS • v3 api is fun to talk about, but as of today much of it doesn’t exist outside of documentation. • we will see some examples later.
  • 54. VERSIONS does thing you read about exist in your version
  • 55. EXPERIMENTAL REALLY MEANS EXPERIMENTAL. Theres a good chance it won’t be there (or be the same) in your vendors next release (I’m looking at you async service broker api)
  • 56. SOMETIMES IT’S NOT PRETTY ➜ cf curl /v2/apps/<a guid> | grep buildpack "buildpack": null, "detected_buildpack": "PHP",
  • 57. TOKENS MUST BE ACQUIRED ANDTHEY EXPIRE https://github.com/cloudfoundry/cf-uaa-lib (Ruby) https://github.com/cloudfoundry/omniauth-uaa-oauth2 (more ruby) https://github.com/krujos/uaaclientcredentials (Go)
  • 58. CLIENTSVS USERS https://docs.google.com/document/d/1YU01vrGmIhSHCKOFIRY7EhU8qCbUHJsw3ZXgdnUIfeI/edit TODO: move that somewhere permanent, and more public. What’s a client? What’s a user?
  • 61. SO HOW DO I BUILD ATHING? • it starts with cf curl and jq • or the firehose and grep
  • 62. • lets see what the firehose has to say about started apps? export DOPPLER_ADDR=wss://doppler.10.244.0.34.xip.io:443 CF_ACCESS_TOKEN=`cf oauth-token | grep bearer` ./firehose_sample | grep -i started cf stop hello-node cf start hello-node
  • 63. • how about orphaned user provided services? cf cups my-svc -p '{"foo":"bar"}' cf curl /v2/user_provided_service_instances cf curl `cf curl /v2/user_provided_service_instances | jq -r '.resources[0].entity.service_bindings_url'` | jq ‘.total_results' Think about what we would have had to do to report on that with the CLI?
  • 64. • lets look at something more complex. • how many ai’s are you running? • How does the usage-report plugin work? • https://github.com/krujos/usagereport-plugin demo the plugin
 sometimes its about mashing things up Why is how many ai’s your running a hard question to answer? Why is how many ai’s your running an important question to answer? As someone who’s paying for IT charge back, am I paying too much? How much ram am I consuming, are my quotas right? make note of the lack of auth, plugin assumes current user, works for everyone based on their cf access. 
 magic starts here: https://github.com/krujos/usagereport-plugin/blob/master/usagereport.go#L57 https://github.com/krujos/usagereport-plugin/blob/master/apihelper/apihelper.go
  • 65. • What’s fun? what should we try to figure out?