AWSTemplateFormatVersion: 2010-09-09 Description: Creates an Amazon CloudWatch dashboard to monitor an Amazon FSx file system. Metadata: AWS::CloudFormation::Interface: ParameterGroups: - Label: default: File System Parameters Parameters: - FileSystemId - Label: default: Alarm Notification Parameters: - LowFreeDataStorageCapacityThreshold - EmailAddress ParameterLabels: EmailAddress: default: Email address FileSystemId: default: File system ID LowFreeDataStorageCapacityThreshold: default: Threshold Parameters: EmailAddress: Description: The email address for alarm notification. Type: String FileSystemId: AllowedPattern: ^(fs-)([a-z0-9]{17})$ Description: Amazon FSx file system ID Type: String LowFreeDataStorageCapacityThreshold: AllowedPattern: ^[0-9]+$ ConstraintDescription: Must be an integer. Default: 7000000000000 Description: Low free data storage capacity threshold (Bytes) Type: String Resources: Dashboard: Type: AWS::CloudWatch::Dashboard Properties: DashboardName: !Join [ '-', [ !Ref 'AWS::Region', !Ref FileSystemId ] ] DashboardBody: {"Fn::Join":["",['{ "widgets": [ { "type": "text", "x": 15, "y": 0, "width": 9, "height": 6, "properties": { "markdown": "\n# Amazon FSx file system: ',!Ref 'FileSystemId','\n## Region: ',!Ref 'AWS::Region','\n\nDashboard: [', !Join [ '_', [ !Ref 'AWS::Region', !Ref FileSystemId ] ],'](#dashboards:name=', !Join [ '_', [ !Ref 'AWS::Region', !Ref FileSystemId ] ],')\n\n![FSx_logo](https://s3.amazonaws.com/aws-us-east-1/amazon-fsx-tutorial/Amazon-FSx-for-Windows-File-Server.png)\n" } }, { "type": "metric", "x": 0, "y": 6, "width": 15, "height": 9, "properties": { "metrics": [ [ { "expression": "totaldatabytes/PERIOD(datareadbytes)", "label": "Total Data Throughput (B/s)", "id": "totaldatathroughput", "yAxis": "left", "color": "#2ca02c" } ], [ { "expression": "datawritebytes/PERIOD(datawritebytes)", "label": "Data Write Throughput (B/s)", "id": "datawritethroughput", "yAxis": "left", "color": "#1f77b4" } ], [ { "expression": "datareadbytes/PERIOD(datareadbytes)", "label": "Data Read Throughput (B/s)", "id": "datareadthroughput", "yAxis": "left", "color": "#ff7f0e" } ], [ { "expression": "datareadbytes+datawritebytes", "label": "TotalDataBytes", "id": "totaldatabytes", "visible": false } ], [ "AWS/FSx", "DataWriteBytes", "FileSystemId", "',!Ref 'FileSystemId','", { "stat": "Sum", "id": "datawritebytes", "yAxis": "right", "visible": false } ], [ ".", "DataReadBytes", ".", ".", { "stat": "Sum", "id": "datareadbytes", "yAxis": "right", "visible": false } ] ], "view": "timeSeries", "stacked": false, "region": "',!Ref 'AWS::Region','", "period": 60, "title": "Throughput (Bytes per second)", "legend": { "position": "right" }, "yAxis": { "left": { "showUnits": true }, "right": { "showUnits": false } }, "stat": "Average" } }, { "type": "metric", "x": 15, "y": 6, "width": 9, "height": 9, "properties": { "metrics": [ [ { "expression": "datawritebytes*100/(datawritebytes+datareadbytes)", "label": "Data Write (%)__", "id": "datawritepercent", "stat": "Sum", "color": "#1f77b4" } ], [ { "expression": "datareadbytes*100/(datawritebytes+datareadbytes)", "label": "Data Read (%)__", "id": "datareadpercent", "stat": "Sum", "color": "#ff7f0e" } ], [ "AWS/FSx", "DataWriteBytes", "FileSystemId", "',!Ref 'FileSystemId','", { "id": "datawritebytes", "visible": false } ], [ ".", "DataReadBytes", ".", ".", { "id": "datareadbytes", "visible": false } ] ], "view": "timeSeries", "region": "',!Ref 'AWS::Region','", "stacked": false, "title": "Percent Throughput (%)", "period": 60, "legend": { "position": "right" }, "stat": "Sum", "yAxis": { "left": { "showUnits": false }, "right": { "showUnits": false } } } }, { "type": "metric", "x": 0, "y": 15, "width": 15, "height": 9, "properties": { "metrics": [ [ { "expression": "(datawriteoperations+datareadoperations+metadataoperations)/PERIOD(metadataoperations)", "label": "Total Operations per second", "id": "totalops", "yAxis": "left", "color": "#2ca02c" } ], [ { "expression": "(datawriteoperations)/PERIOD(datawriteoperations)", "label": "Data Write Operations per second", "id": "datawriteops", "yAxis": "left", "color": "#1f77b4" } ], [ { "expression": "(datareadoperations)/PERIOD(datareadoperations)", "label": "Data Read Operations per second", "id": "datareadops", "yAxis": "left", "color": "#ff7f0e" } ], [ { "expression": "(metadataoperations)/PERIOD(metadataoperations)", "label": "Metadata Operations per second", "id": "metadataops", "yAxis": "left", "color": "#d62728" } ], [ "AWS/FSx", "DataWriteOperations", "FileSystemId", "',!Ref 'FileSystemId','", { "stat": "Sum", "id": "datawriteoperations", "visible": false } ], [ ".", "DataReadOperations", ".", ".", { "stat": "Sum", "id": "datareadoperations", "visible": false } ], [ ".", "MetadataOperations", ".", ".", { "stat": "Sum", "id": "metadataoperations", "visible": false } ] ], "view": "timeSeries", "stacked": false, "region": "',!Ref 'AWS::Region','", "period": 60, "title": "Operations per Second", "legend": { "position": "right" }, "yAxis": { "left": { "showUnits": false }, "right": { "showUnits": false } }, "stat": "Average" } }, { "type": "metric", "x": 15, "y": 15, "width": 9, "height": 9, "properties": { "metrics": [ [ { "expression": "datawriteoperations*100/totaloperations", "label": "Data Write (%)__", "id": "percentdatawriteoperations", "color": "#1f77b4" } ], [ { "expression": "datareadoperations*100/totaloperations", "label": "Data Read (%)__", "id": "percentdatareadoperations", "color": "#ff7f0e" } ], [ { "expression": "metadataoperations*100/totaloperations", "label": "Metadata (%)__", "id": "percentmetadataoperations", "color": "#d62728" } ], [ { "expression": "datawriteoperations+datareadoperations+metadataoperations", "label": "TotalOperations", "id": "totaloperations", "visible": false } ], [ "AWS/FSx", "DataWriteOperations", "FileSystemId", "',!Ref 'FileSystemId','", { "stat": "Sum", "id": "datawriteoperations", "visible": false } ], [ ".", "DataReadOperations", ".", ".", { "stat": "Sum", "id": "datareadoperations", "visible": false } ], [ ".", "MetadataOperations", ".", ".", { "stat": "Sum", "id": "metadataoperations", "visible": false } ] ], "view": "timeSeries", "region": "',!Ref 'AWS::Region','", "stacked": false, "title": "Percent Operations per Second (%)", "period": 60, "legend": { "position": "right" }, "stat": "Average", "yAxis": { "left": { "showUnits": false }, "right": { "showUnits": false } } } }, { "type": "metric", "x": 0, "y": 0, "width": 15, "height": 6, "properties": { "title": "Free Data Storage Capacity (Bytes)", "annotations": { "alarms": [ "arn:aws:cloudwatch:',!Ref 'AWS::Region',':',!Ref 'AWS::AccountId',':alarm:',!Join [ '', [ 'Low free storage capacity alarm - ', !Ref FileSystemId ] ],'" ] }, "view": "timeSeries", "stacked": false } } ] } ']]} SNSTopic: Type: AWS::SNS::Topic Properties: DisplayName: !Join [ '', [ !Ref FileSystemId, '-alarm-notification' ] ] Subscription: - Endpoint: !Ref EmailAddress Protocol: "email" TopicName: !Join [ '', [ !Ref FileSystemId, '-alarm-notification' ] ] LowFreeDataStorageCapacityAlarm: Type: AWS::CloudWatch::Alarm Properties: AlarmActions: - !Ref SNSTopic AlarmDescription: !Join [ '', [ 'Low free storage capacity alarm - ',!Ref FileSystemId ] ] AlarmName: !Join [ '', [ 'Low free storage capacity alarm - ',!Ref FileSystemId ] ] ComparisonOperator: LessThanThreshold Dimensions: - Name: FileSystemId Value: !Ref FileSystemId EvaluationPeriods: 1 MetricName: FreeDataStorageCapacity Namespace: AWS/FSx Period: 60 Statistic: Minimum Threshold: !Ref LowFreeDataStorageCapacityThreshold TreatMissingData: missing