Created
May 26, 2014 07:57
-
-
Save teddyking/613cec7d81e0db1b02e6 to your computer and use it in GitHub Desktop.
Prints out the /healthz and /varz connection info for running Cloud Foundry jobs.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This script prints out the /healthz and /varz connection info | |
# for your running Cloud Foundry jobs. | |
# | |
# The nats_uri variable should be updated to suit your deployment. | |
# The default nats_uri value will work for a standard bosh-lite deployment. | |
require 'json' | |
require 'nats/client' | |
nats_uri = 'nats://nats:[email protected]:4222' | |
NATS.start(:uri => nats_uri) do | |
NATS.request('vcap.component.discover') do |json_msg| | |
h = JSON.parse(json_msg) | |
puts "Component: #{h['type']}/#{h['index']}" | |
puts "Host: #{h['host']}" | |
puts "Username: #{h['credentials'][0]}" | |
puts "Password: #{h['credentials'][1]}" | |
puts "curl -u #{h['credentials'][0]}:#{h['credentials'][1]} #{h['host']}/healthz" | |
puts "curl -u #{h['credentials'][0]}:#{h['credentials'][1]} #{h['host']}/varz" | |
puts "" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment