Search the VMware Knowledge Base (KB)
View by Article ID

Cannot enable or test SNMP on a VMware ESXi 5.1 host (2036910)

  • 7 Ratings

Symptoms

After upgrading to ESXi 5.1, you experience these symptoms:
  • Testing SNMP using the esxcli system snmp get command  fails.
  • Running the esxcli system snmp get command  from within an SSH session fails with the error:

    Community string was not specified in the trap target:


  • You cannot enable SNMP.
  • Running the vicfg-snmp.pl --server hostname --username username --password password --show command from the vSphere CLI fails.
  • You see the error:

    Can't call method "configuration" on an undefined value at C:\vSphere_CLI_Install_directory\bin\vicfg-snmp.pl line 248.


  • Running the vicfg-snmp.pl --server hostname --username username --password password --enable command from the vSphere CLI fails.

  • You see the error:

    Enabling agent...

    Use of uninitialized value in string eq at C:/
    vSphere_CLI_Install_directory/Perl/lib/VMware/VIMRuntime.pm line 81.
Use of initialized value in concatenation (.) or string at E:/vSphere_CLI_Install_directory/Perl/lib/VMware/VIMRuntime.pm line 50.
Undefined subroutine &Can't call method "ReconfigureSnmpAgent" on an undefined value at C:\vSphere_CLI_Install_directory\bin\vicfg-snmp.pl line 297.
::fault_string called at C:\vSphere_CLI_Install_directory\bin\vicfg-snmp.pl line 299
 
  • In the snmp.xml file, located at /etc/vmware/, you see that:

    • The first line appears similar to:

      <?xml version="1.0"?>

            
  • Target section is empty:

    <targets>

    </targets>

Cause

This issue occurs if the snmp.xml file was not updated properly during the upgrade.

Resolution

To resolve this issue, you must update the snmp.xml file.

To update the snmp.xml file:
  1. Take a backup of the original snmp.xml file using these commands:

    # cd /etc/vmware/
    # cp snmp.xml snmp.xml.bak


  2. Open the snmp.xml file using a text editor.
  3. Change the first line in the file from:

    <?xml version="1.0"?>

    To:

    <?xml version="1.0" encoding="ISO-8859-1"?>



  4. In the targets section, set an IP Address to which the SNMP traps are to be sent. Alternatively, if you do not want an extra traffic on the network, set a loop-back address.

    For example:

    <targets>

    127.0.0.1@162 public

    </targets>


  5. Save and close the snmp.xml file.

    You should now be able to enable and test SNMP.

Note: If SNMP does not work properly over the default port 161, change the value of port from 161 to another value, such as 171, within the snmp.xml file and then try enabling it. You may need to restart the SNMP service on the host for the changes to take effect.

Additional Information

For more information, see the Configure SNMP for ESXi section in the vSphere Monitoring and Performance Guide.

To be alerted when this article is updated, click Subscribe to Document in the Actions box.


See Also

Request a Product Feature

To request a new product feature or to provide feedback on a VMware product, please visit the Request a Product Feature page.

Feedback

  • 7 Ratings

Did this article help you?
This article resolved my issue.
This article did not resolve my issue.
This article helped but additional information was required to resolve my issue.

What can we do to improve this information? (4000 or fewer characters)




Please enter the Captcha code before clicking Submit.
  • 7 Ratings
Actions
KB: