VMware Cloud Community
elgordojimenez
Contributor
Contributor

vmware vsphere cli error with snmp script

hello all,

getting the following error when trying to simply see the snmp configuration:

C:\Program Files (x86)\VMware\VMware vSphere CLI\bin>vicfg-snmp.pl --server x.x.x.x.x --show
Enter username: root
Enter password:
Can't call method "configuration" on an undefined value at C:\Program Files (x86)\VMware\VMware vSphere CLI\bin\vicfg-snmp.pl line 248.
C:\Program Files (x86)\VMware\VMware vSphere CLI\bin>
I tried other commands and they work, for example : vicfg-nas.pl --server my_esxhost --list , this worsk Ok, but anything to do with snmp does not work at all. This is how my snmp.xml file looks like :
/etc/vmware # cat snmp.xml
<config>
  <snmpSettings>
    <communities>fffff9890iojdfijf980</communities>
    <enable>true<enable>
    <port>171</port>
    <targets>10.10.10.10@162/fffff9890iojdfijf980</targets>
  </snmpSettings>
</config>/etc/vmware #
I am using esxi 4.1 update 1 and vsphere cli 5 on a windows 2008 R2 STD server.
appreciate any help/
**** If you find this or any other answer useful please consider awarding points by marking the answer correct or helpful ****
Reply
0 Kudos
3 Replies
lamw
Community Manager
Community Manager

When you configured SNMP, was this done using the vSphere Client and/or vCLI's vicfg-snmp.pl command? Can you vicfg-snmp.pl --version?

Basically from the error, it's getting undefine for the "configuration" property of the SNMP data in your ESXi host, so either it's a permission issue which I doubt since this should be RO data or SNMP was manually tweaked w/o going through the proper channel.

Reply
0 Kudos
sinysee
Contributor
Contributor

This thread is over a year old, yet I can confirm the issue.

I am seeing the same error message on VMware ESXi 5.0.0.

When vicfg-snmp is run with the --verbose option I can see the following response from the server:

RESPONSE: $VAR1 = '<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<RetrievePropertiesResponse xmlns="urn:vim25"><returnval><obj type="HostSnmpSystem">ha-snmp-agent</obj><propSet><name>configuration</name><val xsi:type="HostSnmpConfigSpec"><enabled>false</enabled><port>161</port><option><key>EnvEventSource</key><value>indications</value></option></val></propSet><propSet><name>limits</name><val xsi:type="HostSnmpSystemAgentLimits"><maxReadOnlyCommunities>10</maxReadOnlyCommunities><maxTrapDestinations>3</maxTrapDestinations><maxCommunityLength>64</maxCommunityLength><maxBufferSize>1500</maxBufferSize><capability>COMPLETE</capabil';

The message is truncated and therefore is not  a valid XML. This is the response to the basic request

ha-property-collector->RetrieveProperties(HostSnmpSystem)

This request is issued before any of the snmp commands can be executed, therefore vicfg-snmp fails on all commands.

I would like to investigate this further.

Reply
0 Kudos
lamw
Community Manager
Community Manager

Hi @sinysee,

I would recommending filing an SR with VMware, that way support can help you further investigate the issue.

Reply
0 Kudos