Sha256: 9918bc91e38a8c9540ef6308a7f33a60159f8913cb31d563fd0ce1167a99ffc3

Contents?: true

Size: 1022 Bytes

Versions: 65

Compression:

Stored size: 1022 Bytes

Contents

service_name ; service_status ; node ; service_address ; non_passing_checks
<%
# find all the failing services.
# Usage: consul-templaterb --once samples/tools/find_all_failing_services.txt.erb
#
# Environment variables:
# * `CONSUL_SERVICE_FILTER` : regexp to filter services `.*` by default
# * `CONSUL_DC_FILTER`:       regexp to filter datacenters `.*` by default

service_filter = Regexp.new(ENV['CONSUL_SERVICE_FILTER'] || '.*')
dc_filter = Regexp.new(ENV['CONSUL_DC_FILTER'] || '.*')
datacenters.each do |dc|
  next unless dc_filter.match(dc)
  services(dc: dc).each do |service_name, tags|
    next unless service_filter.match(service_name)
    service(service_name, dc: dc).each do |snode|
      if snode.status != 'passing'
      failing_checks = snode['Checks'].select{ |c| c['Status'] != 'passing' }.map { |c| c['Name'] || c['ID'] || c['CheckID']}
%><%= service_name %> ; <%= snode.status %> ; <%= snode['Node']['Node']%> ; <%= snode.service_address %> ; <%= failing_checks %>
<%
      end
    end
  end
end
%>

Version data entries

65 entries across 65 versions & 1 rubygems

Version Path
consul-templaterb-1.19.0 samples/tools/find_all_failing_services.txt.erb
consul-templaterb-1.18.5 samples/tools/find_all_failing_services.txt.erb
consul-templaterb-1.18.4 samples/tools/find_all_failing_services.txt.erb
consul-templaterb-1.18.3 samples/tools/find_all_failing_services.txt.erb
consul-templaterb-1.18.2 samples/tools/find_all_failing_services.txt.erb
consul-templaterb-1.18.1 samples/tools/find_all_failing_services.txt.erb
consul-templaterb-1.18.0 samples/tools/find_all_failing_services.txt.erb
consul-templaterb-1.17.4 samples/tools/find_all_failing_services.txt.erb
consul-templaterb-1.17.3 samples/tools/find_all_failing_services.txt.erb
consul-templaterb-1.17.2 samples/tools/find_all_failing_services.txt.erb
consul-templaterb-1.17.1 samples/tools/find_all_failing_services.txt.erb
consul-templaterb-1.17.0 samples/tools/find_all_failing_services.txt.erb
consul-templaterb-1.16.0 samples/tools/find_all_failing_services.txt.erb
consul-templaterb-1.15.3 samples/tools/find_all_failing_services.txt.erb
consul-templaterb-1.15.2 samples/tools/find_all_failing_services.txt.erb
consul-templaterb-1.15.1 samples/tools/find_all_failing_services.txt.erb
consul-templaterb-1.15.0 samples/tools/find_all_failing_services.txt.erb
consul-templaterb-1.14.1 samples/tools/find_all_failing_services.txt.erb
consul-templaterb-1.14.0 samples/tools/find_all_failing_services.txt.erb
consul-templaterb-1.13.1 samples/tools/find_all_failing_services.txt.erb