cfn_monitor 0.3.2 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +13 -13
- data/lib/cfn_monitor/query.rb +10 -2
- data/lib/cfn_monitor/version.rb +1 -1
- data/lib/config/config.yml +3 -0
- data/lib/config/templates.yml +146 -9
- data/lib/templates/alarms.rb +6 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d9ad46a04c973e8e513a89fa1a6aaa774c55680e6d23b3a86d295107420cfe79
|
4
|
+
data.tar.gz: 2004bfad14bb93e09873f4d048d24a03333b43c489da972be5525ab3f402f669
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e10aa44c6904f4f2e669ebd4d30ff1876c1bab5d6b79a6672591cf7003f762b830d744695864b8de89c7b99ddd7f7db55adf6c019d357f59d21df3003fcbc896
|
7
|
+
data.tar.gz: 4a99599700015475d0df8ae6e2822763c07b343c94a325167b838c09e0cc1644a3403e6a1e4cefc16659b0c65795e6ee07f63953a8cbc666b2c891037603a2af
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
cfn_monitor (0.
|
4
|
+
cfn_monitor (0.4.0)
|
5
5
|
aws-sdk-cloudformation (~> 1, < 2)
|
6
6
|
aws-sdk-elasticloadbalancingv2 (~> 1, < 2)
|
7
7
|
aws-sdk-s3 (~> 1, < 2)
|
@@ -12,28 +12,28 @@ GEM
|
|
12
12
|
remote: https://rubygems.org/
|
13
13
|
specs:
|
14
14
|
aws-eventstream (1.0.3)
|
15
|
-
aws-partitions (1.
|
16
|
-
aws-sdk-cloudformation (1.
|
17
|
-
aws-sdk-core (~> 3, >= 3.
|
15
|
+
aws-partitions (1.176.0)
|
16
|
+
aws-sdk-cloudformation (1.23.0)
|
17
|
+
aws-sdk-core (~> 3, >= 3.56.0)
|
18
18
|
aws-sigv4 (~> 1.1)
|
19
|
-
aws-sdk-core (3.
|
19
|
+
aws-sdk-core (3.56.0)
|
20
20
|
aws-eventstream (~> 1.0, >= 1.0.2)
|
21
21
|
aws-partitions (~> 1.0)
|
22
22
|
aws-sigv4 (~> 1.1)
|
23
23
|
jmespath (~> 1.0)
|
24
|
-
aws-sdk-elasticloadbalancingv2 (1.
|
25
|
-
aws-sdk-core (~> 3, >= 3.
|
24
|
+
aws-sdk-elasticloadbalancingv2 (1.30.0)
|
25
|
+
aws-sdk-core (~> 3, >= 3.56.0)
|
26
26
|
aws-sigv4 (~> 1.1)
|
27
|
-
aws-sdk-kms (1.
|
28
|
-
aws-sdk-core (~> 3, >= 3.
|
27
|
+
aws-sdk-kms (1.22.0)
|
28
|
+
aws-sdk-core (~> 3, >= 3.56.0)
|
29
29
|
aws-sigv4 (~> 1.1)
|
30
|
-
aws-sdk-s3 (1.
|
31
|
-
aws-sdk-core (~> 3, >= 3.
|
30
|
+
aws-sdk-s3 (1.43.0)
|
31
|
+
aws-sdk-core (~> 3, >= 3.56.0)
|
32
32
|
aws-sdk-kms (~> 1)
|
33
|
-
aws-sigv4 (~> 1.
|
33
|
+
aws-sigv4 (~> 1.1)
|
34
34
|
aws-sigv4 (1.1.0)
|
35
35
|
aws-eventstream (~> 1.0, >= 1.0.2)
|
36
|
-
cfndsl (0.
|
36
|
+
cfndsl (0.17.0)
|
37
37
|
diff-lcs (1.3)
|
38
38
|
jmespath (1.4.0)
|
39
39
|
rake (10.5.0)
|
data/lib/cfn_monitor/query.rb
CHANGED
@@ -116,11 +116,19 @@ module CfnMonitor
|
|
116
116
|
end
|
117
117
|
stackResources[:template]["#{location[1..-1]}.#{resource['logical_resource_id']}/#{tg['target_groups'][0]['load_balancer_arns'][0]}"] = config['resource_defaults'][resource['resource_type']]
|
118
118
|
else
|
119
|
-
|
119
|
+
if location[1..-1].nil?
|
120
|
+
stackResources[:template]["#{stack}::#{resource['logical_resource_id']}"] = config['resource_defaults'][resource['resource_type']]
|
121
|
+
else
|
122
|
+
stackResources[:template]["#{location[1..-1]}.#{resource['logical_resource_id']}"] = config['resource_defaults'][resource['resource_type']]
|
123
|
+
end
|
120
124
|
end
|
121
125
|
stackResourceCount += 1
|
122
126
|
stackResourceCountLocal += 1
|
123
|
-
|
127
|
+
if location[1..-1].nil?
|
128
|
+
print "#{stack}: Found #{stackResourceCount} resource#{"s" if stackResourceCount != 1}\r"
|
129
|
+
else
|
130
|
+
print "#{location[1..-1]}: Found #{stackResourceCount} resource#{"s" if stackResourceCount != 1}\r"
|
131
|
+
end
|
124
132
|
sleep 0.2
|
125
133
|
elsif resource['resource_type'] == 'AWS::ElasticLoadBalancingV2::LoadBalancer'
|
126
134
|
stackResources[:physical_resource_id][resource['physical_resource_id']] = "#{location[1..-1]}.#{resource['logical_resource_id']}"
|
data/lib/cfn_monitor/version.rb
CHANGED
data/lib/config/config.yml
CHANGED
data/lib/config/templates.yml
CHANGED
@@ -85,18 +85,18 @@ templates:
|
|
85
85
|
ComparisonOperator: LessThanThreshold
|
86
86
|
Dimensions: [ { Name: 'URL', Value: '${resource}' } ]
|
87
87
|
Statistic: Maximum
|
88
|
-
Threshold:
|
88
|
+
Threshold: 5 # 5 days
|
89
89
|
Period: 60
|
90
90
|
EvaluationPeriods: 1
|
91
91
|
MetricName: ExpiresInDays
|
92
92
|
AlarmDescription: { 'Fn::Join': [ ' ', [ '${resource}', '${templateName}' ] ] }
|
93
|
-
|
94
|
-
AlarmActions:
|
93
|
+
Task:
|
94
|
+
AlarmActions: task
|
95
95
|
Namespace: SSL
|
96
96
|
ComparisonOperator: LessThanThreshold
|
97
97
|
Dimensions: [ { Name: 'URL', Value: '${resource}' } ]
|
98
98
|
Statistic: Maximum
|
99
|
-
Threshold:
|
99
|
+
Threshold: 30 # 30 days
|
100
100
|
Period: 60
|
101
101
|
EvaluationPeriods: 1
|
102
102
|
MetricName: ExpiresInDays
|
@@ -108,18 +108,18 @@ templates:
|
|
108
108
|
ComparisonOperator: LessThanThreshold
|
109
109
|
Dimensions: [ { Name: 'Domain', Value: '${resource}' } ]
|
110
110
|
Statistic: Maximum
|
111
|
-
Threshold:
|
111
|
+
Threshold: 5 # 5 days
|
112
112
|
Period: 60
|
113
113
|
EvaluationPeriods: 1
|
114
114
|
MetricName: ExpiresInDays
|
115
115
|
AlarmDescription: { 'Fn::Join': [ ' ', [ '${resource}', '${templateName}' ] ] }
|
116
|
-
|
117
|
-
AlarmActions:
|
116
|
+
Task:
|
117
|
+
AlarmActions: task
|
118
118
|
Namespace: DNS
|
119
119
|
ComparisonOperator: LessThanThreshold
|
120
120
|
Dimensions: [ { Name: 'Domain', Value: '${resource}' } ]
|
121
121
|
Statistic: Maximum
|
122
|
-
Threshold:
|
122
|
+
Threshold: 30 # 30 days
|
123
123
|
Period: 60
|
124
124
|
EvaluationPeriods: 1
|
125
125
|
MetricName: ExpiresInDays
|
@@ -461,10 +461,31 @@ templates:
|
|
461
461
|
Namespace: AWS/ApiGateway
|
462
462
|
MetricName: 5XXError
|
463
463
|
ComparisonOperator: GreaterThanThreshold
|
464
|
-
DimensionsName: ApiName
|
464
|
+
#DimensionsName: ApiName
|
465
|
+
Dimensions: [ { Name: 'ApiName', Value: '${name}' }]
|
466
|
+
Statistic: Sum
|
467
|
+
Threshold: 5
|
468
|
+
EvaluationPeriods: 2
|
469
|
+
ApiEndpoint4xx:
|
470
|
+
AlarmActions: warn
|
471
|
+
Namespace: AWS/ApiGateway
|
472
|
+
MetricName: 4XXError
|
473
|
+
ComparisonOperator: GreaterThanThreshold
|
474
|
+
#DimensionsName: ApiName
|
475
|
+
Dimensions: [ { Name: 'ApiName', Value: '${name}' }]
|
465
476
|
Statistic: Sum
|
466
477
|
Threshold: 5
|
467
478
|
EvaluationPeriods: 2
|
479
|
+
Latency:
|
480
|
+
AlarmActions: warn
|
481
|
+
Namespace: AWS/ApiGateway
|
482
|
+
MetricName: Latency
|
483
|
+
ComparisonOperator: GreaterThanThreshold
|
484
|
+
#DimensionsName: ApiName
|
485
|
+
Dimensions: [ { Name: 'ApiName', Value: '${name}' }]
|
486
|
+
Statistic: Average
|
487
|
+
Threshold: 5
|
488
|
+
EvaluationPeriods: 2
|
468
489
|
DynamoDBTable: #AWS::DynamoDB::Table
|
469
490
|
DynamoDBReadUsage:
|
470
491
|
AlarmActions: warn
|
@@ -637,3 +658,119 @@ templates:
|
|
637
658
|
Period: 60
|
638
659
|
EvaluationPeriods: 3
|
639
660
|
TreatMissingData: notBreaching
|
661
|
+
SQSQueue:
|
662
|
+
ApproximateAgeOfOldestMessage:
|
663
|
+
AlarmActions: crit
|
664
|
+
Namespace: AWS/SQS
|
665
|
+
ComparisonOperator: GreaterThanThreshold
|
666
|
+
DimensionsName: QueueName
|
667
|
+
Statistic: Average
|
668
|
+
Threshold: 0.5
|
669
|
+
Period: 60
|
670
|
+
EvaluationPeriods: 5
|
671
|
+
MetricName: ApproximateAgeOfOldestMessage
|
672
|
+
TreatMissingData: breaching
|
673
|
+
ApproximateNumberOfMessagesVisible:
|
674
|
+
AlarmActions: crit
|
675
|
+
Namespace: AWS/SQS
|
676
|
+
ComparisonOperator: GreaterThanThreshold
|
677
|
+
DimensionsName: QueueName
|
678
|
+
Statistic: Average
|
679
|
+
Threshold: 0.5
|
680
|
+
Period: 60
|
681
|
+
EvaluationPeriods: 5
|
682
|
+
MetricName: ApproximateNumberOfMessagesVisible
|
683
|
+
TreatMissingData: breaching
|
684
|
+
LambdaFunction: #AWS::Lambda::Function
|
685
|
+
Throttles:
|
686
|
+
AlarmActions: crit
|
687
|
+
Namespace: AWS/Lambda
|
688
|
+
ComparisonOperator: GreaterThanThreshold
|
689
|
+
DimensionsName: FunctionName
|
690
|
+
Statistic: Average
|
691
|
+
Threshold: 0.5
|
692
|
+
Period: 60
|
693
|
+
EvaluationPeriods: 5
|
694
|
+
MetricName: Throttles
|
695
|
+
TreatMissingData: notBreaching
|
696
|
+
DeadLetterErrors:
|
697
|
+
AlarmActions: crit
|
698
|
+
Namespace: AWS/Lambda
|
699
|
+
ComparisonOperator: GreaterThanThreshold
|
700
|
+
DimensionsName: FunctionName
|
701
|
+
Statistic: Average
|
702
|
+
Threshold: 0.5
|
703
|
+
Period: 60
|
704
|
+
EvaluationPeriods: 5
|
705
|
+
MetricName: DeadLetterErrors
|
706
|
+
TreatMissingData: notBreaching
|
707
|
+
LambdaFunctionIteratorAge:
|
708
|
+
IteratorAge:
|
709
|
+
AlarmActions: crit
|
710
|
+
Namespace: AWS/Lambda
|
711
|
+
ComparisonOperator: GreaterThanThreshold
|
712
|
+
DimensionsName: FunctionName
|
713
|
+
Statistic: Average
|
714
|
+
Threshold: 600000
|
715
|
+
Period: 60
|
716
|
+
EvaluationPeriods: 5
|
717
|
+
MetricName: IteratorAge
|
718
|
+
TreatMissingData: notBreaching
|
719
|
+
LambdaFunctionDuration:
|
720
|
+
Duration:
|
721
|
+
AlarmActions: crit
|
722
|
+
Namespace: AWS/Lambda
|
723
|
+
ComparisonOperator: GreaterThanThreshold
|
724
|
+
DimensionsName: FunctionName
|
725
|
+
Statistic: Average
|
726
|
+
Threshold: 30
|
727
|
+
Period: 60
|
728
|
+
EvaluationPeriods: 5
|
729
|
+
MetricName: Duration
|
730
|
+
TreatMissingData: notBreaching
|
731
|
+
LambdaFunctionErrors:
|
732
|
+
Errors:
|
733
|
+
AlarmActions: crit
|
734
|
+
Namespace: AWS/Lambda
|
735
|
+
ComparisonOperator: GreaterThanThreshold
|
736
|
+
DimensionsName: FunctionName
|
737
|
+
Statistic: Average
|
738
|
+
Threshold: 0.5
|
739
|
+
Period: 60
|
740
|
+
EvaluationPeriods: 5
|
741
|
+
MetricName: Errors
|
742
|
+
TreatMissingData: notBreaching
|
743
|
+
CloudFrontDistribution:
|
744
|
+
4xxErrorRate:
|
745
|
+
AlarmActions: warn
|
746
|
+
Namespace: AWS/CloudFront
|
747
|
+
ComparisonOperator: GreaterThanThreshold
|
748
|
+
DimensionsName: DistributionId
|
749
|
+
SecondaryDimensions: [ { Name: 'Region', Value: 'Global' }]
|
750
|
+
Statistic: Sum
|
751
|
+
Threshold: 5
|
752
|
+
EvaluationPeriods: 2
|
753
|
+
MetricName: 4xxErrorRate
|
754
|
+
TreatMissingData: breaching
|
755
|
+
5xxErrorRate:
|
756
|
+
AlarmActions: warn
|
757
|
+
Namespace: AWS/CloudFront
|
758
|
+
ComparisonOperator: GreaterThanThreshold
|
759
|
+
SecondaryDimensions: [ { Name: 'Region', Value: 'Global' }]
|
760
|
+
DimensionsName: DistributionId
|
761
|
+
Statistic: Average
|
762
|
+
Threshold: 5
|
763
|
+
EvaluationPeriods: 2
|
764
|
+
MetricName: 5xxErrorRate
|
765
|
+
TreatMissingData: breaching
|
766
|
+
TotalErrorRate:
|
767
|
+
AlarmActions: warn
|
768
|
+
Namespace: AWS/CloudFront
|
769
|
+
ComparisonOperator: GreaterThanThreshold
|
770
|
+
SecondaryDimensions: [ { Name: 'Region', Value: 'Global' }]
|
771
|
+
DimensionsName: DistributionId
|
772
|
+
Statistic: Average
|
773
|
+
Threshold: 5
|
774
|
+
EvaluationPeriods: 5
|
775
|
+
MetricName: TotalErrorRate
|
776
|
+
TreatMissingData: breaching
|
data/lib/templates/alarms.rb
CHANGED
@@ -126,9 +126,15 @@ CloudFormation do
|
|
126
126
|
dimensionValue = FnSelect('1',FnSplit('loadbalancer/',Ref("GetPhysicalId#{resourceHash}"))) if dimensionsNames[index] == 'LoadBalancer'
|
127
127
|
dimensionValue = FnSelect('1',FnSplit('service/',Ref("GetPhysicalId#{resourceHash}"))) if dimensionsNames[index] == 'ServiceName'
|
128
128
|
dimensionValue = FnJoin('', [Ref("GetPhysicalId#{resourceHash}"),'-001']) if dimensionsNames[index] == 'CacheClusterId'
|
129
|
+
dimensionValue = FnSelect('4',FnSplit('/',Ref("GetPhysicalId#{resourceHash}"))) if dimensionsNames[index] == 'QueueName'
|
129
130
|
# Prepare conditions based on physical resource ID values
|
130
131
|
conditions << FnNot(FnEquals(Ref("GetPhysicalId#{resourceHash}"),'null'))
|
131
132
|
dimensions << { Name: dimensionsNames[index], Value: dimensionValue }
|
133
|
+
if params.key?('SecondaryDimensions')
|
134
|
+
params['SecondaryDimensions'].each do |secondaryDimension|
|
135
|
+
dimensions << secondaryDimension
|
136
|
+
end
|
137
|
+
end
|
132
138
|
end
|
133
139
|
params['Dimensions'] = dimensions
|
134
140
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cfn_monitor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Base2Services
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date: 2019-
|
13
|
+
date: 2019-06-20 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: thor
|
@@ -247,7 +247,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
247
247
|
- !ruby/object:Gem::Version
|
248
248
|
version: '0'
|
249
249
|
requirements: []
|
250
|
-
rubygems_version: 3.0.
|
250
|
+
rubygems_version: 3.0.4
|
251
251
|
signing_key:
|
252
252
|
specification_version: 4
|
253
253
|
summary: Configure and generate a cloudwatch monitoring cloudformation stack
|