I want to use aws-sdk to monitor the activity arround an AWS account and return it's object consumption. How should I start?
Activity and consumption metrics can be monitored using Cloudwatch.
var cloudwatch = new AWS.CloudWatch();
var params = {
Dimensions: [
{
Name: 'STRING_VALUE', /* required */
Value: 'STRING_VALUE'
},
/* more items */
],
MetricName: 'STRING_VALUE',
Namespace: 'STRING_VALUE',
NextToken: 'STRING_VALUE'
};
cloudwatch.getMetricWidgetImage(params, function (err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
cloudwatch.listMetrics(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/CloudWatch.html#listMetrics-property
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.