Hello all, long time member but first time I have had to ask a question on here
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.
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
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
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.
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
yezdi do I still need to run this script if it is a 'clean' install and not an upgrade?
Thanks in advance
Malc
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.
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
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.
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
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
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
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
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
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
Actually as far integrating esx into centreon in my case this is as far as I got.
To clear a few things up. If the community name doesn't show up when running the status command, you should try to reenter the settings, i don't think anything will work until you get those settings right.
I'm not familiar with Solarwinds, and how it works, but these are the steps i'd suggest once the config shows a proper community name.
login into a linux machine, it may even work from the esx host, but try from another machine just in case and run snmpwalk google for details against the esx host.
for example "snmpwalk -c <community> -v 2c localhost"
It will return what snmp values are available from the esx server. on my test lab i get something starting like this
SNMPv2-MIB::sysDescr.0 = STRING: VMware ESX 4.0.0 build-175625 VMware, Inc. x86_64
SNMPv2-MIB::sysObjectID.0 = OID: SNMPv2-SMI::enterprises.6876.4.1
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (629123) 1:44:51.23
SNMPv2-MIB::sysContact.0 = STRING: not set
You can also install another software / use some component in solarwinds to check if esx is sending traps to the "notification targets" you set in the snmp config. To do this, configure the notification target to be your solarwinds machine, or any machine that can interpret snmp traps, and watch it if it receives traps.
To generate traps, see the vicfg-snmp.pl help commands.
As far as MIB's are concerned, solarwinds should have some sort of option that allows you to either compile, or import MIB files.
This is as far as I got i'm afraid, so good luck from now on : )
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
-
Hi,
I've come across this same issue configuring SNMP. The problem seems to be that I didn't have a fully qualified domain ni the host name. To correct it, I added a domain to the "DNS and Routing" configuration screen and once I restarted the server I could enable SNMP
Hope this helps
David
Do you know what's the syntax to add a previous line I had in my old snmpd.conf?
I mean, how do I add a line like this to the new xml syntax? :
exec .1.3.6.1.4.1.6876.99999.2 find /usr/bin/find /vmfs/volumes/ -name *.vmsn