javascript - AWS Cloudwatch get names of alarms -


i have javascript , i'm trying print names of alarms in aws cloudwatch, i.e. "jeisld-k-wialckei33k-high-cpu-utilization, ajikh-q-m98k145k-high-disk-writes" etc.

my code:

//configure aws region/securities  var cw = new aws.cloudwatch(); var alarms = cw.describealarms(); (var = 0; < alarms.length; ++) {     console.log(alarms[i]); 

however doesn't print @ all. correct way names of alarms?

edit: console.log(alarms) prints [object object]

try

aws cloudwatch docs

var cloudwatch = new aws.cloudwatch(); cloudwatch.deletealarms(params, function (err, data) {   if (err) console.log(err, err.stack); // error occurred   else     showalarms(data);           // successful response });  function showalarms(data){   (var i=0; i<data.metricalarms.length; i++){     console.log(data.metricalarms[i]. alarmname);   } } 

if doesn't work, can loop through object see how structured, might give sense of working with.

function showalarms(data){   (var item in data) {     console.log(item);     (var sub in item) {       console.log('>:'sub);     }   } } 

Comments

Popular posts from this blog

javascript - three.js lot of meshes optimization -

smartface.io - Proper way to change color scheme for whole application -

Email notification in google apps script -