This repository has been archived by the owner on Mar 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tfhartmann/plat 2103 send ecs cluster data to cloudwatch (#2)
* Adding Script to send metrics into cloudwatch * Update to ECS Cluster Service to add a job to send metrics to cloudwatch * Updated command Included timestamp * Added Unit and more Dimensions * Adding instance ID * Adding some logging Also changing up what the metric is by removing dimensions * Change to count registered instances * comment out unused var Since we aren't using that var at the moment, I commented it out, this should also make the runtime faster * Adding CODEOWNERS File * Oh... I'm going to feel so dumb. * Adding back ContainerInstancesCount
- Loading branch information
1 parent
9893f60
commit 71e3ab6
Showing
3 changed files
with
65 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# This is a comment. | ||
# Each line is a file pattern followed by one or more owners. | ||
|
||
# These owners will be the default owners for everything in | ||
# the repo. Unless a later match takes precedence, | ||
# @global-owner1 and @global-owner2 will be requested for | ||
# review when someone opens a pull request. | ||
#* @global-owner1 @global-owner2 | ||
* @FitnessKeeper/devops | ||
|
||
# Order is important; the last matching pattern takes the most | ||
# precedence. When someone opens a pull request that only | ||
# modifies JS files, only @js-owner and not the global | ||
# owner(s) will be requested for a review. | ||
#*.js @js-owner | ||
|
||
# You can also use email addresses if you prefer. They'll be | ||
# used to look up users just like we do for commit author | ||
# emails. | ||
#*.go [email protected] | ||
|
||
# In this example, @doctocat owns any files in the build/logs | ||
# directory at the root of the repository and any of its | ||
# subdirectories. | ||
#/build/logs/ @doctocat | ||
|
||
# The `docs/*` pattern will match files like | ||
# `docs/getting-started.md` but not further nested files like | ||
# `docs/build-app/troubleshooting.md`. | ||
#docs/* [email protected] | ||
|
||
# In this example, @octocat owns any file in an apps directory | ||
# anywhere in your repository. | ||
#apps/ @octocat | ||
|
||
# In this example, @doctocat owns any file in the `/docs` | ||
# directory in the root of your repository. | ||
#/docs/ @doctocat |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
#Usage: | ||
# Push metrics into cloudwatch | ||
|
||
#./ecs-cloudwatch-metric.sh | ||
# | ||
|
||
REGION=$(curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone/ | sed 's/.$//') | ||
ECS_CLUSTER=$(curl -s http://localhost:51678/v1/metadata | jq -r .Cluster) | ||
#ID=$(curl -s http://169.254.169.254/latest/meta-data/instance-id) | ||
CONTAINERINSTANCES=$(aws --region ${REGION} ecs describe-clusters --clusters ${ECS_CLUSTER} | jq .clusters[0].registeredContainerInstancesCount) | ||
TIMESTAMP=$(date -u +"%Y-%m-%dT%H:%M:%SZ") | ||
|
||
aws --region ${REGION} cloudwatch put-metric-data --metric-name ContainerInstancesCount --namespace /AWS/ECS --dimensions Cluster=${ECS_CLUSTER} --unit Count --value 1 --timestamp ${TIMESTAMP} | ||
aws --region ${REGION} cloudwatch put-metric-data --metric-name registeredContainerInstances --namespace /AWS/ECS --dimensions Cluster=${ECS_CLUSTER} --unit Count --value ${CONTAINERINSTANCES} --timestamp ${TIMESTAMP} | ||
exit 0 |