Sha256: 08661c5f5c7d4f2c14f9f8cc1865b62db3411341704d88268a3cd4162e32d6e3
Contents?: true
Size: 1.77 KB
Versions: 29
Compression:
Stored size: 1.77 KB
Contents
require 'redis' namespace :events do # FIXME: add arguments, make more flexible desc "send events to trigger some notifications" task :test_notification do # add lib to the default include path unless $:.include?(File.dirname(__FILE__) + '/../lib/') $: << File.dirname(__FILE__) + '/../lib' end require 'flapjack/configuration' require 'flapjack/data/event' require 'flapjack/data/entity_check' FLAPJACK_ENV = ENV['FLAPJACK_ENV'] || 'development' config_file = File.join('etc', 'flapjack_config.yaml') config = Flapjack::Configuration.new config.load( config_file ) @config_env = config.all @redis_config = config.for_redis if @config_env.nil? || @config_env.empty? puts "No config data for environment '#{FLAPJACK_ENV}' found in '#{config_file}'" exit(false) end redis = Redis.new(@redis_config) Flapjack::Data::Event.add({'entity' => 'clientx-app-01', 'check' => 'ping', 'type' => 'service', 'state' => 'ok', 'summary' => 'testing'}, :redis => redis) sleep(8) Flapjack::Data::Event.add({'entity' => 'clientx-app-01', 'check' => 'ping', 'type' => 'service', 'state' => 'critical', 'summary' => 'testing'}, :redis => redis) sleep(8) Flapjack::Data::Event.add({'entity' => 'clientx-app-01', 'check' => 'ping', 'type' => 'service', 'state' => 'ok', 'summary' => 'testing'}, :redis => redis) end end
Version data entries
29 entries across 29 versions & 1 rubygems