Skip to content

Commit

Permalink
alarm to monitor total file size of an efs volume
Browse files Browse the repository at this point in the history
  • Loading branch information
Guslington committed Aug 3, 2022
1 parent 7f267ee commit 7ad4d97
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/cfnguardian/models/alarm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -299,11 +299,14 @@ def initialize(resource)
end

class ElasticFileSystemAlarm < BaseAlarm
def initialize(resource)
def initialize(resource, storage_class = nil)
super(resource)
@group = 'ElasticFileSystem'
@namespace = 'AWS/EFS'
@dimensions = { FileSystemId: resource['Id'] }
unless storage_class.nil?
@dimensions[:StorageClass] = storage_class
end
end
end

Expand Down
12 changes: 12 additions & 0 deletions lib/cfnguardian/resources/elastic_file_system.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,18 @@ def default_alarms
alarm.treat_missing_data = 'notBreaching'
alarm.datapoints_to_alarm = 5
@alarms.push(alarm)

alarm = CfnGuardian::Models::ElasticFileSystemAlarm.new(@resource, 'Total')
alarm.name = 'TotalStorageUsed'
alarm.metric_name = 'StorageBytes'
alarm.comparison_operator = 'GreaterThanThreshold'
alarm.threshold = 10000000000 # 10GB default
alarm.evaluation_periods = 60
alarm.treat_missing_data = 'notBreaching'
alarm.datapoints_to_alarm = 30
alarm.alarm_action = 'Task'
alarm.enabled = false
@alarms.push(alarm)
end
end
end
Expand Down

0 comments on commit 7ad4d97

Please sign in to comment.