Skip to content

Instantly share code, notes, and snippets.

@LewisMcMahon
Last active July 25, 2018 05:22
Show Gist options
  • Save LewisMcMahon/3d4612201159a4a42d43 to your computer and use it in GitHub Desktop.
Save LewisMcMahon/3d4612201159a4a42d43 to your computer and use it in GitHub Desktop.
AWS Cloudwatch metric for postfix queue length
aws cloudwatch put-metric-data --metric-name "Mail Queue" --dimensions InstanceId=$(ec2metadata --instance-id) --namespace "EC2" --value $(echo $(($(mailq | grep -Po "(?<=in )([0-9]+)"| paste -sd+ | bc)+0)))
@LewisMcMahon
Copy link
Author

requires cloud-utils and aws cli

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