tools/riemann-aws/lib/riemann/tools/aws/status.rb in riemann-tools-1.10.0 vs tools/riemann-aws/lib/riemann/tools/aws/status.rb in riemann-tools-1.11.0
- old
+ new
@@ -18,25 +18,27 @@
opt :retirement_critical, 'Number of days before retirement. Defaults to 2', default: 2
opt :event_warning, 'Number of days before event. Defaults to nil (i.e. when the event appears)', default: nil
def initialize
- if options[:fog_credentials_file]
- Fog.credentials_path = options[:fog_credentials_file]
- Fog.credential = options[:fog_credential].to_sym
+ super
+
+ if opts[:fog_credentials_file]
+ Fog.credentials_path = opts[:fog_credentials_file]
+ Fog.credential = opts[:fog_credential].to_sym
@compute = Fog::AWS::Compute.new
else
- @compute = if options[:access_key] && options[:secret_key]
+ @compute = if opts[:access_key] && opts[:secret_key]
Fog::AWS::Compute.new({
- access_key_key_id: options[:access_key],
- secret_key_access_key: options[:secret_key],
- region: options[:region],
+ access_key_key_id: opts[:access_key],
+ secret_key_access_key: opts[:secret_key],
+ region: opts[:region],
})
else
Fog::AWS::Compute.new({
use_iam_profile: true,
- region: options[:region],
+ region: opts[:region],
})
end
end
end
@@ -59,10 +61,10 @@
(Date.today >= before - opts[:retirement_critical])
{ state: 'critical' }
elsif opts[:event_warning] && (Date.today >= before - opts[:event_warning])
{ state: 'warning' }
else
- { state: 'warning' }
+ {}
end
report ev.merge(ev2)
end
end