Sha256: c0ac611c0a778b2b622175903cf2f3fa8e6ebce51f8ad35a268cf9bd29e9cd33

Contents?: true

Size: 1.82 KB

Versions: 33

Compression:

Stored size: 1.82 KB

Contents

 __________________________________________________________________
|  DC   | Services |______________Instances________________| Nodes |
|       |          | Passing | Warning | Critic  |  Total  |       |
|-------+----------+---------+---------+---------+---------+-------|
<%
  # This template list all instances on all DCs
  # And aggregates a list of Services, Services Instances/status
  # And nodes.
  require 'set'
  num_services={}
  num_instances={}
  all_states = ['passing', 'warning', 'critical', 'total']
  distinct_services=Set.new
  datacenters().each do |dc|
    num_services[dc] = 0
    num_instances[dc] = {
      'passing'  => 0,
      'warning'  => 0,
      'critical' => 0,
      'total'    => 0
    }
    services(dc:dc).each do |service_name, tags|
      distinct_services.add(service_name)
      num_services[dc]+=1
      service(service_name, dc:dc).each do |snode|
        num_instances[dc][snode.status]+=1
        num_instances[dc]['total']+=1
      end 
    end
  end
  num_instances_total={
    'passing'  => 0,
    'warning'  => 0,
    'critical' => 0,
    'total'    => 0
  }
  num_nodes_total=0
  num_services.each do |dc, num_services_for_dc|
    all_states.each do |s|
      num_instances_total[s] += num_instances[dc][s]
    end
    num_nodes=nodes(dc:dc).count
    num_nodes_total+=num_nodes
%>| <%= dc.rjust(5) %> | <%= num_services_for_dc.to_s.rjust(8) %> |<% all_states.each do |status|
%> <%= num_instances[dc][status].to_s.rjust(7) %> |<% end %> <%= num_nodes.to_s.rjust(5) %> |
<%
  end
%>|-------+----------+---------+---------+---------+---------+-------|
| TOTAL | <%= distinct_services.count.to_s.rjust(8) %> |<% all_states.each do |status|
%> <%= num_instances_total[status].to_s.rjust(7) %> |<%
end %> <%= num_nodes_total.to_s.rjust(5) %> |
'_______|__________|_________|_________|_________|_________|_______'

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
consul-templaterb-1.15.1 samples/all_services.txt.erb
consul-templaterb-1.15.0 samples/all_services.txt.erb
consul-templaterb-1.14.1 samples/all_services.txt.erb
consul-templaterb-1.14.0 samples/all_services.txt.erb
consul-templaterb-1.13.1 samples/all_services.txt.erb
consul-templaterb-1.13.0 samples/all_services.txt.erb
consul-templaterb-1.12.0 samples/all_services.txt.erb
consul-templaterb-1.11.0 samples/all_services.txt.erb
consul-templaterb-1.10.1 samples/all_services.txt.erb
consul-templaterb-1.10.0 samples/all_services.txt.erb
consul-templaterb-1.9.9 samples/all_services.txt.erb
consul-templaterb-1.9.8 samples/all_services.txt.erb
consul-templaterb-1.9.7 samples/all_services.txt.erb
consul-templaterb-1.9.6 samples/all_services.txt.erb
consul-templaterb-1.9.5 samples/all_services.txt.erb
consul-templaterb-1.9.4 samples/all_services.txt.erb
consul-templaterb-1.9.3 samples/all_services.txt.erb
consul-templaterb-1.9.2 samples/all_services.txt.erb
consul-templaterb-1.9.1 samples/all_services.txt.erb
consul-templaterb-1.9.0 samples/all_services.txt.erb