Problem Description:

Infoworks services are being shut down automatically due to insufficient disk space, you would like to be alerted via cloudwatch on the available disk space or other OS metrics from the AWS EC2 instance that hosts Infoworks. 


We can create a custom script and use AWS CLI to push the custom metrics to CloudWatch and the setup alerting based on metric value. 

Step 1: 

SSH into the EC2 instance where Infoworks platform is hosted. Ensure you have AWS CLI installed and the CLI profile has enough permissions to push metrics to cloudwatch. 

Step 2: 

Create a script called with below content,

Disk_Usage=$(df -H /dev/sda1 | awk 'NR==2{ print $5 }' |  cut -d'%' -f1)
aws cloudwatch put-metric-data --metric-name disk-usage --dimensions Instance=i-0c51f9f1213e63159  --namespace "Custom" --value $Disk_Usage

Step 3: 

Make the script executable. 

chmod +x

Step 4: 

Push your metric to Cloudwatch every 1 min using crontab.

Open Crontab 

crontab -e

Paste below content to push metric to cloudwatch every 1 min

*/1 * * * * /home/ec2-user/

Step 5 : 

Open Cloudwatch from AWS console and navigate to 'Custom' metrics and filter by instance ID to view Disk_Usage Metric.

Applicable Infoworks Versions: