Permalink
Browse files

aws endpoints changed

  • Loading branch information...
1 parent 38a9e4a commit bf5182a10e3022362c6b16a1133602dcebe7cb9b @Markowy Markowy committed Jul 17, 2012
@@ -40,11 +40,7 @@ def new?
def set_time_range
@now = Time.now.utc
- @start_time, @end_time = if new?
- [Time.now.change({:day => 1}).iso8601, @now.iso8601]
- else
- [(@now - 3600).iso8601, @now.iso8601]
- end
+ @start_time, @end_time = [(@now - 3600).iso8601, @now.iso8601]
end
def send
@@ -13,7 +13,7 @@ def fetch_data()
self.perform_action do
ec2 = RightAws::Ec2.new(@access_key_id, @secret_access_key, :region => region)
volumes = ec2.describe_volumes
- cw = RightAws::AcwInterface.new(@access_key_id, @secret_access_key, :region => region)
+ cw = RightAws::AcwInterface.new(@access_key_id, @secret_access_key, :endpoint_url => "https://monitoring.#{region}.amazonaws.com")
volumes.each do |volume|
MEASURE_NAME.each do |measure|
metrics = cw.get_metric_statistics({:namespace => 'AWS/EBS',
@@ -14,7 +14,7 @@ def fetch_data()
self.perform_action do
ec = RightAws::EcInterface.new(@access_key_id, @secret_access_key, :server => "elasticache.#{region}.amazonaws.com")
instances = ec.describe_cache_clusters
- cw = RightAws::AcwInterface.new(@access_key_id, @secret_access_key, :region => region)
+ cw = RightAws::AcwInterface.new(@access_key_id, @secret_access_key, :endpoint_url => "https://monitoring.#{region}.amazonaws.com")
instances.each do |instance|
cache_nodes = instance[:cache_nodes]
MEASURE_NAME.each do |measure|
@@ -14,7 +14,7 @@ def fetch_data()
self.perform_action do
ec2 = RightAws::Ec2.new(@access_key_id, @secret_access_key, :region => region)
instances = ec2.describe_instances
- cw = RightAws::AcwInterface.new(@access_key_id, @secret_access_key, :region => region)
+ cw = RightAws::AcwInterface.new(@access_key_id, @secret_access_key, :endpoint_url => "https://monitoring.#{region}.amazonaws.com")
instances.each do |instance|
MEASURE_NAMES.each do |measure_name|
metrics = cw.get_metric_statistics({:namespace => "AWS/EC2",
@@ -12,9 +12,9 @@ def fetch_data()
REGIONS.each do |region|
self.perform_action do
- elb = RightAws::ElbInterface.new(@access_key_id, @secret_access_key, :region => region)
+ elb = RightAws::ElbInterface.new(@access_key_id, @secret_access_key, :endpoint_url => "https://elasticloadbalancing.#{region}.amazonaws.com")
balancers = elb.describe_load_balancers
- cw = RightAws::AcwInterface.new(@access_key_id, @secret_access_key, :region => region)
+ cw = RightAws::AcwInterface.new(@access_key_id, @secret_access_key, :endpoint_url => "https://monitoring.#{region}.amazonaws.com")
balancers.each do |balancer|
MEASURE_NAME.each do |measure|
metrics = cw.get_metric_statistics({:namespace => 'AWS/ELB',
@@ -13,9 +13,9 @@ def fetch_data()
REGIONS.each do |region|
self.perform_action do
- rds = RightAws::RdsInterface.new(@access_key_id, @secret_access_key, :region => region)
+ rds = RightAws::RdsInterface.new(@access_key_id, @secret_access_key, :endpoint_url => "https://rds.#{region}.amazonaws.com")
instances = rds.describe_db_instances
- cw = RightAws::AcwInterface.new(@access_key_id, @secret_access_key, :region => region)
+ cw = RightAws::AcwInterface.new(@access_key_id, @secret_access_key, :endpoint_url => "https://monitoring.#{region}.amazonaws.com")
instances.each do |instance|
MEASURE_NAME.each do |measure|
metrics = cw.get_metric_statistics({:namespace => "AWS/RDS",
@@ -33,11 +33,10 @@ def fetch_data()
end
instances
- end
-
+ end
end
- return perform_action
+ return true
end
@@ -9,7 +9,7 @@ class LoadBalancer < CvCollector::Provider::Aws::Base
def fetch_data()
REGIONS.each do |region|
self.perform_action do
- elb = RightAws::ElbInterface.new(@access_key_id, @secret_access_key, :region => region)
+ elb = RightAws::ElbInterface.new(@access_key_id, @secret_access_key, :endpoint_url => "https://elasticloadbalancing.#{region}.amazonaws.com")
balancers = elb.describe_load_balancers
balancers.each do |balancer|
@data << parse_data(balancer).merge('region' => region)
View
@@ -15,9 +15,10 @@
CV_API_KEY = YAML::load(File.open("#{ENV["HOME"]}/.cvc/cv/credentials"))[:api_key]
AWS_CREDENTIALS = YAML::load(File.open("#{ENV["HOME"]}/.cvc/aws/credentials"))
-API_URL = "https://resources.cloudvertical.com"
-loop do
+API_URL = "https://resource.cloudvertical.com"
+loop do
+ puts "\ncvc-daemon: Fetching data process... Please be patient - this may take several minutes.\n\n"
components = [
CvCollector::Provider::Aws::Billing,
CvCollector::Provider::Aws::BillingProgramatic,
@@ -46,6 +47,7 @@
end
CvCollector::Provider::Aws::Base.save_sync
-
+ puts "\ncvc-daemon: Data collected. Next check in 1 hour."
+ puts "cvc-daemon: Idle..."
sleep 60*60
end

0 comments on commit bf5182a

Please sign in to comment.