The following warnings occurred:
Warning [2] Undefined array key "extra" - Line: 100 - File: inc/plugins/google_seo/url.php PHP 8.3.36 (Linux)
File Line Function
/inc/class_error.php 157 errorHandler->error
/inc/plugins/google_seo/url.php 100 errorHandler->error_callback
/inc/plugins/google_seo.php 317 require_once
/inc/class_plugins.php 38 require_once
/inc/init.php 263 pluginSystem->load
/global.php 20 require_once
/showthread.php 28 require_once
Warning [2] Undefined array key "google_seo_thread" - Line: 1128 - File: inc/plugins/google_seo/url.php PHP 8.3.36 (Linux)
File Line Function
/inc/class_error.php 157 errorHandler->error
/inc/plugins/google_seo/url.php 1128 errorHandler->error_callback
/inc/plugins/google_seo/url.php 174 google_seo_url_hook
/inc/plugins/google_seo.php 317 require_once
/inc/class_plugins.php 38 require_once
/inc/init.php 263 pluginSystem->load
/global.php 20 require_once
/showthread.php 28 require_once
Warning [2] Undefined array key 1 - Line: 261 - File: inc/plugins/google_seo.php PHP 8.3.36 (Linux)
File Line Function
/inc/class_error.php 157 errorHandler->error
/inc/plugins/google_seo.php 261 errorHandler->error_callback
/inc/plugins/google_seo/url.php 1080 google_seo_dynamic
/inc/plugins/google_seo/url.php 1128 google_seo_url_dynamic
/inc/plugins/google_seo/url.php 174 google_seo_url_hook
/inc/plugins/google_seo.php 317 require_once
/inc/class_plugins.php 38 require_once
/inc/init.php 263 pluginSystem->load
/global.php 20 require_once
/showthread.php 28 require_once
Warning [2] Undefined array key "parent" - Line: 447 - File: inc/plugins/google_seo/url.php PHP 8.3.36 (Linux)
File Line Function
/inc/class_error.php 157 errorHandler->error
/inc/plugins/google_seo/url.php 447 errorHandler->error_callback
/inc/plugins/google_seo/url.php 1144 google_seo_url_create
/inc/plugins/google_seo/url.php 174 google_seo_url_hook
/inc/plugins/google_seo.php 317 require_once
/inc/class_plugins.php 38 require_once
/inc/init.php 263 pluginSystem->load
/global.php 20 require_once
/showthread.php 28 require_once
Warning [2] Undefined variable $location - Line: 1250 - File: inc/plugins/google_seo/url.php PHP 8.3.36 (Linux)
File Line Function
/inc/class_error.php 157 errorHandler->error
/inc/plugins/google_seo/url.php 1250 errorHandler->error_callback
/inc/plugins/google_seo/url.php 174 google_seo_url_hook
/inc/plugins/google_seo.php 317 require_once
/inc/class_plugins.php 38 require_once
/inc/init.php 263 pluginSystem->load
/global.php 20 require_once
/showthread.php 28 require_once
Warning [2] Trying to access array offset on null - Line: 198 - File: inc/plugins/google_seo.php PHP 8.3.36 (Linux)
File Line Function
/inc/class_error.php 157 errorHandler->error
/inc/plugins/google_seo.php 198 errorHandler->error_callback
/inc/plugins/google_seo/redirect.php 131 google_seo_tid
/inc/class_plugins.php 142 google_seo_redirect_hook
/global.php 100 pluginSystem->run_hooks
/showthread.php 28 require_once
Warning [2] Undefined array key "oa_social_login_custom_caption" - Line: 356 - File: inc/plugins/oa_social_login.php PHP 8.3.36 (Linux)
File Line Function
/inc/class_error.php 157 errorHandler->error
/inc/plugins/oa_social_login.php 356 errorHandler->error_callback
/inc/plugins/oa_social_login.php 197 oa_social_login_load_plugin
/inc/class_plugins.php 142 oa_social_login_load_plugin_hook_any
/global.php 498 pluginSystem->run_hooks
/showthread.php 28 require_once
Warning [2] Undefined variable $unreadreports - Line: 44 - File: global.php(961) : eval()'d code PHP 8.3.36 (Linux)
File Line Function
/inc/class_error.php 157 errorHandler->error
/global.php(961) : eval()'d code 44 errorHandler->error_callback
/global.php 961 eval
/showthread.php 28 require_once




Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
AWS Cloudwatch Dashboard
#1
I've a requirement where in i'm trying to create clouldwatch dashboard for my service,I've nearly 20 servers for which i wish to create dashboard with multiple widget.

each widget would contain 'CPUUtilization' martix for all 20 server,other widget would contain ' DiskReadOps' matrics for all 20 servers and so on.

In short 

one dashboard would contain multipe widget and one widget would contain matrix from multiple servers

I wish to write cloudformation script for the same in yaml format as i'm using yaml for other stuffs,i tried to refer docs but dint get much about my requirement


Any help on this will be appreciated.

Thanks,
Subham
Reply
#2
(19-02-2019, 12:46 PM)subham Wrote: I've a requirement where in i'm trying to create clouldwatch dashboard for my service,I've nearly 20 servers for which i wish to create dashboard with multiple widget.

I wish to write cloudformation script for the same in yaml format as i'm using yaml for other stuffs,i tried to refer docs but dint get much about my requirement

Hello Subham,

Below is a sample template you can use for this. This template creates 2 widgets inside a single dashbaord with each widget having 2 resources in it. One widget shows the CPU utilization of 2 instances and the other widget shows the Volume Read Ops of 2 EBS volumes. To add more resources, just replicate the metrics section as many times as you desire. You can of course add resource references to automatically pick up instance ids and volume ids if you wish to.


Code:
AWSTemplateFormatVersion: '2010-09-09'
Description: AWS CloudFormation Template Auto Dashboard Creation
Resources:
 DashboardSideBySide:
   Type: AWS::CloudWatch::Dashboard
   Properties:
     DashboardName: EC2-EBS-Metrics
     DashboardBody: '{
                       "widgets":[
                         {
                           "type":"metric",
                           "x":0,
                           "y":0,
                           "width":12,
                           "height":6,
                           "properties":{
                               "metrics":[
                                 [
                                   "AWS/EC2",
                                   "CPUUtilization",
                                   "InstanceId",
                                   "i-xxxxxxxxxxxxx"
                                 ],
                                 [
                                   "AWS/EC2",
                                   "CPUUtilization",
                                   "InstanceId",
                                   "i-xxxxxxxxxxxxx"
                                 ]
                               ],
                               "period":300,
                               "stat":"Average",
                               "region":"us-east-1",
                               "title":"EC2 Instances CPU"
                           }
                         },
                         {
                           "type":"metric",
                           "x":0,
                           "y":0,
                           "width":12,
                           "height":6,
                           "properties":{
                               "metrics":[
                                 [
                                   "AWS/EBS",
                                   "VolumeReadOps",
                                   "VolumeId",
                                   "vol-xxxxxxxxxxxxx"
                                 ],
                                 [
                                   "AWS/EBS",
                                   "VolumeReadOps",
                                   "VolumeId",
                                   "vol-xxxxxxxxxxxxx"
                                 ]
                               ],
                               "period":300,
                               "stat":"Average",
                               "region":"us-east-1",
                               "title":"EBS Volume Read Ops"
                           }
                         }
                       ]
                     }'
Reply
#3
Thanks ..It was a great help.
Reply
#4
(20-02-2019, 06:16 AM)subham Wrote: Thanks ..It was a great help.

You're welcome.

Here is the upgraded version of the template that allows you to use variables input by user into the template using "Ref" with "Fn::Join"

Code:
JSON

{
   "AWSTemplateFormatVersion": "2010-09-09",
   "Description": "AWS CloudFormation Template Auto Dashboard Creation",
   "Metadata" : {"Created By": "Faizal Khan @ Ecomm India Cloud IT"},
   "Parameters": {
       "Server1CPU": {
           "Description": "What is the instance id of Server 1 for CPU Utilization?",
           "Type": "String"
       },
       "Server2CPU": {
           "Description": "What is the instance id of Server 2 for CPU Utilization?",
           "Type": "String"
       },
       "EBS1Disk": {
           "Description": "What is the volume id of Disk 1 for Volume Read Ops?",
           "Type": "String"
       },
       "EBS2Disk": {
           "Description": "What is the volume id of Disk 2 for Volume Read Ops?",
           "Type": "String"
       }
   },
   "Resources": {
       "AutomatedDashboard": {
           "Type": "AWS::CloudWatch::Dashboard",
           "Properties": {
               "DashboardName": "Dashboard-Multiple-EC2-EBS-Metrics",
               "DashboardBody": {
                   "Fn::Join": [
                       "",
                       [
                           "{\"widgets\":[{\"type\":\"metric\",\"x\":0,\"y\":0,\"width\":12,\"height\":6,\"properties\":{\"metrics\":[[\"AWS/EC2\",\"CPUUtilization\",\"InstanceId\",\"",
                           {
                               "Ref": "Server1CPU"
                           },
                           "\"],[\".\",\".\",\".\",\"",
                           {
                               "Ref": "Server2CPU"
                           },
                           "\"]],\"period\":300,\"stat\":\"Average\",\"region\":\"us-east-1\",\"title\":\"EC2 Instances CPU Utilization\"}},{\"type\":\"metric\",\"x\":12,\"y\":0,\"width\":12,\"height\":6,\"properties\":{\"metrics\":[[\"AWS/EBS\",\"VolumeReadOps\",\"VolumeId\",\"",
                           {
                               "Ref": "EBS1Disk"
                           },
                           "\"],[\".\",\".\",\".\",\"",
                           {
                               "Ref": "EBS2Disk"
                           },
                           "\"]],\"period\":300,\"stat\":\"Average\",\"region\":\"us-east-1\",\"title\":\"EBS Volumes ReadOps\"}}]}"
                       ]
                   ]
               }
           }
       }
   }
}





YAML

AWSTemplateFormatVersion: 2010-09-09
Description: AWS CloudFormation Template Auto Dashboard Creation
Metadata:
  Created By: Faizal Khan @ Ecomm India Cloud IT
Parameters:
  Server1CPU:
    Description: What is the instance id of Server 1 for CPU Utilization?
    Type: String
  Server2CPU:
    Description: What is the instance id of Server 2 for CPU Utilization?
    Type: String
  EBS1Disk:
    Description: What is the volume id of Disk 1 for Volume Read Ops?
    Type: String
  EBS2Disk:
    Description: What is the volume id of Disk 2 for Volume Read Ops?
    Type: String
Resources:
  AutomatedDashboard:
    Type: 'AWS::CloudWatch::Dashboard'
    Properties:
      DashboardName: Dashboard-Multiple-EC2-EBS-Metrics
      DashboardBody: !Join
        - ''
        - - >-
            {"widgets":[{"type":"metric","x":0,"y":0,"width":12,"height":6,"properties":{"metrics":[["AWS/EC2","CPUUtilization","InstanceId","
          - !Ref Server1CPU
          - '"],[".",".",".","'
          - !Ref Server2CPU
          - >-
            "]],"period":300,"stat":"Average","region":"us-east-1","title":"EC2
            Instances CPU
            Utilization"}},{"type":"metric","x":12,"y":0,"width":12,"height":6,"properties":{"metrics":[["AWS/EBS","VolumeReadOps","VolumeId","
          - !Ref EBS1Disk
          - '"],[".",".",".","'
          - !Ref EBS2Disk
          - >-
            "]],"period":300,"stat":"Average","region":"us-east-1","title":"EBS
            Volumes ReadOps"}}]}
Reply
#5
Thanks for the above...Below is what i've tried something similar and get this working..Posting it here

Code:
AWSTemplateFormatVersion: '2010-09-09'
Description: AWS CloudFormation Template  Dashboard Creation
Resources:
CloudwatchDashboard:
 Type: AWS::CloudWatch::Dashboard
 Properties:
   DashboardName: EC2-Sample-Dashboard
   DashboardBody: { "Fn::Join": [ "", ['{
                     "widgets":[
                       {
                         "type":"metric",
                         "x":0,
                         "y":0,
                         "width":12,
                         "height":6,                              
                         "properties":{
                             "metrics":[
                               [ "AWS/EC2", "CPUUtilization", "InstanceId", "', { Ref: Ec2Instance1 }, '" ],
                               [ "AWS/EC2", "CPUUtilization", "InstanceId", "', { Ref: Ec2Instance2 }, '" ]
                             ],
                             "period":300,
                             "stat":"Average",
                             "region":"us-east-1",
                             "title":"EC2 Instances CPU Details"
                         }
                       },
                       {
                         "type":"metric",
                         "x":0,
                         "y":0,
                         "width":12,
                         "height":6,
                         "properties":{
                             "metrics":[
                               [ "AWS/EBS", "VolumeReadOps", "VolumeId", "vol-0e7060d9" ],
                               [ "AWS/EBS", "VolumeReadOps", "VolumeId", "vol-023c57f" ]
                             ],
                             "period":300,
                             "stat":"Average",
                             "region":"us-east-1",
                             "title":"EBS Details"
                         }
                       },
                       {
                         "type":"metric",
                         "x":0,
                         "y":0,
                         "width":12,
                         "height":6,
                         "properties":{
                             "metrics":[
                               [ "AWS/S3", "BucketSizeBytes", "BucketName", "bucket1" ],
                               [ "AWS/S3", "BucketSizeBytes", "BucketName", "bucket2" ]
                             ],
                             "period":300,
                             "stat":"Average",
                             "region":"us-east-1",
                             "title":"S3 Buckets Details"
                         }
                       },
                       {
                         "type":"metric",
                         "x":0,
                         "y":0,
                         "width":12,
                         "height":6,
                         "properties":{
                             "metrics":[
                               [ "AWS/EFS", "PermittedThroughput", "FileSystemId", "fs-f29a1" ],
                               [ "AWS/EFS", "PermittedThroughput", "FileSystemId", "fs-db382" ]
                             ],
                             "period":300,
                             "stat":"Average",
                             "region":"us-east-1",
                             "title":"EFS Details"
                         }
                       },
                       {
                         "type":"metric",
                         "x":0,
                         "y":0,
                         "width":12,
                         "height":6,
                         "properties":{
                             "metrics":[
                               [ "AWS/EC2", "DiskReadOps", "InstanceId", "', { Ref: Ec2Instance1 }, '" ],
                               [ "AWS/EC2", "DiskReadOps", "InstanceId", "', { Ref: Ec2Instance2 }, '" ]
                             ],
                             "period":300,
                             "stat":"Average",
                             "region":"us-east-1",
                             "title":"EC2 Disk Readops Details"
                         }
                       }
                     ]
                   }'
                   ] ]  }
                 
Ec2Instance1:
  Type: AWS::EC2::Instance
  Properties:
    ImageId: ami-04a5ff1d83d13aa06
    InstanceType: t2.micro
    AvailabilityZone: ap-southeast-1a
Ec2Instance2:
  Type: AWS::EC2::Instance
  Properties:
    ImageId: ami-04a5ff1d83d13aa06
    InstanceType: t2.micro
    AvailabilityZone: ap-southeast-1a
Reply
#6
Thanks for sharing the informative concept and coding above. I also learn AWS I know something which I used to get started with CloudWatch dashboards, you must first create a dashboard. You can create multiple dashboards. There is no limit on the number of CloudWatch dashboards in your AWS account. All dashboards are global, not Region-specific.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)