thechaos
Enthusiast
Enthusiast

Howto get action's from an alarm with vCO

Jump to solution

Hi,

quick question, how can i retrieve the action information from an alarm which has been retrieved with something like this:

AllAlarms = AllSdkConnection[cc].alarmManager.getAlarm();

for (var ac in AllAlarms) {

          ....

}

Any ideas,

TIA

     Thomas

0 Kudos
1 Solution

Accepted Solutions
tschoergez
Leadership
Leadership

aaaand, here we go:

Onyx & MOB hand in hand should give you the idea....

vcalarms.png

and yes, the object model for the alarms seems quite messy :smileyconfused:.

Cheers,

Joerg

View solution in original post

0 Kudos
5 Replies
cdecanini_
VMware Employee
VMware Employee

Please check if this helps you: http://www.vcoteam.info/learn-vco/code-snippets-get-vms-that-triggered-vcenter-alarms.html

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vCenter Orchestrator tips and tutorials - @vCOTeam on Twitter
thechaos
Enthusiast
Enthusiast

Hi,

hmm, found not really the answer. For me the question ist for example, is an snmp action configured if this alarm gets triggered, or is an SMTP action configured, and which is the configured E-Mail.

Regards

     Thomas

0 Kudos
tschoergez
Leadership
Leadership

my approach to such things:

Change the action, and watch with Onyx which attributes are touched....

and: use the managed object browser to click through your actual vCenter inventory...

http://www.vcoportal.de/2012/05/using-onyx-for-fast-workflow-development/

http://www.virtuallyghetto.com/2010/07/whats-new-in-vsphere-41-mob.html

Cheers,

Joerg

0 Kudos
tschoergez
Leadership
Leadership

aaaand, here we go:

Onyx & MOB hand in hand should give you the idea....

vcalarms.png

and yes, the object model for the alarms seems quite messy :smileyconfused:.

Cheers,

Joerg

0 Kudos
thechaos
Enthusiast
Enthusiast

Hi,

yup this is the same i found with a different approach. Wrote a small function which did a recursive dump of an alarm, and based on this my solution is:

             if (MyAlarm.info.action) {
                    // VcAlarm.info(VcAlarmInfo).action(VcAlarmAction).array[VcAlarmTriggeringAction].VcSendEmailAction|VcSendSNMPAction
                    for (var i in MyAlarm.info.action.action) {
                        try {
                            if (MyAlarm.info.action.action[i].action instanceof VcSendEmailAction ) {
                                System.debug("VcSendEmailAction configured");
                                System.debug("\ttoList "+MyAlarm.info.action.action[i].action.toList);
                                System.debug("\tsubject "+MyAlarm.info.action.action[i].action.subject);
                            } else if (MyAlarm.info.action.action[i].action instanceof VcSendSNMPAction) {
                                System.debug("VcSendSNMPAction configured");
                            }
                        } catch(ex) {
                            System.debug("Catched "+ex);
                        }

Thomas

P.S. Recognized your answer a little bit toooo late

0 Kudos