lib/sensu/server/process.rb
def update_server_registry
        @logger.debug("updating the server registry")
        process_cpu_times do |cpu_user, cpu_system, _, _|
          sensu = RELEASE_INFO.merge(
            :settings => {
              :hexdigest => @settings.hexdigest
            }
          )
          tessen = @settings[:tessen] || {}
          tessen_enabled = tessen.fetch(:enabled, false)
          info = {
            :id => server_id,
            :hostname => system_hostname,
            :address => system_address,
            :tasks => @tasks,
            :metrics => {
              :cpu => {
                :user => cpu_user,
                :system => cpu_system
              }
            },
            :sensu => sensu,
            :tessen => {
              :enabled => tessen_enabled
            },
            :timestamp => Time.now.to_i
          }
          @redis.sadd("servers", server_id)
          server_key = "server:#{server_id}"
          @redis.set(server_key, Sensu::JSON.dump(info)) do
            @redis.expire(server_key, 30)
            @logger.info("updated server registry", :server => info)
            yield(true) if block_given?
          end
        end
      end
# Update the Sensu server registry, stored in Redis. This method
# adds the local/current Sensu server info to the registry,
# including its id, hostname, address, its server tasks, and
# some metrics. Sensu server registry entries expire in 30
# seconds unless updated.
#
# @yield [success] passes success status to optional
#   callback/block.
# @yieldparam success [TrueClass,FalseClass] indicating if the
#   server registry update was a success.
Update the Sensu server registry, stored in Redis. This method
adds the local/current Sensu server info to the registry,
including its id, hostname, address, its server tasks, and
some metrics. Sensu server registry entries expire in 30
seconds unless updated.
Update the Sensu server registry stored in Redis . This method adds the local / current Sensu server info to the registry including its id hostname address its server tasks and some metrics . Sensu server registry entries expire in 30 seconds unless updated .
def update_server_registry
        @logger.debug("updating the server registry")
        process_cpu_times do |cpu_user, cpu_system, _, _|
          sensu = RELEASE_INFO.merge(
            :settings => {
              :hexdigest => @settings.hexdigest
            }
          )
          tessen = @settings[:tessen] || {}
          tessen_enabled = tessen.fetch(:enabled, false)
          info = {
            :id => server_id,
            :hostname => system_hostname,
            :address => system_address,
            :tasks => @tasks,
            :metrics => {
              :cpu => {
                :user => cpu_user,
                :system => cpu_system
              }
            },
            :sensu => sensu,
            :tessen => {
              :enabled => tessen_enabled
            },
            :timestamp => Time.now.to_i
          }
          @redis.sadd("servers", server_id)
          server_key = "server:#{server_id}"
          @redis.set(server_key, Sensu::JSON.dump(info)) do
            @redis.expire(server_key, 30)
            @logger.info("updated server registry", :server => info)
            yield(true) if block_given?
          end
        end
      end
def update_server_registry @logger . debug ( "updating the server registry" ) process_cpu_times do | cpu_user , cpu_system , _ , _ | sensu = RELEASE_INFO . merge ( :settings => { :hexdigest => @settings . hexdigest } ) tessen = @settings [ :tessen ] || { } tessen_enabled = tessen . fetch ( :enabled , false ) info = { :id => server_id , :hostname => system_hostname , :address => system_address , :tasks => @tasks , :metrics => { :cpu => { :user => cpu_user , :system => cpu_system } } , :sensu => sensu , :tessen => { :enabled => tessen_enabled } , :timestamp => Time . now . to_i } @redis . sadd ( "servers" , server_id ) server_key = "server:#{server_id}" @redis . set ( server_key , Sensu :: JSON . dump ( info ) ) do @redis . expire ( server_key , 30 ) @logger . info ( "updated server registry" , :server => info ) yield ( true ) if block_given? end end end
Update the Sensu server registry, stored in Redis.
Update the Sensu server registry stored in Redis .
]
passes success status to optional callback/block.
passes success status to optional callback / block .
success
indicating if the server registry update was a success.
indicating if the server registry update was a success .