1 2 Previous Next 17 Replies Latest reply on Nov 12, 2009 8:02 AM by vmitos

    SNMP on ESX 4 / vSphere

    Malce30 Novice

      Hello all, long time member but first time I have had to ask a question on here http://communities.vmware.com/images/emoticons/happy.gif

       

      I have a bit of an issue with configuring SNMP on our new ESX 4.0 server. It seems VMWare have re-written /etc/snmp/snmpd.conf and now I cant find my way round it where as on 3.5 I used to just put in the following lines restart the snmpd service and I'd be away

       

       

      Rocommunity = communitystring

       

       

      Trapcommunity = communitystring

       

       

      The other idea I had was to try the Vsphere PowerCLI Powershell extensions as I am already somewhat familiar with the basic PowerShell operation but when attempting to set the community through that... well below is a copy from my PowerShell prompt

       

       

      C:\Program Files (x86)\VMware\Infrastructure\VIToolkitForWindows> $hostsnmp = Get-VMHostSNMP -server $esx

       

       

      C:\Program Files (x86)\VMware\Infrastructure\VIToolkitForWindows> $hostsnmp

       

       

      Enabled Port ReadOnly Communities

       

       

       

       

       

      True 161 {}

       

       

      C:\Program Files (x86)\VMware\Infrastructure\VIToolkitForWindows> $hostsnmp = Set-VMHostSNMP ($hostsnmp) -Enabled:$false

       

       

      C:\Program Files (x86)\VMware\Infrastructure\VIToolkitForWindows> $hostsnmp

       

       

      Enabled Port ReadOnly Communities

       

       

       

       

       

      False 161 {}

       

       

      C:\Program Files (x86)\VMware\Infrastructure\VIToolkitForWindows> $hostsnmp = Set-VMHostSNMP ($hostsnmp) -Enabled:$True -ReadOnlyCommunity communityname

       

       

      Set-VMHostSnmp : 03/08/2009 08:37:45 Set-VMHostSnmp 525fc2ef-c463-0dfc-9875-f20ec43212a3 A general system error occurred: OpenSnmpServicePortgetadrinfo failed for service '161', Servname not supported for ai_socktype At line:1 char:27+ $hostsnmp = Set-VMHostSNMP <<<< ($hostsnmp) -Enabled:$True -ReadOnlyCommunity CommunityName

       

       

      The interesting bit to note is Servname not supported for ai_socktype which I can find lots of instances for on Google but unfortunately none for SNMP, but the answers for them all seem to refer to missing entries is /etc/services but again from the excerpt below SNMP is clearly defined in that file on this box

       

       

      snmp 161/tcp # Simple Net Mgmt Proto

       

       

      snmp 161/udp # Simple Net Mgmt Proto

       

       

      snmptrap 162/udp snmp-trap # Traps for SNMP

       

       

      So I am a bit stuck now, any thoughts or suggestions you might have would be appreciated. I must admit, I am not that experienced in Linux commands or errors so I must apologise if this seems like a newbie question.

        • 1. Re: SNMP on ESX 4 / vSphere
          Malce30 Novice

           

          Has anyone got any ideas on this please, as we still have had no success and we would very much like to get this machine monitored by our Solarwinds application.

           

           

          Thanks

           

           

          • 2. Re: SNMP on ESX 4 / vSphere
            AWo Guru

            What is your exact problem? What is not working with SNMP?

             

            We use this snmpd.conf which wasn't changed from 3.5 to 4. It is still the same:

             

            rwcommunity AWo

            VCP / VMware vEXPERT 2009

            • 3. Re: SNMP on ESX 4 / vSphere
              yezdi Master
              vExpert

              After upgrade, If you didnt run "cleanup-esx3" script, you can find out thelegacy ntpd.conf under the folder /esx3-installation/etc/snmp/. you can copy and replace 4.0 version if its needed.

               

               

              If you find this or any other answer useful please consider awarding points by marking the answer correct or helpful.

               

               

               

               

              -SD [vExpert 14-18, VCIX6-DCV,RHCE]
              @sreejeshd
              http://pingforinfo.com

              • 4. Re: SNMP on ESX 4 / vSphere
                Malce30 Novice

                 

                Thanks AWo

                 

                 

                To be honest, I havent yet tried to configure SNMP as yet. Normally I would just edit the snmpd.conf file adding the lines as per your sggestion and restart the service and the job as they say would be a good one but when I looked at the file on ESX 4 the content of it was vastly different to what I was used to with previous versions of ESX so I thought I had better get some advice on what to do,  As mentioned I am not a Linux expert and like to get advice onsuch things

                 

                 

                I'll give this a go and then award points if successful

                 

                 

                • 5. Re: SNMP on ESX 4 / vSphere
                  Malce30 Novice

                   

                  yezdi do I still need to run this script if it is a 'clean' install and not an upgrade?

                   

                   

                  Thanks in advance

                   

                   

                  Malc

                   

                   

                  • 6. Re: SNMP on ESX 4 / vSphere
                    DyJohnnY Enthusiast

                     

                    Hi,

                     

                     

                    I had a similar task, for a test lab esx 4.0 host. I was planning on monitoring ESX with centreon+nagios.

                     

                     

                    i tried this following scripts run again vsphere CLI not vsphere powerCLI.

                     

                     

                     

                     

                     

                    rem change community name to <Community> and public

                    vicfg-snmp.pl server <host>username <user> --password <pass>-c <Community>,public

                     

                    rem configure agent to send traps step 1

                    vicfg-snmp.pl server <host>username <user> --password <pass>-t <IP address>@162/<Community>

                     

                     

                    rem configure agent to send traps step 1 - enable Agent

                    vicfg-snmp.pl server <host>username <user> password <pass>enable

                     

                     

                    vicfg-snmp.pl server <host>username <user> password <pass>show --test

                     

                     

                    I got this info from a document called:

                     

                     

                    "Configuring the Net-SNMP Agent on ESX hosts"  http://vsp_4_snmp_config.pdf

                     

                     

                    As far as i can figure it out, traps are being sent, however, because i can't find the proper MIB's for vmware  i can't do much in the way of actually integrating the host into centreon. hope you have more luck with solarwinds.

                     

                     

                     

                     

                     

                    1 person found this helpful
                    • 7. Re: SNMP on ESX 4 / vSphere
                      AWo Guru

                      Remember to grab the new mibs and compile them in your management application!

                       

                      You'll find them here: "/usr/share/snmp/mibs/"

                       

                       


                      AWo

                      VCP / VMware vEXPERT 2009

                      • 8. Re: SNMP on ESX 4 / vSphere
                        yezdi Master
                        vExpert

                         

                        in 4.0 , SNMP is embedded in the vmware management service - HOSTD. so the configuration  file is different,  you can enable SNMP in 4.0 by editing the file /etc/vmware/snmp.xml, the following are the tags in the file. Once your provide the values, restart the service hostd. The attached doc can give you more info about configuring SNMP on 4.0

                         

                         

                        -


                         

                         

                         

                        <config>

                        <snmpSettings>

                        <enable>true</enable>

                        <communities>public</communities>

                        <targets>server1@162 private</targets>

                        </snmpSettings>

                        </config>

                         

                        -


                         

                         

                        If you find this or any other answer useful please consider awarding points by marking the answer correct or helpful.

                         

                         

                         

                         

                         

                         

                        -SD [vExpert 14-18, VCIX6-DCV,RHCE]
                        @sreejeshd
                        http://pingforinfo.com

                        1 person found this helpful
                        • 9. Re: SNMP on ESX 4 / vSphere
                          Malce30 Novice

                           

                          Thanks again yezdi...

                           

                           

                          OK let me have a look at these options that you have all been so helpful in providing me with and I'll try and close the question and award points this afternoon...

                           

                           

                           

                           

                           

                          Thanks again for all your help thus far and watch this space as to how I get on

                           

                           

                          • 10. Re: SNMP on ESX 4 / vSphere
                            Malce30 Novice

                             

                            Hello DyJohnny,

                             

                             

                            I tried to run a couple of these commands (and some others) from the RemoteCLI utility and I get the following error

                             

                             

                            Failed : A general system error occurred: Load persistant store failed

                             

                             

                            I have tried this both from my Vista PC and the VC server machine (running Win 2003) and I get the same error so I am presuming this is a fault on the ESX machine?

                             

                             

                            Thanks

                             

                             

                            malc

                             

                             

                            • 11. Re: SNMP on ESX 4 / vSphere
                              DyJohnnY Enthusiast

                               

                              Hi Malce30,

                               

                               

                               

                               

                               

                              I can't say I have much experience with RemoteCLI, enabling SNMP was the first time I used it, and i had no problems, and that's it. I googled briefly that error, and  couldn't find anything.

                               

                               

                              You mentioned remoteCLI on your post. I'm not sure if it's the same thing we are talking about

                               

                               

                              I ran those commands from the vSphere CLI that i got from vmware website: http://communities.vmware.com/community/developer/vsphere_cli

                               

                               

                              The file I installed is called VMware-vSphere-CLI-4.0.0-161974.exe.

                               

                               

                              I'd suggest to remove any vmware related CLI, reinstall the latest and try again.

                               

                               

                               

                               

                               

                               

                               

                               

                              Ionut

                               

                               

                              • 12. Re: SNMP on ESX 4 / vSphere
                                Malce30 Novice

                                Hi DyJohnny

                                 

                                I started using the vSphere PowerCLI at first which is the Powershell based CLI and then thanks to the help I have had from the various people who have contributed to this thread (including your good self) I have switched to the VMWare Remote CLI which is based round Perl scripts executed in a Windows command prompt interface.

                                 

                                 

                                Incidentally I think I have got round the error reported earlier as one of the tags in /etc/vmware/snmp.xml was incorrect. Since correcting this when I execute C:\Program Files\VMware\VMware VI Remote CLI\bin>vicfg-snmp.pl --server <servername> --username root --password <password> -s I get the following output

                                 

                                 

                                Current SNMP agent settings:

                                Enabled : 1

                                UDP port : 161

                                 

                                 

                                Communities :

                                <community>

                                 

                                 

                                Notification targets :

                                 

                                 

                                I have also restarted the snmpd service on this machine but as yet Solarwinds application cannot verify the SNMP config or communicate with this new server via SNMP... I suppose it is also worth mentioning I have allowed SNMP through the ESX firewall with the following command

                                 

                                 

                                esxcfg-firewall -e snmpd

                                • 13. Re: SNMP on ESX 4 / vSphere
                                  DyJohnnY Enthusiast

                                  Ok, glad that thing was sorted out.

                                   

                                  Btw, the document i mentioned a few posts ago, describing how to install net-snmp says you should not edit the xml file manually. Now i hope it doesn't affect the results you are getting.

                                   

                                   

                                   

                                   

                                   

                                   

                                   

                                   

                                   

                                  Assuming, editing that file manually is ok, from what I can tell you need to specify a community name and or a notification target in the configuration.

                                   

                                   

                                   

                                   

                                   

                                   

                                   

                                   

                                   

                                  vicfg-snmp.pl --server <servername> --username root --password <password> -c FooBar,public for example.

                                   

                                   

                                   

                                  for notification targets

                                   

                                   

                                   

                                  vicfg-snmp.pl --server <servername> --username root --password <password> -t <IP>@162/FooBar for example

                                   

                                   

                                   

                                  Then try restarting snmp again, and check the status.

                                   

                                   

                                   

                                   

                                   

                                   

                                   

                                   

                                   

                                  I'd also advise you get on a linux box and do a snmpwalk of the ESX machine so you can see what data you get.

                                   

                                   

                                   

                                   

                                   

                                   

                                   

                                   

                                   

                                  Don't forget about compiling the MIB's someone mentioned a few posts back.

                                   

                                   

                                   

                                   

                                   

                                   

                                   

                                   

                                   

                                  ionut

                                  • 14. Re: SNMP on ESX 4 / vSphere
                                    Malce30 Novice

                                     

                                    Hello DyJohnny

                                     

                                     

                                    Thanks for your continuing input, I did specify a community as used by our SolarWinds instance and editing the xml file manually 'seems' to have been OK. Regarding the MIB's I looked in the folder as specified in the earlier post but all I could find was a bunch of .txt files (presumably this is what should be there) but I have very little experience with Linux so I have no idea how to 'compile the MIB's'  so again if you could point me in the right direction it would be appreciated.

                                     

                                     

                                    Thanks again

                                     

                                     

                                    Malc

                                     

                                     

                                    1 2 Previous Next