Class: CfnGuardian::Resource::KafkaCluster

Inherits:
Base
  • Object
show all
Defined in:
lib/cfnguardian/resources/kafka_cluster.rb

Instance Method Summary collapse

Methods inherited from Base

#default_checks, #default_event_subscriptions, #default_events, #default_metric_filters, #get_alarms, #get_checks, #get_cost, #get_event_subscriptions, #get_events, #get_metric_filters, #resource_exists?

Methods included from Logging

colors, included, logger, #logger, logger=

Constructor Details

#initialize(resource, override_group = nil) ⇒ KafkaCluster

Returns a new instance of KafkaCluster.



4
5
6
7
# File 'lib/cfnguardian/resources/kafka_cluster.rb', line 4

def initialize(resource, override_group = nil)
  super(resource, override_group)
  @brokers_list = resource['Brokers']
end

Instance Method Details

#default_alarmsObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/cfnguardian/resources/kafka_cluster.rb', line 9

def default_alarms
  @brokers_list.each do |broker|
    alarm = CfnGuardian::Models::KafkaClusterAlarm.new(@resource,broker)
    alarm.name = "Broker#{broker}-CPUUserCritical"
    alarm.metric_name = 'CpuUser'
    alarm.threshold = 80
    @alarms.push(alarm)

    alarm = CfnGuardian::Models::KafkaClusterAlarm.new(@resource,broker)
    alarm.name = "Broker#{broker}-CPUUserWarning"
    alarm.metric_name = 'CpuUser'
    alarm.threshold = 50
    alarm.alarm_action = 'Warning'
    @alarms.push(alarm)

    alarm = CfnGuardian::Models::KafkaClusterAlarm.new(@resource,broker)
    alarm.name = "Broker#{broker}-KafkaDataLogsDiskUsedCritical"
    alarm.metric_name = 'KafkaDataLogsDiskUsed'
    alarm.threshold = 85
    @alarms.push(alarm)

    alarm = CfnGuardian::Models::KafkaClusterAlarm.new(@resource,broker)
    alarm.name = "Broker#{broker}-KafkaDataLogsDiskUsedWarning"
    alarm.metric_name = 'KafkaDataLogsDiskUsed'
    alarm.threshold = 70
    alarm.alarm_action = 'Warning'
    @alarms.push(alarm)

    alarm = CfnGuardian::Models::KafkaClusterAlarm.new(@resource,broker)
    alarm.name = "Broker#{broker}-BurstBalance"
    alarm.metric_name = 'BurstBalance'
    alarm.threshold = 1
    alarm.comparison_operator = 'LessThanThreshold'
    @alarms.push(alarm)

    alarm = CfnGuardian::Models::KafkaClusterAlarm.new(@resource,broker)
    alarm.name = "Broker#{broker}-MemoryFreeCritical"
    alarm.metric_name = 'MemoryFree'
    alarm.threshold = 10
    alarm.comparison_operator = 'LessThanThreshold'
    @alarms.push(alarm)

    alarm = CfnGuardian::Models::KafkaClusterAlarm.new(@resource,broker)
    alarm.name = "Broker#{broker}-MemoryFreeWarning"
    alarm.metric_name = 'MemoryFree'
    alarm.threshold = 50
    alarm.alarm_action = 'Warning'
    alarm.comparison_operator = 'LessThanThreshold'
    @alarms.push(alarm)

    alarm = CfnGuardian::Models::KafkaClusterAlarm.new(@resource,broker)
    alarm.name = "Broker#{broker}-NetworkRxErrorsCritical"
    alarm.metric_name = 'NetworkRxErrors'
    alarm.threshold = 10
    @alarms.push(alarm)

    alarm = CfnGuardian::Models::KafkaClusterAlarm.new(@resource,broker)
    alarm.name = "Broker#{broker}-NetworkRxErrorsWarning"
    alarm.metric_name = 'NetworkRxErrors'
    alarm.threshold = 5
    alarm.alarm_action = 'Warning'
    @alarms.push(alarm)
  end
end