Cannot enable or test SNMP on a VMware ESXi 5.1 host
search cancel

Cannot enable or test SNMP on a VMware ESXi 5.1 host

book

Article ID: 304943

calendar_today

Updated On:

Products

VMware vSphere ESXi

Issue/Introduction

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>



Environment

VMware vSphere ESXi 5.1

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 document is updated, click the Subscribe to Article link in the Actions box



ESXi 5.1 ホスト上で、SNMP の有効化及びテストができない