Greetings.
I recently needed to configure / fix my ESX servers to communicate properly over SNMP to my HP SIM server.
Note: This is for ESX 4.1 and HP SIM 6.2.
There were many problems I needed to address and I wanted to share my solution with the community.
Basically here was my problem: I had HP SIM installed on many ESX 4 servers. I had Systems Management Homepage (SMH) working on these servers. SNMP Test Traps could not be sent from SMH (Settings, SNMP Configuration, Send Test Trap) and regular SNMP trap communication not working (failed disks / memory etc.).
Here is what I needed to do:
1. Modify snmpd file properly in /etc/snmp/snmpd.conf
a. Modify the top of the file to look like this:
A. rwcommunity private 127.0.0.1
2. add open the SNMP ports in the firewall on the server with:
a. esxcfg-firewall -o 161,tcp,in,snmp
b. esxcfg-firewall -o 162,tcp,out,snmp
3. Edit the /opt/hp/hp-snmp-agents/cma.conf for the NIC settings. Append the file with:
trapIf vswif0
4. Comment out Defaults requiretty in /etc/sudoers
5. Restarted the below services:
a. snmpd
b. hp-snmp-agents
c. hpsmhd
Once you complete the above on one server, Goto HP SIM System Management and try to send test trap again. Test trap should be received on SIM end under Events.
Next, copy the two files above from the working machine (/etc/snmp/snmpd.conf, /opt/hp/hp-snmp-agents/cma.conf) to a remote server (e.g. another machine on your network for which your ESX boxes can access files via http). I used SCP to copy files from working ESX box to the remote server.
Note: The files above are the same on all ESX 4 servers. There is no machine specific information.
Next fix your other ESX servers via a bash script and remote ssh.
Here is the script:
---------------------------------------------------------------------------------------------
#!/bin/bash
#Specify Server URL that hosts files (your <remote_server>)
URLPREFIX="http://<remote_server>/<file_location>"
#Open Ports on the ESX Firewall
esxcfg-firewall -o 161,tcp,in,snmp
esxcfg-firewall -o 162,tcp,out,snmp
#append information to file /opt/hp/hp-snmp-agents/cma.conf
echo "trapIf vswif0" >> /opt/hp/hp-snmp-agents/cma.conf
#replace files using curl command
cd /etc
curl -O "$URLPREFIX/sudoers"
cd /etc/snmp/
#create a backup in case
cp /etc/snmp/snmpd.conf /etc/snmp/snmp.conf.BACKUP
curl -O "$URLPREFIX/snmpd.conf"
#Restart services:
/etc/init.d/snmpd restart
/etc/init.d/hp-snmp-agents restart
/etc/init.d/hpsmhd restart
#send test trap via ESX
snmptrap -v 1 -c public 10.144.2.22 .1.3.6.1.4.1.232 localhost 6 11003 0
------------------------------------------------------------------------------
That last line, how to send a test trap via ESX 4 using a snmptrap command took me a while to find.
Finally, review your SIM server to confirm test traps are being sent for each server.
Cheers.