<% require 'base64'
require 'json'
require 'date'
%>
List of all datacenters
<% datacenters.each do |dc| %>
- <%= dc %> with <%= services(dc:dc).keys.count %> services, <%= nodes(dc:dc).count %> nodes
<% end %>
List of all services in current DC
List all services instances sorted by node name
<% services.each do |service_name, tags|
%><%= service_name %> 🔗
<% service(service_name).sort {|a,b| a['Node']['Node'] <=> b['Node']['Node'] }.each do |snode|
tags = snode['Service']['Tags'].sort
addr = snode.service_address
port_num = snode['Service']['Port'].to_i
port = port_num && port_num > 0 ? ":#{port_num}" : ''
url = if tags.include? 'https'
"https://#{addr}#{port}"
elsif tags.include? 'http'
"http://#{addr}#{port}"
elsif tags.include? 'ftp'
"ftp://#{addr}#{port}"
else
nil
end
%>- ><%=
snode['Node']['Node'] %><%= port %>
<%= snode['Service']['Tags'].sort %>
<%
snode['Checks'].each do |c| %> <%= c['Status']
%><% end if snode['Checks'] %>
<% end%>
<% end%>
List all nodes for DC, sorted by name
<% nodes.sort {|a,b| a['Node'] <=> b['Node'] }.each do |snode|
%> - <%= snode['Address'].ljust(16) %> <%= snode['Node'] %>
<% end %>
KV of Current DC
<% kv(keys:true).each do |key|
%>- <%= key %>
<% end %>