Skip to content

Instantly share code, notes, and snippets.

@LewisMcMahon
Created July 10, 2015 13:10
Show Gist options
  • Save LewisMcMahon/88c0cc9ca1d04fb9d531 to your computer and use it in GitHub Desktop.
Save LewisMcMahon/88c0cc9ca1d04fb9d531 to your computer and use it in GitHub Desktop.
AWS Cloudwatch metric for Ubuntu security updates available
aws cloudwatch put-metric-data --metric-name "Security Updates Available" --dimensions InstanceId=$(ec2metadata --instance-id) --namespace "EC2" --value $(/usr/lib/update-notifier/apt-check 2>&1 | cut -d ';' -f 2)
@LewisMcMahon
Copy link
Author

requires cloud-utils and aws cli

for all updates not just security ones change "cut -d ';' -f 2" to "cut -d ';' -f 1"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment