Enabling SNMP in ESXi 4.1

I decided to gather some information about a server that was sitting in Morgantown, PA due to a couple of errors we were receiving.  I needed to get it pretty quick and so I decided to grab it through SNMP.  I had to enable it through the vMA since the host was running ESXi.  Here’s how:

  1. Connect to your vMA instance through Putty, SecureCRT or whatever app you use.
  2. Add the server:  vifp addserver vs-esxi.vsential.com
  3. Set your target:  vifptarget -s vs-esxi.vsential.com
  4. Configure SNMP Community:  vicfg-snmp -c vscomname
  5. Configure SNMP Trap Host:  vicfg-snmp -t TrapHostIP@161/vscomname
  6. Enable SNMP on the ESXi host:  vifcfg-snmp -E

You may need to restart the services on the ESXi host via services.sh on the host.  You can show the configuration by typing:  vicfg-snmp -s

That’s it…now you can snmpwalk the host from the Trap host you configured earlier by typing:  snmpwalk -v2c -cvscomname vs-esxi.vsential.com

If you have any questions, comments, or suggestions then please sound off in the comments!

  • Dagoberto

    I am trying to set snmp on my esxi 4.1 and when I try vicfg-snmp -c mycommunity I get vicfg-snmp: not found.
    Why is this happening?
    Do I have to enable something else before runing the command?

    Any help will be apreciated.

    Thanks

    • http://vsential.com James B.

      Sorry it took me so long to get back to you on this, I have been busy with some recent deployments for my work. Are you logging into your ESXi host directly or are you logging into your vMA appliance? If you are in your vMA then I would do the following:

      # Make sure you are logged into your vMA as the vi-admin user
      # Type the following command: which vicfg-snmp (This should return ‘/usr/bin/vicfg-snmp’)
      # You could also try using the full path for the vicfg-snmp command (/usr/bin/vicfg-snmp)

      Let me know if that helps!

  • http://rainbow.chard.org/ Ian Chard

    In case it’s useful, I blogged about the extra data you can get from ESXi’s SNMP server at http://rainbow.chard.org/2011/09/08/getting-useful-information-out-of-esxi-with-snmp-queries/

    • jamesbowling

      Great post Ian. Thanks for sharing!

  • http://umarzuki.org umarzuki

    any success with SNMP SET for ESXi 4.1?

  • Chris

    Is vMA free of charge or does it require an Enterprise Plus license? I am seeing conflicting information.

  • joe

    I tried this but after connect through putty, the vifp is not found, nor any of the commands you list. Is there something we need to enable or install first?

    # vifp addserver vs-esxi.mydomain.net
    -sh: vifp: not found

    # vmx -v
    VMware ESX Information:
    VMware ESX 5.0.0 build-469512 Release

    thank you in advance,
    Joe

    • James Bowling

      You will need to deploy and configure the vSphere Management Assistant (vMA). The commands above are given in the manner as to be executed from the vMA and not on the host directly.

      • joe

        thank you James, I am downloading the vMA now.

      • joe

        OK I got the vma deployed and connected to it as user vi-admin in putty, now when I try “vifp addserver myhost” i get “connection refused”,
        Is there something else I need to enable? thank you!

        localhost:/home/vi-admin # vifp addserver vma
        Error: Connection to host refused.

        • joe

          OK last time i blow up your comments today, i used the ip address of my vm host and seemed to get a step further, but no success yet…

          localhost:/home/vi-admin # vifp addserver 192.168.1.247
          root@192.168.1.247‘s password:
          localhost:/home/vi-admin # vifptarget -s 192.168.1.247
          localhost:/home/vi-admin # [192.168.1.247]# vicfg-snmp -c mycommunity
          Enter username: root
          Enter password:
          Server version unavailable at ‘https://192.168.1.247:443/sdk/vimService.wsdl’ at /usr/lib/perl5/5.10.0/VMware/VICommon.pm line 545, line 2.

        • James Bowling

          You need to verify that DNS is setup appropriately. Make sure that you can resolve your host’s FQDN and also make sure that reverse is configured as well.

          • joe

            Hi James, I got reverse and forward dns working right; then got past this LWP SSL_VERIFY issue, now SNMP is working on my VM hosts, THANK YOU!

          • James Bowling

            I am glad you got everything working!