Skip to content
This repository was archived by the owner on Nov 1, 2023. It is now read-only.

Commit 502a66e

Browse files
committed
Added VaultMemoryAlarms
Updated VaultMemoryAlarm "Namespace" to "System/Linux" Added 03_install_crontab to configsets Added IAM Policy "Actions": [ "cloudwatch:PutMetricData", "cloudwatch:GetMetricStatistics", "cloudwatch:ListMetrics"]
1 parent 40a0090 commit 502a66e

File tree

2 files changed

+28
-13
lines changed

2 files changed

+28
-13
lines changed

scripts/cloudwatch-monitoring.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*/5 * * * * sudo /usr/local/aws-scripts-mon/mon-put-instance-data.pl --mem-util --mem-used --from-cron

templates/quickstart-hashicorp-vault.template

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"AWSTemplateFormatVersion": "2010-09-09",
3-
"Description": "QS(0039) HashiCorp Consul License: Apache 2.0 (Please do not remove) Nov,14,2016",
3+
"Description": "QS(0039) HashiCorp Consul License: Apache 2.0 (Please do not remove) Nov,22,2016",
44
"Parameters": {
55
"KeyPair": {
66
"Description": "Name of an existing EC2 KeyPair to enable SSH access to the instances",
@@ -255,7 +255,7 @@
255255
}
256256
],
257257
"MetricName": "MemoryUtilization",
258-
"Namespace": "AWS/EC2",
258+
"Namespace": "System/Linux",
259259
"Statistic": "Average",
260260
"Period": "60",
261261
"EvaluationPeriods": "3",
@@ -281,7 +281,7 @@
281281
}
282282
],
283283
"MetricName": "MemoryUtilization",
284-
"Namespace": "AWS/EC2",
284+
"Namespace": "System/Linux",
285285
"Statistic": "Average",
286286
"Period": "60",
287287
"EvaluationPeriods": "3",
@@ -347,10 +347,23 @@
347347
"logs:CreateLogStream",
348348
"logs:PutLogEvents",
349349
"logs:DescribeLogStreams"
350+
350351
],
351352
"Resource": [
352353
"arn:aws:logs:*:*:*"
353354
]
355+
},
356+
{
357+
"Effect": "Allow",
358+
"Action": [
359+
"cloudwatch:PutMetricData",
360+
"cloudwatch:GetMetricStatistics",
361+
"cloudwatch:ListMetrics"
362+
363+
],
364+
"Resource": [
365+
"*"
366+
]
354367
}
355368
]
356369
}
@@ -392,10 +405,8 @@
392405
"/usr/local": "http://aws-cloudwatch.s3.amazonaws.com/downloads/CloudWatchMonitoringScripts-1.2.1.zip"
393406
},
394407
"files": {
395-
"/etc/cron.hourly/cloudwatch-monitoring": {
396-
"content": [
397-
"*/5 * * * * /usr/local/aws-scripts-mon/mon-put-instance-data.pl --mem-util --mem-used --from-cron"
398-
],
408+
"/etc/cron.hourly/cloudwatch-monitoring.sh": {
409+
"source": "https://s3.amazonaws.com/quickstart-reference/hashicorp/vault/latest/scripts/cloudwatch-monitoring.sh",
399410
"mode": "000700",
400411
"owner": "root",
401412
"group": "root"
@@ -422,6 +433,9 @@
422433
},
423434
"02_make_mon_put_instance_data_exececutable": {
424435
"command": "chmod +x /usr/local/aws-scripts-mon/mon-put-instance-data.pl"
436+
},
437+
"03_install_crontab": {
438+
"command": "crontab /etc/cron.hourly/cloudwatch-monitoring.sh"
425439
}
426440
}
427441
},
@@ -626,10 +640,8 @@
626640
"/usr/local": "http://aws-cloudwatch.s3.amazonaws.com/downloads/CloudWatchMonitoringScripts-1.2.1.zip"
627641
},
628642
"files": {
629-
"/etc/cron.hourly/cloudwatch-monitoring": {
630-
"content": [
631-
"*/5 * * * * /usr/local/aws-scripts-mon/mon-put-instance-data.pl --mem-util --mem-used --from-cron"
632-
],
643+
"/etc/cron.hourly/cloudwatch-monitoring.sh": {
644+
"source": "https://s3.amazonaws.com/quickstart-reference/hashicorp/vault/latest/scripts/cloudwatch-monitoring.sh",
633645
"mode": "000700",
634646
"owner": "root",
635647
"group": "root"
@@ -656,6 +668,9 @@
656668
},
657669
"02_make_mon_put_instance_data_exececutable": {
658670
"command": "chmod +x /usr/local/aws-scripts-mon/mon-put-instance-data.pl"
671+
},
672+
"03_install_crontab": {
673+
"command": "crontab /etc/cron.hourly/cloudwatch-monitoring.sh"
659674
}
660675
}
661676
},
@@ -674,8 +689,7 @@
674689
"source": "https://s3.amazonaws.com/quickstart-reference/hashicorp/vault/latest/scripts/vault-upstart.conf",
675690
"mode": "000700",
676691
"owner": "root",
677-
"group": "root",
678-
"command": "echo 'export VAULT_ADDR=http://127.0.0.1:8200' > /etc/profile.d/vault.sh"
692+
"group": "root"
679693
}
680694
},
681695
"commands": {

0 commit comments

Comments
 (0)