lib/pghero/methods/system.rb in pghero-1.2.4 vs lib/pghero/methods/system.rb in pghero-1.3.0
- old
+ new
@@ -23,13 +23,13 @@
def rds_stats(metric_name)
if system_stats_enabled?
client =
if defined?(Aws)
- Aws::CloudWatch::Client.new(access_key_id: access_key_id, secret_access_key: secret_access_key)
+ Aws::CloudWatch::Client.new(access_key_id: access_key_id, secret_access_key: secret_access_key, region: region)
else
- AWS::CloudWatch.new(access_key_id: access_key_id, secret_access_key: secret_access_key).client
+ AWS::CloudWatch.new(access_key_id: access_key_id, secret_access_key: secret_access_key, region: region).client
end
now = Time.now
resp = client.get_metric_statistics(
namespace: "AWS/RDS",
@@ -58,9 +58,13 @@
ENV["PGHERO_ACCESS_KEY_ID"] || ENV["AWS_ACCESS_KEY_ID"]
end
def secret_access_key
ENV["PGHERO_SECRET_ACCESS_KEY"] || ENV["AWS_SECRET_ACCESS_KEY"]
+ end
+
+ def region
+ ENV["PGHERO_REGION"] || ENV["AWS_REGION"] || (defined?(Aws) && Aws.config[:region]) || "us-east-1"
end
def db_instance_identifier
databases[current_database].db_instance_identifier
end