Get disk_used_percent metrics for specific PATH with CloudWatch Agent

Viewed 1903
{
  "agent": {
    "run_as_user": "root"
  },
  "metrics": {
      "disk": {
        "measurement": [
          "used_percent"
        ],
        "metrics_collection_interval": 60,
        "resources": [
          "/media/mysql-data","/","/tmp", "/usr", "/media"
        ]
      }
    }
  }
}

results in only enter image description here

I haven't found any examples of folks including a specific path in the resources section of a amazon-cloudwatch-agent/bin/config.json file to monitor the disk_used_percent. When I specify only one specific path, like /media/mysql-data and put files in it, or if I make /media/mysql-data be a file, no disk_used_percent metrics appear in CloudWatch. The only one that appears is /.

I'm trying to convert our use of the old monitoring scripts to the CloudWatch Agent configuration file, in particular, the options --disk-space-util --disk-path=/media/mysql-data

The documentation for that option says:

--disk-path=PATH Selects the disk on which to report.

PATH can specify a mount point or any file located on a mount point for the filesystem that needs to be reported. For selecting multiple disks, specify a --disk-path=PATH for each one of them.

To select a disk for the filesystems mounted on / and /home, use the following parameters:

--disk-path=/ --disk-path=/home

1 Answers

I got the answer from AWS Support. As it says in the docs,

disk – Optional. Specifies that disk metrics are to be collected. This section is valid only for Linux instances. This section can include as many as two fields:

resources – Optional. Specifies an array of disk mount points. This field limits CloudWatch to collect metrics from only the listed mount points. You can specify * as the value to collect metrics from all mount points. The default value is to collect metrics from all mount points.

In other words, the path specified must be a mount point for this to work. So to see all the paths available to be monitored, I can just run lsblk.

Related