Blog

This is about web development and nagios monitoring.

How to add SNMP support for vCenter Server Appliance (VCSA under SUSE)

Written from Klement

If you like to monitor a Linux vCenter Server Appliance with SNMP the following steps should help to install and configure SNMP.

1. Check your SUSE version

We need to get this information to add the correct repository before installing the SNMP package. So type in this command:

cat /etc/SuSE-release

In our example we have SUSE 11 with Patchlevel 2

SUSE Linux Enterprise Server 11 (x86_64)
VERSION = 11
PATCHLEVEL = 2

 

2. Open YAST to install the needed packages

yast

 

3. Add repositories

In YAST we need to add two repositories to be able to find and download the net-snmp package

  1. Software > Software Repositories (press Enter)
  2. Press ALT + A to add one
  3. Choose "Specify URL" (press ALT + X for next screen)
  4. Type in or copy this URL:
    http://download.opensuse.org/distribution/11.2/repo/oss/ (Acceppt the key with ALT + N)

    In some cases the fields for typing in the URL are filled with multiple "a". Don't get distracted by this. If you'll be asked to import untrusted GNuPG Key press ALT + I and agree the license agreement with ALT + N. Now download the repository by pressing F10 for OK.

Now repeat steps 3 (1 - 4) with the second repository URL:
http://ftp.twaren.net/Linux/OpenSuSE/repositories/net-snmp:/factory/SLE_11_SP2/

If you don't have SUSE release 11.2 you need to find the proper repository URL that matches your release.

 

4. Install SNMP

Now that you have the repositories included you'll be able to find the package net-snmp. In YAST go to the menu  Software > Software Management and type snmp in the search field.

Choose xnet-snmp by pressing Enter (package dependencies will be selected automatically) and acceppt with ALT + A.

After the installation you can quit YAST with F9.

 

5. Configure SNMP

We are just doing a basic SNMP configuration. In our example we define a read only community string in our config file.

Open SNMP config file:

vi /etc/snmp/snmpd.conf

Add the community string public (or anything else you like) and save this file.

rocommunity public

 

6. Allow SNMP access from outside the localhost

If we wouldn't edit the hosts.allow file, we would only be able to start snmp requests from our VCSA. To monitor our vCenter from another server we need to edit this file:

vi /etc/hosts.allow

If you wish to allow monitoring from all hosts add this line:

snmpd: ALL : ALLOW

If you wish to allow monitoring from a specific monitoring server (more secure) add this line:

snmpd: xxx.xxx.xxx.xxx : ALLOW

 

7. Start SNMP service

In order to listen for incoming snmp requests (and apply the changes to our snmd.conf) we need to start the snmp service:

service snmpd start

To check if the snmp service is listening on port 161 you can use this command:

netstat -an | grep 161

 

8. Add SNMP service to autostart

Now we are adding the snmp service to the autostart by executing this command:

chkconfig --set snmpd on

 

We are now able to monitor our Linux vCenter Server Appliance with SNMP.