Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bin/AWScloudwatchBilling.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
endTime = Time.now.utc - options[:end_offset].to_i


cloudwatch = Fog::AWS::CloudWatch.new(:aws_secret_access_key => $awssecretkey, :aws_access_key_id => $awsaccesskey)
cloudwatch = Fog::AWS::CloudWatch.new($awscredential)

%w( AmazonCloudFront AmazonDynamoDB AmazonEC2 AmazonRDS AmazonS3 AmazonSNS AWSDataTransfer ).each do |name|
responses = cloudwatch.get_metric_statistics({
Expand Down
2 changes: 1 addition & 1 deletion bin/AWScloudwatchDynamo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
]


cloudwatch = Fog::AWS::CloudWatch.new(:aws_secret_access_key => $awssecretkey, :aws_access_key_id => $awsaccesskey)
cloudwatch = Fog::AWS::CloudWatch.new($awscredential)

tables.each do |table|
operationLevelMetrics.each do |metric|
Expand Down
5 changes: 2 additions & 3 deletions bin/AWScloudwatchEBS.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
volumeIds << vol
end
else
compute = Fog::Compute.new(:provider => :aws, :aws_secret_access_key => $awssecretkey, :aws_access_key_id => $awsaccesskey)
compute = Fog::Compute.new($awscredential.merge({:provider => :aws}))
compute.volumes.all.each do |vol|
volumeIds << vol.id
end
Expand Down Expand Up @@ -106,7 +106,7 @@
}
]

cloudwatch = Fog::AWS::CloudWatch.new(:aws_secret_access_key => $awssecretkey, :aws_access_key_id => $awsaccesskey)
cloudwatch = Fog::AWS::CloudWatch.new($awscredential)

volumeIds.each do |volume|
metrics.each do |metric|
Expand Down Expand Up @@ -137,4 +137,3 @@
end
end
end

8 changes: 2 additions & 6 deletions bin/AWScloudwatchEC2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,8 @@
startTime = Time.now.utc - options[:start_offset].to_i
endTime = Time.now.utc - options[:end_offset].to_i

compute = Fog::Compute.new( :provider => :aws,
:aws_access_key_id => $awsaccesskey,
:aws_secret_access_key => $awssecretkey)
cloudwatch = Fog::AWS::CloudWatch.new(
:aws_access_key_id => $awsaccesskey,
:aws_secret_access_key => $awssecretkey)
compute = Fog::Compute.new($awscredential.merge({:provider => :aws}))
cloudwatch = Fog::AWS::CloudWatch.new($awscredential)

instance_list = compute.servers.all

Expand Down
5 changes: 2 additions & 3 deletions bin/AWScloudwatchELB.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@

unit = 'Count'

cloudwatch = Fog::AWS::CloudWatch.new(:aws_secret_access_key => $awssecretkey, :aws_access_key_id => $awsaccesskey, :region => $awsregion)
cloudwatch = Fog::AWS::CloudWatch.new($awscredential.merge({:region => $awsregion}))

lbs.each do |table|
metricNames.each do |metricName, statistic|
Expand Down Expand Up @@ -110,7 +110,7 @@

unit = 'Seconds'

cloudwatch = Fog::AWS::CloudWatch.new(:aws_secret_access_key => $awssecretkey, :aws_access_key_id => $awsaccesskey)
cloudwatch = Fog::AWS::CloudWatch.new($awscredential)

lbs.each do |table|
metricNames.each do |statistic, metricName|
Expand Down Expand Up @@ -142,4 +142,3 @@
end
end
end

4 changes: 2 additions & 2 deletions bin/AWScloudwatchRDS.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
dbNames << db
end
else
rds = Fog::AWS::RDS.new(:aws_secret_access_key => $awssecretkey, :aws_access_key_id => $awsaccesskey)
rds = Fog::AWS::RDS.new($awscredential)
rds.servers.all.each do |s|
dbNames << s.id
end
Expand All @@ -71,7 +71,7 @@
}


cloudwatch = Fog::AWS::CloudWatch.new(:aws_secret_access_key => $awssecretkey, :aws_access_key_id => $awsaccesskey)
cloudwatch = Fog::AWS::CloudWatch.new($awscredential)

dbNames.each do |db|
metricNames.each do |metricName, unit|
Expand Down
4 changes: 1 addition & 3 deletions bin/AWScountEC2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
require 'rubygems' if RUBY_VERSION < "1.9"
require 'fog'

compute = Fog::Compute.new( :provider => :aws,
:aws_access_key_id => $awsaccesskey,
:aws_secret_access_key => $awssecretkey)
compute = Fog::Compute.new($awscredential.merge({:provider => :aws}))

instance_list = compute.servers.all
instance_report = Hash.new
Expand Down
21 changes: 15 additions & 6 deletions conf/config.rb-sample
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,20 @@ $newrelicaccount = ''
# $newrelicapikey = '123123123123123123123'
$newrelicapikey = ''

# AWS
# $awsaccesskey = 'AAAAAAAAAAAAAAAA'
$awsaccesskey = ''
# $awssecretkey = 'aaaaaaaaaaaaaaaaaaaaaaaaaa'
$awssecretkey = ''
# AWS Crendential - Using Keys
# $awscredential = {
# :aws_secret_access_key => 'aaaaaaaaaaaaaaaaaaaaaaaaaa',
# :aws_access_key_id => 'AAAAAAAAAAAAAAAA'
# }
$awscredential = {
:aws_secret_access_key => '',
:aws_access_key_id => ''
}
# AWS Crendential - Using IAM instance profile
# If using IAM profile: i) uncomment following & ii) comment "Using Keys" section above
# $awscredential = {
# :use_iam_profile => true
# }
# $awsregion = 'us-east-1'
$awsregion = 'us-east-1'

Expand Down Expand Up @@ -63,7 +72,7 @@ $gmondport = 8649

##OpenTSDB You'll need to manually tell tsdb about each top level metric you add like this:
## tsdb mkmetric newrelic
## tsdb mkmetric AWScloudwatch
## tsdb mkmetric AWScloudwatch
# $opentsdbserver = '127.0.0.1'
$opentsdbserver = ''
$opentsdbport = 4242