Quantcast
Channel: VMware Communities : All Content - vSphere Management SDK
Viewing all articles
Browse latest Browse all 1860

posting custom events and creating alarms on custom events

$
0
0

I m creating custom event on a VM in the following code.

 

            ExtendedEvent myEvent = newExtendedEvent();

 

            myEvent.chainId = 0;

            myEvent.key = 0;

            myEvent.createdTime = DateTime.Now;

            myEvent.fullFormattedMessage = "This is my first event message";

            myEvent.userName = "Administrator";

            myEvent.message = "This is my first event message";

            myEvent.eventTypeId = "com.my.trial.event1";

            myEvent.managedObject = vmor;// VM

 

            pg.service.PostEvent(pg.sic.eventManager, myEvent, null);

 

 

I can see com.my.trial.event1 displayed in the task and event tab in vSphere client. I have following queries-

1.       Is this correct and all that I need to post an event?

2.       Can somebody elaborate on eventTypeID? Significance of it?

3.    How can I create an alarm for this event? I tried it with  providing com.my.trial.event1 as event in the Triggers tab of Alarm settings dialog while creating new alarm. I tried selecting Suspend VM and Power off Vm actions. But the actions are not executed after this event is posted. L


Viewing all articles
Browse latest Browse all 1860


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>