diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8c30c99..9ddce70 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -26,4 +26,4 @@ repos: rev: v1.1.0 hooks: - id: j2lint -# args: [--ignore, S3, V1, --] + args: [--ignore, V1, --] diff --git a/config/agoradev/develop/agora-dashboard.yaml b/config/agoradev/develop/agora-dashboard.yaml new file mode 100644 index 0000000..0d61cc3 --- /dev/null +++ b/config/agoradev/develop/agora-dashboard.yaml @@ -0,0 +1,9 @@ +template: + path: cw-dashboard.j2 +stack_name: agora-develop-dashboard +stack_tags: + Environment: "develop" +dependencies: + - agoradev/develop/agora.yaml +sceptre_user_data: + BeanstalkEnvironmentName: "agora-develop" diff --git a/config/agoraprod/prod/agora-dashboard.yaml b/config/agoraprod/prod/agora-dashboard.yaml new file mode 100644 index 0000000..a90b3cf --- /dev/null +++ b/config/agoraprod/prod/agora-dashboard.yaml @@ -0,0 +1,9 @@ +template: + path: cw-dashboard.j2 +stack_name: agora-staging-dashboard +stack_tags: + Environment: "prod" +dependencies: + - agoraprod/prod/agora.yaml +sceptre_user_data: + BeanstalkEnvironmentName: "agora-prod" diff --git a/config/agoraprod/staging/agora-dashboard.yaml b/config/agoraprod/staging/agora-dashboard.yaml new file mode 100644 index 0000000..f13996e --- /dev/null +++ b/config/agoraprod/staging/agora-dashboard.yaml @@ -0,0 +1,9 @@ +template: + path: cw-dashboard.j2 +stack_name: agora-staging-dashboard +stack_tags: + Environment: "staging" +dependencies: + - agoraprod/staging/agora.yaml +sceptre_user_data: + BeanstalkEnvironmentName: "agora-staging" diff --git a/templates/cw-dashboard.j2 b/templates/cw-dashboard.j2 new file mode 100644 index 0000000..fc50ca9 --- /dev/null +++ b/templates/cw-dashboard.j2 @@ -0,0 +1,71 @@ +AWSTemplateFormatVersion: 2010-09-09 +Description: Cloudwatch Dashboards +Resources: + Dashboard: + Type: AWS::CloudWatch::Dashboard + Properties: + DashboardName: {{ sceptre_user_data.BeanstalkEnvironmentName }} + DashboardBody: > + { + "widgets": [ + { + "type": "metric", + "width": 20, + "height": 6, + "properties": { + "metrics": [ + [ + "AWS/ElasticBeanstalk", + "EnvironmentHealth", + "EnvironmentName", + "{{ sceptre_user_data.BeanstalkEnvironmentName }}", + { + "period": 300, + "stat": "Average", + "region": "us-east-1" + } + ] + ], + "legend": { + "position": "bottom" + }, + "region": "us-east-1", + "liveData": false, + "title": "EnvironmentHealth: Average", + "view": "timeSeries", + "stacked": false + } + }, + { + "type": "metric", + "properties": { + "metrics": [ + [ + "AWS/ElasticBeanstalk", + "ApplicationRequests2xx", + "EnvironmentName", + "{{ sceptre_user_data.BeanstalkEnvironmentName }}", + { + "period": 300, + "stat": "Average", + "region": "us-east-1" + } + ] + ], + "legend": { + "position": "bottom" + }, + "region": "us-east-1", + "liveData": false, + "title": "ApplicationRequests2xx: Average", + "view": "timeSeries", + "stacked": false + } + } + ] + } +Outputs: + Dashboard: + Value: !Ref Dashboard + Export: + Name: !Sub '${AWS::Region}-${AWS::StackName}-Dashboard'