Sha256: 9b27e2e7310936f54e7049966bdf662405e18a5732d08479eaf73c38a3e2737d
Contents?: true
Size: 884 Bytes
Versions: 17
Compression:
Stored size: 884 Bytes
Contents
#!/usr/bin/env ruby require 'redis' require 'oj' Oj.default_options = { :indent => 0, :mode => :compat } id = "%.2d" % (1..10).to_a[rand(9)] events = [] events << Oj.dump({ 'entity' => "app-#{id}", 'check' => 'http', 'type' => 'service', 'state' => 'ok', 'summary' => 'well i don\'t know', }) events << Oj.dump({ 'entity' => "app-#{id}", 'check' => 'http', 'type' => 'host', 'state' => 'critical', 'summary' => 'well i don\'t know', }) redis = Redis.new(:db => 13) 2000.times do events.each {|event| redis.rpush 'events', event } end puts "#{Time.now} - finished loading up events" previous_events_size = redis.llen 'events' while previous_events_size > 0 sleep 1 events_size = redis.llen 'events' throughput = previous_events_size - events_size previous_events_size = events_size puts "#{Time.now} - #{events_size} (#{throughput})" end
Version data entries
17 entries across 17 versions & 1 rubygems