riemann-aws-dynamodb 0.0.2 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8864f136ccfb703586bd4663d78cc17b116e46e5
4
- data.tar.gz: f337738b618e4795fe12d4b7621471a58efe415d
3
+ metadata.gz: 34cd73b6d0d8f8ede15b4439662dbda0030b59bf
4
+ data.tar.gz: e29e08b94c46c71d10f8804d51f0e4a9357dc0d1
5
5
  SHA512:
6
- metadata.gz: a5a937dbb16bbbe8f5f4a62184f64200a6a3243b9bee68fd83553cb025504e226b02e1597e06b03024c08a82279d5415bc3406ffff2a2f3e9ac32a4fe181f675
7
- data.tar.gz: 97f4bdf4e8de5a22bb7e454962fd0d748e4b539b104354301d6e151858ae4d69c8b6eaa4c835b85dbd450fa09f05079318cdd1d243632dc69ed7dc1e8b2ae4d4
6
+ metadata.gz: f3956d8962ebc5224cd1ef1bb325a2316acb148b1d916dfa3e15d0d062674667c4ca50b10a57629bb3a86508f844004bd35417ac4324e6b6753e948a395c8387
7
+ data.tar.gz: 7d31d5d48db74b874e07fe05f6b9ec236f8c067a293c73ee8589303cdc6716c4abbdbf008741c365ab234d68fe33cb39d775c2e4ef582b85f404935bd58ab144
@@ -12,20 +12,24 @@ class Riemann::Tools::AwsDynamoDB
12
12
  opt :access_key, "AWS access key", :type => String
13
13
  opt :secret_key, "Secret access key", :type => String
14
14
  opt :region, "AWS region", :type => String, :default => 'us-east-1'
15
- opt :tables, "Table names", :type => String, :multi => true
15
+ opt :only_table, "Only monitor this table. Can specify multiple times.", :type => String, :multi => true
16
+ opt :ign_table, "Don't monitor this table. Can specify multiple times.", :type => String, :multi => true
16
17
  # opt :metric, "Metric names with comma-separated warning/critical thresholds (eg., 'CPUUtilization,50,90'). Multiple tuples can be set.", :type => String, :multi => true
17
18
 
18
19
  def initialize
19
- abort "FATAL: specify table names, see --help for usage" unless opts[:tables_given]
20
- @tables = opts.fetch(:tables)
20
+ @only_tables = opts.fetch(:only_table)
21
+ @ign_tables = opts.fetch(:ign_table)
22
+
21
23
  if opts.has_key?('access_key') and opts.has_key?('secret_key')
22
24
  creds = { :aws_access_key_id => opts[:access_key],
23
25
  :aws_secret_access_key => opts[:secret_key] }
24
26
  else
25
27
  creds = { :use_iam_profile => true }
26
28
  end
29
+
27
30
  creds['region'] = opts[:region]
28
31
  @cloudwatch = Fog::AWS::CloudWatch.new(creds)
32
+ @dynamodb = Fog::AWS::DynamoDB.new(creds)
29
33
  end
30
34
 
31
35
  def metrics_opts
@@ -39,6 +43,15 @@ class Riemann::Tools::AwsDynamoDB
39
43
 
40
44
  def tick
41
45
  time = Time.new
46
+ ddb = @dynamodb.list_tables
47
+ @tables = ddb[:body]["TableNames"]
48
+
49
+ if opts[:only_table_given]
50
+ @tables &= @only_tables
51
+ elsif opts[:ign_table_given]
52
+ @tables -= @ign_tables
53
+ end
54
+
42
55
  @tables.each do |table_name|
43
56
  metrics_opts.each_pair do |metric_name, opts|
44
57
  result = @cloudwatch.get_metric_statistics({
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "riemann-aws-dynamodb"
7
- spec.version = '0.0.2'
7
+ spec.version = '0.0.4'
8
8
  spec.authors = ["Fernando Alonso"]
9
9
  spec.email = ["krakatoa1987@gmail.com"]
10
10
  spec.summary = %q{Riemann agent to collect Aws DynamoDB metrics}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: riemann-aws-dynamodb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fernando Alonso
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-19 00:00:00.000000000 Z
11
+ date: 2016-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: riemann-tools