PDA

View Full Version : Sun SNMP on Solaris OS



CJ Goldsmith
December 21 2009, 08:40 PM
Introduction:
Solaris OS's come with an SNMP agent developed by Sun. The sun agent is not as feature rich as the agent provided by Net-SNMP but can be easier to install and configure on machines running Solaris.

Two things to keep in mind when choosing to use the Sun SNMP agent:

The Sun SNMP agent ONLY Supports SNMP v1
The Sun SNMP agent only supports the MIB-II tree and does not support the HOST-MIB tree. Therefore you will be able to receive interface related metrics but not CPU / Disk metrics.


Check for Running SNMP Agent:
Before you install a new SNMP agent you will need to check that you do not currently have an snmp agent running (Net-SNMP).

You can achieve this by running the following command:

ps -ef | grep snm

If the Net-SNMP agent is installed and running you will see output that looks similar to the following:

ps -ef | grep snm
carlos 6610 6578 0 18:12:58 pts/1 0:00 grep snm
root 4035 1 0 Dec 18 ? 1:09 /usr/local/sbin/snmpd

If the Sun SNMP agent is already running you should see output that looks similar to the following:

root 6632 1 0 18:17:36 ? 0:00 /usr/lib/snmp/snmpdx -y -c /etc/snmp/conf
root 6643 1 0 18:17:45 ? 0:00 /usr/lib/dmi/snmpXdmid -s builder-solaris
root 6648 6617 0 18:17:59 pts/1 0:00 grep snm

In the event that you have a Net-SNMP agent running on the Solaris Host you will need to either configure that agent:
http://forums.zyrion.com/showthread.php?t=108
or stop the process and prevent it from starting up on system reboot.

Install Sun SNMP Agent:
Before attempting to install the Sun SNMP agent you should check to see if it is already installed. If it was installed through a binary rpm package you can invoke the following command:

pkginfo | grep -i snmp

If you already have the package installed you will see output similar to the following:

pkginfo | grep -i snmp
system SUNWmibii Solstice Enterprise Agents 1.0.3 SNMP daemon

As an alternative you can look for the existence of the following file:

/etc/snmp/conf/snmpd.conf
If the file does exist on your machine and the ports are not in use (UDP 161 & 162) it is probably currently installed but not currently running, you can start the Sun SNMP agents with the following commands:

cd /etc/init.d
./init.snmpdx start
./init.dmi start

If you have determined that you do not currently have the Sun SNMP agent installed it can be freely downloaded from the following link (requires registration):
http://www.sun.com/software/entagents/

You will need to download packages for SUNWsacom, SUNWmibii, SUNsadmi, SUNWsasnm and SUNWsasdk if installing completely from scratch.

NOTE: before installing these packages you may want to make sure you remove previous copies by running pkgrm on each package name.

Once you have the packages downloaded you can install them by running the following set of commands:

pkgadd -d . SUNWmibii
pkgadd -d . SUNWsasnm
pkgadd -d . SUNWsadmi
pkgadd -d . SUNWsacom
pkgadd -d . SUNWsasdk

NOTE: You may need to perform a system restart after installing these packages.

Configuring Sun SNMP:
Once you have either installed the Sun SNMP agent, or verified that it is already installed, you will need to configure the SNMP agent so that the server can be monitored by Traverse.

The main configuration file is located at:
/etc/snmp/conf/snmpd.conf

Go ahead and open this file in your favorite editor (I'm going with vi).
Once you have the file opened you can get monitoring started immediately by inserting the following lines (and commenting out all others by making sure there is a # sign in front of all other directives) and saving the file:


sysdescr My Server
system-group-read-community public
read-community public
trap localhost
trap-community SNMP-trap
managers managers

Once the file has been saved you will need to restart the SNMP agent by running the following commands:

cd /etc/init.d
./init.snmpdx stop
./init.snmpdx start
./init.dmi stop
./init.dmi start

To verify that all is well at this point we are going to want to make sure that we can query the snmp agent for metrics. This can be accomplished by running the following command:

snmpwalk -v 1 -c public localhost
If the SNMP agent is running properly you should see output that looks similar to the following:

SNMPv2-MIB::snmpInGetNexts.0 = Counter32: 666
SNMPv2-MIB::snmpInSetRequests.0 = Counter32: 0
SNMPv2-MIB::snmpInGetResponses.0 = Counter32: 0
SNMPv2-MIB::snmpInTraps.0 = Counter32: 0
SNMPv2-MIB::snmpOutTooBigs.0 = Counter32: 0
SNMPv2-MIB::snmpOutNoSuchNames.0 = Counter32: 0
SNMPv2-MIB::snmpOutBadValues.0 = Counter32: 0
SNMPv2-MIB::snmpOutGenErrs.0 = Counter32: 0
SNMPv2-MIB::snmpOutGetRequests.0 = Counter32: 0
SNMPv2-MIB::snmpOutGetNexts.0 = Counter32: 0
SNMPv2-MIB::snmpOutSetRequests.0 = Counter32: 0
SNMPv2-MIB::snmpOutGetResponses.0 = Counter32: 693
SNMPv2-MIB::snmpOutTraps.0 = Counter32: 12
SNMPv2-MIB::snmpEnableAuthenTraps.0 = INTEGER: enabled(1)

Conclusion:

You should now be able to provision the Solaris Device within Traverse using SNMP v1. Remember when provisioning devices that you will need to change the version number manually to 1 by selecting the proper radio button during monitor configuration (auto-discovered during a device discovery session).