It depends on which service provider you need to check:
- For AWS, please create alarm for your VM & refer to CloudWatch API
http://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/Welcome.html - For MS Azure, you can find useful information in the following
link https://azure.microsoft.com/en-us/documentation/articles/cloud-services-how-to-monitor/