Skip to content

Commit

Permalink
Merge pull request #74 from base2Services/feature/efs-total-storage-l…
Browse files Browse the repository at this point in the history
…imit

alarm to monitor total file size of an efs volume
  • Loading branch information
Guslington authored Aug 3, 2022
2 parents eb887f7 + 7ad4d97 commit 99c16b9
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 99c16b9

Please sign in to comment.