VMware {code} Community
bvivek
Contributor
Contributor

posting custom events and creating alarms on custom events

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

            ExtendedEvent myEvent = new ExtendedEvent();

            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

Reply
0 Kudos
1 Reply
amitkolkar
Contributor
Contributor

Hi All,

I think I have the similar query here.

In our application as well, I have used the similar code to post an event to a vCenter.

The issue I am observing here is, I am not able to see message/fullFormattedMessage in the vCenter web client event.

For below example, I expect to see either message "This is my first event message" or fullFormattedMessage "This is my first event message" anywhere into the vCenter web client's events.

Please help.

Thank you,

Amit Smiley Happy

Reply
0 Kudos