lib/sensu/server/process.rb
# Create and publish one or more proxy check requests. This
# method iterates through the Sensu client registry for clients
# that matched provided proxy request client attributes. A proxy
# check request is created for each client in the registry that
# matches the proxy request client attributes. Proxy check
# requests have their client tokens subsituted by the associated
# client attributes values. The `determine_matching_clients()`
# method is used to fetch and inspect each slide of clients from
# the registry, returning those that match the configured proxy
# request client attributes. A relatively small clients slice
# size (20) is used to reduce the number of clients inspected
# within a single tick of the EM reactor. The
# `publish_proxy_check_requests()` method is used to iterate
# through the matching Sensu clients, creating their own unique
# proxy check request, substituting client tokens, and then
# publishing them to the targetted subscriptions.
#
# @param check [Hash] definition.
Create and publish one or more proxy check requests. This
method iterates through the Sensu client registry for clients
that matched provided proxy request client attributes. A proxy
check request is created for each client in the registry that
matches the proxy request client attributes. Proxy check
requests have their client tokens subsituted by the associated
client attributes values. The `determine_matching_clients()`
method is used to fetch and inspect each slide of clients from
the registry, returning those that match the configured proxy
request client attributes. A relatively small clients slice
size (20) is used to reduce the number of clients inspected
within a single tick of the EM reactor. The
`publish_proxy_check_requests()` method is used to iterate
through the matching Sensu clients, creating their own unique
proxy check request, substituting client tokens, and then
publishing them to the targetted subscriptions.
Create and publish one or more proxy check requests . This method iterates through the Sensu client registry for clients that matched provided proxy request client attributes . A proxy check request is created for each client in the registry that matches the proxy request client attributes . Proxy check requests have their client tokens subsituted by the associated client attributes values . The ` determine_matching_clients () ` method is used to fetch and inspect each slide of clients from the registry returning those that match the configured proxy request client attributes . A relatively small clients slice size ( 20 ) is used to reduce the number of clients inspected within a single tick of the EM reactor . The ` publish_proxy_check_requests () ` method is used to iterate through the matching Sensu clients creating their own unique proxy check request substituting client tokens and then publishing them to the targetted subscriptions .
def create_proxy_check_requests(check)
        client_attributes = check[:proxy_requests][:client_attributes]
        unless client_attributes.empty?
          @redis.smembers("clients") do |clients|
            client_count = clients.length
            proxy_check_requests = Proc.new do |matching_clients, slice_start, slice_size|
              unless slice_start > client_count - 1
                clients_slice = clients.slice(slice_start..slice_size)
                determine_matching_clients(clients_slice, client_attributes) do |additional_clients|
                  matching_clients += additional_clients
                  proxy_check_requests.call(matching_clients, slice_start + 20, slice_size + 20)
                end
              else
                publish_proxy_check_requests(matching_clients, check)
              end
            end
            proxy_check_requests.call([], 0, 19)
          end
        end
      end
def create_proxy_check_requests ( check ) client_attributes = check [ :proxy_requests ] [ :client_attributes ] unless client_attributes . empty? @redis . smembers ( "clients" ) do | clients | client_count = clients . length proxy_check_requests = Proc . new do | matching_clients , slice_start , slice_size | unless slice_start > client_count - 1 clients_slice = clients . slice ( slice_start .. slice_size ) determine_matching_clients ( clients_slice , client_attributes ) do | additional_clients | matching_clients += additional_clients proxy_check_requests . call ( matching_clients , slice_start + 20 , slice_size + 20 ) end else publish_proxy_check_requests ( matching_clients , check ) end end proxy_check_requests . call ( [ ] , 0 , 19 ) end end end
Create and publish one or more proxy check requests.
Create and publish one or more proxy check requests .
check
None