r/aws•
JRRS

Cloudwatch monitor disk space on EBS volume attached to windows instance.

technical question

Hi everybody.

It maybe has been asked a ton of times but I cannot get my head around it, nor stup a proper CLoudwatch alarm for it. I have a windows EC2 instance with a database on it, the E: drive is a 300gb EBS volume attached to the instance used as TempDB and we had recently transaction issues because this E: was full.

I need to setup a cloudwatch alarm for the E: drive for a threshold of 10 minutes with >=80% usage. I cannot move the database system to RDS. I've followed these guides:

https://www.reddit.com/r/aws/comments/b13281/cloudwatch_alarm_for_disk_space_for_windows/ https://www.youtube.com/watch?v=xKVrJJyG-4I&t=55s https://volkanpaksoy.com/archive/2018/12/19/Monitoring-EC2-Instance-Disk-Space-with-AWS-CloudWatch/

I have setup perfect monitoring for C: but I cannot setup E: Almost all documentation that I stumble upon is for Linux instances with mountpoints and perl scripts. Hope you guys could give some guidance.

Posted Oct 6, 2020, 5:30 PM UTC

22
maxlan•

Stackoverflow answer: https://stackoverflow.com/questions/37441225/how-to-monitor-free-disk-space-at-aws-ec2-with-cloud-watch-in-windows

{ "Id": "PerformanceCounterDisk", "FullName": "AWS.EC2.Windows.CloudWatch.PerformanceCounterComponent.PerformanceCounterInputComponent,AWS.EC2.Windows.CloudWatch", "Parameters": { "CategoryName": "LogicalDisk", "CounterName": "% Free Space", "InstanceName": "C:", "MetricName": "FreeDiskPercentage", "Unit": "Percent", "DimensionName": "InstanceId", "DimensionValue": "{instance_id}" } }

Change c: to e:

1
JRRSOP•

Already did that, was my first guess. My AWS.EC2.Windows.CloudWatch.json file has:

 "FullName": "AWS.EC2.Windows.CloudWatch.PerformanceCounterComponent.PerformanceCounterInputComponent,AWS.EC2.Windows.CloudWatch",
    "Id": "PerformanceCounterDisk",
    "Parameters": {
      "CategoryName": "LogicalDisk",
      "CounterName": "% Free Space",
      "DimensionName": "InstanceId",
      "DimensionValue": "{instance_id}",
      "InstanceName": "C:",
      "MetricName": "FreeDiskPercentage",
      "Unit": "Percent"
    }
  },
     {
    "FullName": "AWS.EC2.Windows.CloudWatch.PerformanceCounterComponent.PerformanceCounterInputComponent,AWS.EC2.Windows.CloudWatch",
    "Id": "PerformanceCounterDiskTempDB",
    "Parameters": {
      "CategoryName": "LogicalDisk",
      "CounterName": "% Free Space",
      "DimensionName": "InstanceId",
      "DimensionValue": "{instance_id}",
      "InstanceName": "E:",
      "MetricName": "FreeDiskPercentage",
      "Unit": "Percent"
    }
  }

WIth the addition of the flows:

   "Flows": {
  "Flows": [
    ....
    "(ApplicationEventLog,SystemEventLog),CloudWatchLogs",
    "(PerformanceCounterDisk, PerformanceCounterDiskTempDB),CloudWatch"
  ]

I have monitors and alerts on C: but nothing on E. I go to cloudwatch and check alarms and I have insufficient data points.

NonRootUsage NonRootUsage > 85 for 2 datapoints within 10 minutes

1