VMware {code} Community
uminewbie
Contributor
Contributor

Host value empty in SNMP trap; how to identify VM?

Hi,

I am developing a Java app. using VI SDK and I need to execute some actions whenever a VM changes its state. I have configured a new alarm in VC using VI Client to send an SNMP trap whenever a VM changes its state. When I powered on a VM, I got an SNMP trap with below information:

Identification Map (Label) = Value

1.3.6.1.4.1.6876.50.301 ( vpxdTrapType ) = vm

1.3.6.1.4.1.6876.50.302 (vpxdHostName ) =

1.3.6.1.4.1.6876.50.303 ( vpxdVMName) = VirtualMachine1

1.3.6.1.4.1.6876.50.304 (vpxdOldStatus) = Red

1.3.6.1.4.1.6876.50.305 (vpxdNewStatus) = Yellow

1.3.6.1.4.1.6876.50.306 (vpxObjValue) = MyAlarm - (State = Powered On)

The second OID 1.3.6.1.4.1.6876.50.302 (vpxdHostName) did not carry any value; it was empty. But, to identifiy a VM I need to provide the host name as well as VM name, right?. How to get the host name value in SNMP traps? Am I missing something here? Or is there a way to get a MOR for VirtualMachine1 using whatever info. I received in SNMP trap? Any help in this regard is highly appreciated.

Thanks in advance,

Umi

Tags (4)
0 Kudos
7 Replies
uminewbie
Contributor
Contributor

Hi Guys,

I desperately searched though all the community posts to get any hint on how to address this issue but to no avail. I wonder if SNMP Trap notifications are so seldomly used in industry that there are hardly any posts on this topic. Can any of the VMWare folks please help me in this regard?

Thanks in advance,

U

0 Kudos
macfaden
Contributor
Contributor

Traps are defined in RFC 1215 (http://www.ietf.org/rfc/rfc1215.txt). It is one wire format used to indicate status change from 'something worth monitoring' to 'some place to track state' with the goal of knowing before your customers do that some service is no longer functional. Since these are transmitted over udp with no acknowlegement they are unreliable means of maintaining state remotely. So if you need to track something, then polling state remains the only way to go.

So that begs the question, why have traps at all? As Dr Jeffrey Case, co-creator of SNMP described to me at an IETF meeting a long time ago, they provide a means of optimizing polling. If you have 10 devices to poll and you do that on 10 minute interval and it takes 1 minute to collect data from a device, the worst case is that you won't know for 9 minutes about the failure. So if a trap arrives, you can shorten this worse case senario to seconds.

Regards,

Mike MacFaden

0 Kudos
uminewbie
Contributor
Contributor

Yes, you are right, we cannot rely on traps but, other than polling and trap notifications, there is no other way of knowing programatically when a VM goes down/comes up. I prefer traps over polling as polling increases the network traffic considerably.

I am able to receive the traps on all occasions but the host value is always empty. So, I am wondering whether the SNMP agent on VC itself is not sending the host value. Can anybody from VMWare kindly clarify this?

Thanks,

Umi

0 Kudos
macfaden
Contributor
Contributor

We agree traps are unreliable -- so you can't ever know if you've missed a reboot of a vm or not. This means customers could complain about lost service and you wouldn't have any proof one way or the other. Not good. Now ideally you'd simply poll some counter in the VMWARE-VMINFO-MIB's vmTable that tracks this event along with a timestamp of power status last change, but there isn't any. If I were doing this in a production system, using ESX 2.x or 3.x, I'd probably use the host resources mib to monitor vmware-vmx processes.

Regards,

Mike MacFaden

0 Kudos
uminewbie
Contributor
Contributor

Thank you very much for the quick response Mr. Mike MacFaden,

In my case, my single point contact is VC; we are not communicating with any of the ESX hosts directly. Are there any MIBs available to poll from VC? I could find only two MIB files in VC: VMWARE-ROOT-MIB.mib and VMWARE-TRAPS-MIB.mib. I could not find VMWARE-VMINFO-MIB in any of these files.

Thanks,

Umi

0 Kudos
macfaden
Contributor
Contributor

That's all I see too for VC originated snmp notifications too. If you can't poll esx directly then the VI SDK must be used to create a tool to monitor VM power status and have it output snmp notifications containing whatever you want in the varbind list. This design creates a single point of failure (VC must remain operational) but seems reasonable for many enterprise level deployments.

0 Kudos
murtyz
Contributor
Contributor

Hi Umi,

Just wanted to quickly check with you that if you were able to set the VM hostname in SNMP? I am trying to do a similar sort of setup on ESXi 4 which you were trying a while ago.

If you did get around to doing it, please enlighten me, i would appreciate it.

Thanks

Mick

0 Kudos