Set-VMHostSNMP Breaks ESXi Snmp

So I was trying to set some hostsnmp the other, with powercli, as all good boys should. Then I started getting some funky errors.

errorsnmphost

Null or empty huh?

Notice in the above picture, that I first did a “get-vmhostsnmp” which also should display information everytime. Even snmp that hasn’t been set on a host. Should look something like this…

normalsnmp

And if I wasn’t even connected to a host, I would get a third kind of error, which would essentially say “you should connect to a host silly”

So I decided to check the esxicli command and see what I got…

esxierror

That doesn’t look good earlier. So I found a good KB that shows how to resolve this issue

http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1000529

It isn’t very tough, and involves editing the snmp.xml file on each host. Not fun, but not too bad either.

In doing so I figured out what was going on… take a look at a portion of the snmp.xml file from two hosts, the first one is the broken one and the second one is the working one….

<targets>1.2.3.4</targets>

<targets>1.2.3.4@162 vmware</targets>

The difference is pretty obvious. It looks like the difference is the port number and the community name. But I did specify the community name earlier.

Ok once its fixed(I used the KB above) I try again…

working

So even though it isn’t a specified as a mandatory parameter it seems that -TargetPort is required in order for the cmdlet to work properly.

Hope this helps!

Leave a Reply