Configuring SNMP Traps for ESX 3.5 and ESX 4.0

01-esx4-installProblem:

To generate virtual machine and environmental traps from ESX 3.5 and ESX 4.0 hosts, you must configure and enable the embedded SNMP agent. You cannot use the Net-SNMP-based agent to generate these traps, although it can receive GET transactions and generate other types of traps.

Solution:

To enable SNMP on ESX Server version 3.5:

1. Login as root
2. Edit the snmpd.conf file and add “rocommunity xxxx” where xxxx is your read-only community string). The file is usually located in /etc/snmpd.
3. While you’re editing the snmpd.conf file, also add “dlmod SNMPESX /usr/lib/vmware/snmp/libSNMPESX.so”
4. Restart the SNMP daemon – /etc/init.d/snmpd restart

In some cases, you may also need to edit the firewall settings on the ESX server to allow the SNMP traffic through. To do this:

Login as root and issue the following commands:
2. esxcfg-firewall -e snmpd
3. chkconfig snmpd on
4. service snmpd start

To monitor your ESX 3.5 server by using SNMP, we need to enable SNMP on ESX before adding it to your monitoring software. This How-To will show you the steps involved.

or

Log Into ESX Server

Log into your ESX Server either through SSH or through the console of the server.

Use Nano to Edit Snmpd.conf

Use Nano (which is a notepad like text editor) to edit the file /etc/snmp/snmpd.conf file by using the command:
nano /etc/snmp/snmpd.conf

Add SNMP Community to Config File

Use the arrow keys to go down to the section “rocommunity public”. Replace “public” with your community string for your environment (1). Then use “Ctrl+X” to exit out of Nano. You’ll be asked if you would like to save. Type in “y” for yes and hit enter. Press enter again when confirming the filename to save as.

Enable SNMP to Start Automatically After a Reboot

Since SNMP is not started by default, you’ll need to type in this command to ensure it will be started after a reboot of the ESX server. The command is:
chkconfig snmpd on

Enable SNMP Through the ESX Firewall

We’ll need to allow SNMP traffic through the built-in ESX firewall. To do this, type in the following command:
esxcfg-firewall -e snmpd

Start the SNMP Service

Now we’re ready to start the SNMP service. Type in:
service snmpd start

This was all found at: globalpointllc.com

 

Also I found that

Enabling root SSH login on an ESX host (8375637)

Since ESX 3.0, for increased security, SSH is disabled by default for the root account on an ESX host. That is, the actual sshd service does not allow root logins. Non-root users are able to login with SSH. This is another layer of protection in addition to the host firewall.

Note: Each SSH connection to an ESX host uses additional Service Console resources. Use caution when using scripts or third party software that create multiple SSH sessions to the ESX Service Console. Excessive use of SSH on an ESX machine may cause the service console to exhibit symptoms of memory exhaustion.

To enable root login for SSH and SCP clients:

If you have physical access to the ESX host, login to the console of your ESX host as the root user. If you can only connect to the ESX host over the network, connect using an SSH client (such as PuTTY) and log in as a user other than root.

To create a user in ESX host for using a SSH client:

Log in to the vSphere Client as a root user.
Click Users & Groups.
Right-click on a blank area and click Add.
Enter a username and password. Confirm your password.

Note: Starting in ESX 4.0, the password needs to be at least 8 characters in length.

Select Grant shell access to this user.
Select root group from the dropdown and click Add > OK.

Note: By default it assigns to the users group and does not allow SSH access.

After you are logged in SSH session, switch to the root user with the command:

su –

Note: If you do not have any other users on the ESX host, you can create a new user by connecting directly to the ESX host with VMware Infrastructure (VI) or vSphere Client. Go to the Users & Groups tab, right-click on the Users list and select Add to open the Add New User dialog. Ensure that the Grant shell access to this user option is selected. These options are only available when connecting to the ESX host directly. They are not available if connecting to vCenter Server.

Edit the configuration file for SSH with the command:

nano /etc/ssh/sshd_config

Find the line that starts with PermitRootLogin and change the no to yes. You can find this line about 2 pages down from the top.
Save the file by first pressing Ctrl-O and then Enter.
Exit with Ctrl-X.
Restart the sshd service with the command:

service sshd restart

Note: Alternatively, use the command:

/etc/init.d/sshd restart

Note: For similar information when using ESXi, see Tech Support Mode for Emergency Support (1003677) and Using Tech Support Mode in ESXi 4.1 and ESXi 5.0 (1017910). To enable SSH access for local user accounts created on ESX/ESXi 4.1, see Local or Active Directory Domain users on ESX and ESXi 4.1 systems cannot log in (1024235).

 

 

and then:

Start SNMP on Startup for ESX 4.0

The snmpd service does not start automatically on an ESX 4.0 server. This is how you do it:

Start the service:

/etc/init.d/snmpd start

Start snmpd on startup:

Log in as super user. (be sure to use the “-“)

su –

Configure snmpd to start on startup:

chkconfig snmpd on

NOTE: If you just log in as “su” and do not use “su -” you will keep getting “chkconfig: command not found”. This is because chkconfig is not found in the root path and “su” only looks in the root path.