Class: Synapse::ServiceWatcher::Ec2tagWatcher
- Inherits:
-
BaseWatcher
- Object
- BaseWatcher
- Synapse::ServiceWatcher::Ec2tagWatcher
- Defined in:
- lib/synapse/service_watcher/ec2tag.rb
Constant Summary
Constants inherited from BaseWatcher
BaseWatcher::LEADER_WARN_INTERVAL
Instance Attribute Summary collapse
-
#check_interval ⇒ Object
readonly
Returns the value of attribute check_interval.
Attributes inherited from BaseWatcher
Instance Method Summary collapse
Methods inherited from BaseWatcher
#backends, #config_for_generator, #haproxy, #initialize, #ping?, #stop
Methods included from Logging
configure_logger_for, #log, logger_for
Constructor Details
This class inherits a constructor from Synapse::ServiceWatcher::BaseWatcher
Instance Attribute Details
#check_interval ⇒ Object (readonly)
Returns the value of attribute check_interval.
7 8 9 |
# File 'lib/synapse/service_watcher/ec2tag.rb', line 7 def check_interval @check_interval end |
Instance Method Details
#start ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/synapse/service_watcher/ec2tag.rb', line 9 def start region = @discovery['aws_region'] || ENV['AWS_REGION'] log.info "Connecting to EC2 region: #{region}" @ec2 = AWS::EC2.new( region: region, access_key_id: @discovery['aws_access_key_id'] || ENV['AWS_ACCESS_KEY_ID'], secret_access_key: @discovery['aws_secret_access_key'] || ENV['AWS_SECRET_ACCESS_KEY'] ) @check_interval = @discovery['check_interval'] || 15.0 log.info "synapse: ec2tag watcher looking for instances " + "tagged with #{@discovery['tag_name']}=#{@discovery['tag_value']}" @watcher = Thread.new { watch } end |