Server Management - Systems Insight Manager
cancel
Showing results for 
Search instead for 
Did you mean: 

ESX SNMP Configuration (for HP SIM) & sending an ESX Test Trap via SNMPTRAP

Thomas MacLean
Occasional Visitor

ESX SNMP Configuration (for HP SIM) & sending an ESX Test Trap via SNMPTRAP

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
rocommunity public 127.0.0.1
rwcommunity private
rocommunity public
trapcommunity public
trapsink public

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 )
URLPREFIX="http:///"

#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.
3 REPLIES
Tiwari_A
Advisor

Re: ESX SNMP Configuration (for HP SIM) & sending an ESX Test Trap via SNMPTRAP

That really help Thomas,

Did you install SIM agent (HP Management Agent for ESX) using CLI? Because, if you had installed it using SIM (under configure repair agent wizard) this would have configured it for you in few clicks. :)

Anyway, this will certainly help people who need to dig down the SNMP in ESX.

Regards,
Ashutosh Tiwari
cybercoaster
Frequent Advisor

Re: ESX SNMP Configuration (for HP SIM) & sending an ESX Test Trap via SNMPTRAP

GOod info, thanks!
David Claypool
Honored Contributor

Re: ESX SNMP Configuration (for HP SIM) & sending an ESX Test Trap via SNMPTRAP

Thomas:

HP SIM does not use SNMP for any write operations over the wire, so there is no need to set a rwcommunity for the HP SIM server; in fact it is best practice not to. An rwcommunity does need to be set (as you have done) for 'localhost' or 127.0.0.1 so that SMH can locally write SNMP values to set disk thresholds, clear logs, etc.

Note also that all of the above can be accomplished through the 'Manage Communications' or 'Configure or Repair Agents' tasks in HP SIM.