Blame README.solaris

Packit fcad23
README.solaris
Packit fcad23
$Id$
Packit fcad23
Packit fcad23
This document describes issues relating to compiling,
Packit fcad23
installing and using net-snmp on Solaris.
Packit fcad23
Packit fcad23
0.  Introduction
Packit fcad23
1.  Things you will need
Packit fcad23
2.  Disabling Sun's SNMP daemons
Packit fcad23
3.  Compiling net-snmp
Packit fcad23
4.  Obtaining and installing binaries
Packit fcad23
5.  Creating snmpd.conf and testing
Packit fcad23
6.  Creating your own binaries
Packit fcad23
7.  Using Sun's SNMP daemon and net-snmp together
Packit fcad23
8.  Monitoring disks, processes and execs (DISMAN-EVENT-MIB)
Packit fcad23
9.  Monitoring CPU temp, fan and power supply sensors (LM-SENSORS-MIB)
Packit fcad23
10.  MIB rewrites for IF-MIB, TCP-MIB and UDP-MIB
Packit fcad23
Packit fcad23
Additional compilation issues:
Packit fcad23
Packit fcad23
11.  Files descriptors and fopen
Packit fcad23
12.  Perl
Packit fcad23
13.  sed
Packit fcad23
14.  OpenSSL and crle
Packit fcad23
15.  IPv6
Packit fcad23
16.  Wish list
Packit fcad23
Packit fcad23
Other issues:
Packit fcad23
Packit fcad23
17.  Known Bugs!!
Packit fcad23
18.  Discussion and further information
Packit fcad23
Packit fcad23
------------------------------------------------------------
Packit fcad23
Packit fcad23
0.  Introduction
Packit fcad23
Packit fcad23
This document is a compilation of information relating to
Packit fcad23
running net-snmp (www.net-snmp.org) on Sun SPARC and Ultra
Packit fcad23
hardware under the Solaris operating system.
Packit fcad23
Packit fcad23
This can be done either in conjunction with or as a 
Packit fcad23
replacement for Sun's SNMP daemons.
Packit fcad23
Packit fcad23
This is discussed in detail in the sections below.  Since
Packit fcad23
this is the work of several authors, credit is given.
Packit fcad23
Discussion, however, should take place on the net-snmp-users
Packit fcad23
or net-snmp-coders mailing lists so everybody can
Packit fcad23
benefit.  See http://sourceforge.net/mail/?group_id=12694 .
Packit fcad23
Use "net-snmp-users" for general usage questions and "net-snmp-coders" for
Packit fcad23
discussion of net-snmp source code.  
Packit fcad23
Packit fcad23
No warranty is implied by this document.
Packit fcad23
This document is copyright but usage allowed under the same
Packit fcad23
licensing as net-snmp in general.  See http://www.net-snmp.org/COPYING.txt.
Packit fcad23
Packit fcad23
------------------------------------------------------------
Packit fcad23
Packit fcad23
1.  Things you will need
Packit fcad23
Packit fcad23
A.  Root access
Packit fcad23
Packit fcad23
Root access is required to follow pretty much any of
Packit fcad23
the steps below.  At a bare minimum, you will need
Packit fcad23
to be able to start and stop daemons, which requires root
Packit fcad23
(at least for the default ports).
Packit fcad23
Packit fcad23
B.  Determine existing SNMP functionality
Packit fcad23
Packit fcad23
SNMP uses ports 161 and 162 by default.  Only one application
Packit fcad23
can use them at a time.  If there is an existing SNMP
Packit fcad23
application (eg. Sun's snmpdx daemon) you need to either
Packit fcad23
turn this off or work around it.   You may also have
Packit fcad23
a previous version of net-snmp, the older ucd-snmp, or
Packit fcad23
something completely different.  The following commands:
Packit fcad23
Packit fcad23
   ps -ef | grep snm
Packit fcad23
   ps -ef | grep mibi
Packit fcad23
Packit fcad23
will give you a fairly good idea what is going on.
Packit fcad23
Packit fcad23
If you see something like:
Packit fcad23
Packit fcad23
  root 643 1 0 Jan 16 ? 5:49 /usr/local/sbin/snmpd
Packit fcad23
Packit fcad23
that's probably a version of net-snmp.  The instructions in various
Packit fcad23
sections below should give you clues on what to do next.
Packit fcad23
Packit fcad23
If you see something like:
Packit fcad23
Packit fcad23
  root 16178 1 0 13:16:04 pts/2 0:00 /usr/lib/snmp/snmpdx -y -c /etc/snmp/conf
Packit fcad23
Packit fcad23
and/or 
Packit fcad23
Packit fcad23
  root 21371 1 0 Feb 07 ? 0:52 mibiisa -r -p 41178
Packit fcad23
Packit fcad23
then Sun's SNMP daemons are running.  
Packit fcad23
Packit fcad23
If you need this, for example if you use the Solstice Enterprise
Packit fcad23
Agent, you may wish to run net-snmp as a sub-agent (see section 7).
Packit fcad23
Otherwise, you will need to disable Sun's daemons (see section 2).
Packit fcad23
Packit fcad23
Regardless you may wish to compile net-snmp from source
Packit fcad23
and install it (see sections 3, 5 and 6) or install
Packit fcad23
binaries (see sections 4 and 5).  
Packit fcad23
Packit fcad23
If some other SNMP daemon is running, you will need to determine
Packit fcad23
where it came from and what it's being used for.  You get clues by
Packit fcad23
typing "snmpd -v" or "snmpd --help".  In some cases it may be
Packit fcad23
a subagent or agent from another application, such as ORACLE.  If
Packit fcad23
you disable its agent, you will need to re-create this functionality
Packit fcad23
under net-snmp (eg. by running it as a sub-agent).  ORACLE's SNMP
Packit fcad23
functionality is turned on by default and may be unnecessary if
Packit fcad23
you aren't using ORACLE's Enterprise Manager.  Refer to ORACLE's
Packit fcad23
documentation on how to disable it.
Packit fcad23
Packit fcad23
Packit fcad23
If you have decided to compile your own net-snmp, you will need ...
Packit fcad23
Packit fcad23
C.  A compilation environment
Packit fcad23
Packit fcad23
-a compiler (gcc or Sun's Forte cc) or the gcc libraries
Packit fcad23
   (note, the cc in /usr/ucb is NOT a full-blown compiler)
Packit fcad23
-OpenSSL (sunfreeware.com or source www.openssl.org)
Packit fcad23
-zlib (sunfreeware.com or source www.gzip.org/zlib/)
Packit fcad23
-an SNMP community string ("public" is deprecated)
Packit fcad23
Packit fcad23
If you are installing on a development machine, it may be best
Packit fcad23
to compile OpenSSL and zlib from source, otherwise
Packit fcad23
obtain the appropriate zlib for your platform from sunfreeware
Packit fcad23
and install (it goes to /usr/local automatically).
Packit fcad23
Obtain the appropriate OpenSSL for your platform from sunfreeware
Packit fcad23
and install (it goes to /usr/local), you may need the gcc libraries.
Packit fcad23
These libraries should not need to be installed if you are using
Packit fcad23
binaries, but your mileage may vary.  Note the library problem
Packit fcad23
with libcrypto noted below (section 14).
Packit fcad23
Packit fcad23
There are two choices for compilers.  Sun has a Forte development
Packit fcad23
suite that includes a standalone C compiler.  If you have it, it
Packit fcad23
is likely installed in /opt/SUNWspro/bin.  
Packit fcad23
Packit fcad23
The more common choice is gcc (2.95.3 or better have been tested)
Packit fcad23
available from sunfreeware.com.  If you install gcc, you do not
Packit fcad23
need the gcc libraries.  3.3.2 or later is recommended.
Packit fcad23
Packit fcad23
Given that net-snmp is developed to work on a wide variety of
Packit fcad23
platforms, but especially for linux, there's a better chance of
Packit fcad23
it working using gcc at any given time. We also do regular test
Packit fcad23
builds with Sun cc, though.
Packit fcad23
Packit fcad23
 -- Bruce Shaw <Bruce.Shaw at shaw.ca>
Packit fcad23
 -- Thomas Anders <tanders@users.sourceforge.net>
Packit fcad23
Packit fcad23
------------------------------------------------------------
Packit fcad23
Packit fcad23
2.  Disabling Sun's SNMP daemons
Packit fcad23
Packit fcad23
Note:  Sun has started to include net-snmp (version 5.0.9 plus their
Packit fcad23
patches) with Solaris 10 and later.  These instructions are written 
Packit fcad23
with Solaris 9 and previous in mind.
Packit fcad23
Packit fcad23
Out of the box, Sun runs four SNMP daemons: mibiisa, idmispd, 
Packit fcad23
snmpXdmid and snmpdx. 
Packit fcad23
Packit fcad23
These must be disabled before running net-snmp unless you are planning
Packit fcad23
on running them together (see Section 7 below).  Here is the procedure:
Packit fcad23
Packit fcad23
   cd /etc/rc3.d
Packit fcad23
   ./S76snmpdx stop
Packit fcad23
   ./S77dmi stop
Packit fcad23
   mv S76snmpdx s76snmpdx
Packit fcad23
   mv S77dmi s77dmi
Packit fcad23
Packit fcad23
If you are using Solstice Disksuite, you may also be running
Packit fcad23
mdlogd.  Leave this alone.
Packit fcad23
Packit fcad23
You will need to create a new script to start net-snmp.
Packit fcad23
See dist/snmpd-init.d and dist/snmptrapd-init.d for templates.
Packit fcad23
Packit fcad23
 -- Bruce Shaw <Bruce.Shaw at shaw.ca>
Packit fcad23
Packit fcad23
------------------------------------------------------------
Packit fcad23
Packit fcad23
3.  Compiling net-snmp
Packit fcad23
Packit fcad23
It is strongly recommended that you compile net-snmp from source.
Packit fcad23
That way you are guaranteed a working version for your specific 
Packit fcad23
configuration of operating system, applications and libraries.
Packit fcad23
Packit fcad23
If, for some reason, you cannot compile on a specific machine, 
Packit fcad23
there are binaries available for download (see section 4).  
Packit fcad23
In addition, you may create your own binaries (see section 6).
Packit fcad23
Packit fcad23
You need to set your $PATH.  This is extremely important
Packit fcad23
because otherwise there may be conflicts between the various 
Packit fcad23
components of the development environment.
Packit fcad23
Packit fcad23
If you are using FORTE:
Packit fcad23
Packit fcad23
PATH=/usr/bin:/usr/sbin:/usr/ccs/bin:/opt/SUNWspro/bin:/usr/local/bin:
Packit fcad23
Packit fcad23
If you are using gcc (installed in /usr/local/bin):
Packit fcad23
Packit fcad23
PATH=/usr/sbin:/usr/local/bin:/usr/ccs/bin:/usr/bin
Packit fcad23
Packit fcad23
Obtain a current version of net-snmp (which, if you're reading this,
Packit fcad23
presumably you have - don't you love recursion?) www.net-snmp.org/download/
Packit fcad23
Packit fcad23
Uncompress it and untar it in a working directory eg. /usr/local/src/net-snmp
Packit fcad23
Packit fcad23
In order to save a lot of typing, you should create a "configure" 
Packit fcad23
script eg. bcc.sh in the directory below eg. /usr/local/src.
Packit fcad23
Packit fcad23
   ./configure --with-mib-modules="ucd-snmp/lmSensors ucd-snmp/diskio \
Packit fcad23
      smux mibII/mta_sendmail" --with-cc=gcc
Packit fcad23
Packit fcad23
(note, see the long discussion about Perl below)
Packit fcad23
(note, substitute "cc" for "gcc" as appropriate)
Packit fcad23
(note, for LM-SENSORS-MIB support, see discussion below)
Packit fcad23
Packit fcad23
then call this script from the net-snmp directory ie ../bcc.sh
Packit fcad23
Packit fcad23
and answer the appropriate questions (usually with the default).
Packit fcad23
Packit fcad23
When it completes, you should see something like:
Packit fcad23
Packit fcad23
---------------------------------------------------------
Packit fcad23
            Net-SNMP configuration summary:
Packit fcad23
---------------------------------------------------------
Packit fcad23
Packit fcad23
  Net-SNMP Version:           5.4
Packit fcad23
  Building for:               solaris2
Packit fcad23
  Network transport support:  Callback Unix TCP UDP
Packit fcad23
  SNMPv3 Security Modules:    usm
Packit fcad23
  Agent MIB code:             mibII ucd_snmp snmpv3mibs notification target 
Packit fcad23
  \agent_mibs agentx agent_mibs utilities host disman/event-mib 
Packit fcad23
  \ucd-snmp/diskio smux agentx mibII/mta_sendmail
Packit fcad23
  SNMP Perl modules:          disabled
Packit fcad23
  Embedded perl support:      disabled
Packit fcad23
  Authentication support:     MD5 SHA1
Packit fcad23
  Encryption support:         DES
Packit fcad23
Packit fcad23
Type:
Packit fcad23
Packit fcad23
   make
Packit fcad23
Packit fcad23
and watch for compile errors.  
Packit fcad23
Packit fcad23
You will receive numerous warnings.  This is normal,
Packit fcad23
a side effect of supporting a variety of development environments.
Packit fcad23
Packit fcad23
Now type:
Packit fcad23
Packit fcad23
   make test
Packit fcad23
Packit fcad23
and watch for failures.  Also watch for the special tests for Solaris.
Packit fcad23
Packit fcad23
If you are satisfied with the tests, stop any snmpd daemons 
Packit fcad23
that may be running (see section 2) and type:
Packit fcad23
Packit fcad23
   make install
Packit fcad23
Packit fcad23
When complete, go on to section 5 below.
Packit fcad23
Packit fcad23
 -- Bruce Shaw <Bruce.Shaw at shaw.ca>
Packit fcad23
Packit fcad23
------------------------------------------------------------
Packit fcad23
Packit fcad23
4.  Obtaining and installing binaries
Packit fcad23
Packit fcad23
It is strongly recommended that you compile net-snmp from source.
Packit fcad23
That way you are guaranteed a working version for your specific
Packit fcad23
configuration of operating system, applications and libraries.
Packit fcad23
Packit fcad23
Binaries for Solaris may be found in two locations.
Packit fcad23
Packit fcad23
www.sunfreeware.com - this installs as a package.  
Packit fcad23
It does not have Perl support.
Packit fcad23
Packit fcad23
Therefore, I recommend:
Packit fcad23
Packit fcad23
   http://net-snmp.sourceforge.net/download/  (you will be redirected)
Packit fcad23
Packit fcad23
This is the official repository for binaries.
Packit fcad23
Packit fcad23
To determine which binary you need, you will need several pieces of
Packit fcad23
information.
Packit fcad23
Packit fcad23
-operating system version,
Packit fcad23
-hardware platform
Packit fcad23
-net-snmp version desired
Packit fcad23
Packit fcad23
The first two may be obtained by typing:
Packit fcad23
Packit fcad23
   uname -a
Packit fcad23
Packit fcad23
It will return something like:
Packit fcad23
Packit fcad23
SunOS foo 5.8 Generic_108528-14 sun4u sparc SUNW,Ultra-4
Packit fcad23
Packit fcad23
5.8 means Solaris 8
Packit fcad23
5.7 means Solaris 7  etc.
Packit fcad23
Packit fcad23
"sun4u" is the Ultra hardware platform
Packit fcad23
"sun4m" is SuperSPARC  eg. Sparc 5 or Sparc 10
Packit fcad23
"sun4d" is older SPARC boxes.  
Packit fcad23
Packit fcad23
You can then decode the binary version by its name eg.:
Packit fcad23
Packit fcad23
net-snmp_5.0.9-SunOS_5.8_sun4u.tar.gz
Packit fcad23
Packit fcad23
means "net-snmp version 5.0.9 for Solaris 8 running on Ultra
Packit fcad23
hardware".
Packit fcad23
Packit fcad23
Once you have found the appropriate version, download it to a
Packit fcad23
distribution directory (making one if necessary) eg. /usr/local/dist
Packit fcad23
Packit fcad23
Type the following: (using the sample above)
Packit fcad23
Packit fcad23
   cd /
Packit fcad23
   tar -xvf /usr/local/dist/net-snmp-5.0.9-SunOS_5.8_sun4u.tar
Packit fcad23
Packit fcad23
The binaries, libraries, etc. will be installed in /usr/local.
Packit fcad23
Packit fcad23
Remove the tar file to save space.  Create an snmpd.conf (see below)
Packit fcad23
or use an existing one from another machine.
Packit fcad23
It installs in /usr/local/share/snmp.
Packit fcad23
Packit fcad23
Install a startup script (see section 1).
Packit fcad23
Packit fcad23
For further information, see README.solaris.binaries.x that ships
Packit fcad23
with the binaries.
Packit fcad23
Packit fcad23
--Bruce Shaw <Bruce.Shaw at shaw.ca>
Packit fcad23
Packit fcad23
------------------------------------------------------------
Packit fcad23
Packit fcad23
5.  Creating snmpd.conf and testing
Packit fcad23
Packit fcad23
When everything is installed, run:
Packit fcad23
Packit fcad23
   snmpconf -g basic_setup
Packit fcad23
Packit fcad23
and answer the questions appropriately.  If you are using
Packit fcad23
the defaults, place the resulting snmpd.conf file in:
Packit fcad23
Packit fcad23
/usr/local/share/snmp/snmpd.conf
Packit fcad23
Packit fcad23
A security note - use of the "public" community is deprecated.
Packit fcad23
This example uses "whatever" as a community.
Packit fcad23
Packit fcad23
When you have the daemon running either with the script above or running:
Packit fcad23
Packit fcad23
   /usr/local/sbin/snmpd
Packit fcad23
Packit fcad23
test the daemon's functionality by typing:
Packit fcad23
Packit fcad23
   snmpget -v 1 -c whatever localhost sysUpTime.0
Packit fcad23
   snmpwalk -v 2c -c whatever -m ALL localhost .1.3 | more
Packit fcad23
Packit fcad23
and paging through the results.  
Packit fcad23
Packit fcad23
If you have problems, you can examine diagnostic messages
Packit fcad23
by running:
Packit fcad23
Packit fcad23
   /usr/local/sbin/snmpd -f -Le
Packit fcad23
Packit fcad23
or use gdb (available from www.sunsolve.com) as follows:
Packit fcad23
Packit fcad23
   cd /usr/local/sbin
Packit fcad23
   gdb snmpd
Packit fcad23
   run -f -Le
Packit fcad23
Packit fcad23
and when it blows up:
Packit fcad23
Packit fcad23
   bt
Packit fcad23
Packit fcad23
to get the backtrace.  
Packit fcad23
Packit fcad23
You can use:
Packit fcad23
Packit fcad23
   run -f -Le -D <modulename>
Packit fcad23
Packit fcad23
to display debug messages.
Packit fcad23
Packit fcad23
To display all debug messages type:
Packit fcad23
Packit fcad23
   run -f -Le -D ALL 
Packit fcad23
Packit fcad23
but this will be extremely verbose.
Packit fcad23
Packit fcad23
 -- Bruce Shaw <Bruce.Shaw at shaw.ca> with suggestions by Thushara Wickram
Packit fcad23
Packit fcad23
------------------------------------------------------------
Packit fcad23
Packit fcad23
6.  Creating your own binaries
Packit fcad23
Packit fcad23
Pick an appropriate name for a tarfile 
Packit fcad23
eg. net-snmp-5.4.custom-SunOS_5.8_sun4u.tar (see above)
Packit fcad23
(this particular one means "a customized version of
Packit fcad23
net-snmp 5.4 that works under Solaris 8 running on Ultra hardware")
Packit fcad23
Packit fcad23
Create an empty directory such as /usr/local/dist, then do the following
Packit fcad23
from the source directory (using the example above):
Packit fcad23
Packit fcad23
   make install prefix=/usr/local/dist/usr/local \
Packit fcad23
        exec_prefix=/usr/local/dist/usr/local
Packit fcad23
   cd /usr/local/dist
Packit fcad23
   tar -cvf net-snmp-5.4.custom-SunOS_5.8_sun4u.tar usr
Packit fcad23
Packit fcad23
Transfer this file to the machine where you want to install from binary.
Packit fcad23
Place it in a distribution directory eg. /usr/local/dist
Packit fcad23
Type the following (using the example above):
Packit fcad23
Packit fcad23
   cd /
Packit fcad23
   tar -xvf /usr/local/dist/net-snmp-5.4.custom-SunOS_5.8_sun4u.tar
Packit fcad23
Packit fcad23
Remove the tar file to save space.  Create an snmpd.conf (see above)
Packit fcad23
or use an existing one from another machine.  If you are using
Packit fcad23
the defaults, it installs in /usr/local/share/snmp.  Install
Packit fcad23
a startup script (see section 2).
Packit fcad23
Packit fcad23
Note that if you create a binary with Perl support (see below) an
Packit fcad23
identically configured Perl needs to be installed as well.
Packit fcad23
Packit fcad23
 -- Bruce Shaw <Bruce.Shaw at shaw.ca>
Packit fcad23
Packit fcad23
------------------------------------------------------------
Packit fcad23
Packit fcad23
7.  Using Sun's SNMP daemon and net-snmp together
Packit fcad23
Packit fcad23
Net-SNMP may be used as a subagent in conjunction with Sun's snmpdx daemon.
Packit fcad23
Packit fcad23
To do this, you will need to modify several files, 
Packit fcad23
all located in /etc/snmp/conf.
Packit fcad23
Packit fcad23
First, do the following:
Packit fcad23
Packit fcad23
   /etc/rc3.d/S76snmpdx stop (assuming you haven't done so already, and...)
Packit fcad23
   /etc/rc3.d/S77dmi stop    (...assuming you haven't renamed them)
Packit fcad23
Packit fcad23
   cd /etc/snmp/conf
Packit fcad23
   cp snmpd.conf snmpd.conf.orig
Packit fcad23
   cp snmpdx.acl snmpdx.acl.orig
Packit fcad23
   cp snmpdx.reg snmpdx.reg.orig
Packit fcad23
   cp snmpdx.rsrc snmpdx.rsrc.orig
Packit fcad23
   cp mibiisa.reg mibiisa.reg.orig
Packit fcad23
   cp mibiisa.rsrc mibiisa.rsrc.orig
Packit fcad23
Packit fcad23
modify snmpd.conf with the correct:
Packit fcad23
Packit fcad23
   sysdescr
Packit fcad23
   syscontact
Packit fcad23
   sysLocation
Packit fcad23
   system-group-read-community
Packit fcad23
   read-community (in my example below I will use community "whatever")
Packit fcad23
   trap 
Packit fcad23
   trap-community
Packit fcad23
   managers (leave blank for all)
Packit fcad23
Packit fcad23
modify snmpdx.acl with the correct:
Packit fcad23
Packit fcad23
   trap-community
Packit fcad23
   trap-recipients
Packit fcad23
   communities
Packit fcad23
   access
Packit fcad23
Packit fcad23
Make sure that in snmpdx.reg the port is 161.
Packit fcad23
Packit fcad23
You will now need to add two files - net-snmp.reg and net-snmp.rsrc
Packit fcad23
Packit fcad23
In this example, "subtrees" is set for HOST-RESOURCES-MIB, and UCD-SNMP-MIB.
Packit fcad23
Do not use net-snmp's MIB-2 information as this is already provided by 
Packit fcad23
Sun's mib and may cause a conflict.
Packit fcad23
Packit fcad23
::::: net-snmp.reg ::::::
Packit fcad23
Packit fcad23
# net-snmp.reg
Packit fcad23
# mib-2 is already provided by the mibiisa process
Packit fcad23
# that is a default sub agent of snmpdx
Packit fcad23
# we are specifying only hostmib and ucd 
Packit fcad23
##########
Packit fcad23
# agents #
Packit fcad23
##########
Packit fcad23
 
Packit fcad23
# The following 3 macros are predefined:
Packit fcad23
#
Packit fcad23
#       mib-2      =    1.3.6.1.2.1
Packit fcad23
#       enterprise =    1.3.6.1.4.1
Packit fcad23
#       sun        =    1.3.6.1.4.1.42
Packit fcad23
#
Packit fcad23
# You can define your own macros, so that you can
Packit fcad23
# manipulate strings instead of OIDs in defining the agent.
Packit fcad23
# See the "agent" section below.
Packit fcad23
Packit fcad23
macros =
Packit fcad23
{
Packit fcad23
        host = mib-2.25
Packit fcad23
        ucd  = enterprise.2021
Packit fcad23
}
Packit fcad23
Packit fcad23
agents =
Packit fcad23
{
Packit fcad23
        {
Packit fcad23
                 name = "net-snmp"
Packit fcad23
                 subtrees = { host,ucd }
Packit fcad23
                 timeout = 2000000
Packit fcad23
                 watch-dog-time = 86400
Packit fcad23
        }
Packit fcad23
}
Packit fcad23
Packit fcad23
::::::::::::::::::
Packit fcad23
Packit fcad23
::::: net-snmp.rsrc ::::::
Packit fcad23
Packit fcad23
# /etc/snmp/conf/net-snmp.rsrc
Packit fcad23
Packit fcad23
resource =
Packit fcad23
{
Packit fcad23
        {
Packit fcad23
                registration_file = "/etc/snmp/conf/net-snmp.reg"
Packit fcad23
                policy = "spawn"
Packit fcad23
                type = "legacy"
Packit fcad23
                command = "/usr/local/sbin/snmpd $PORT"  
Packit fcad23
      }
Packit fcad23
 
Packit fcad23
}
Packit fcad23
Packit fcad23
::::::::::::::::::
Packit fcad23
Packit fcad23
Stop any net-snmp processes that may be running.  
Packit fcad23
Packit fcad23
Start Sun's daemons by typing:
Packit fcad23
Packit fcad23
   /etc/rc3.d/S76snmpdx start (assuming you haven't renamed it)
Packit fcad23
   /etc/rc3.d/S77dmi start    (assuming you haven't renamed it)
Packit fcad23
Packit fcad23
Wait a moment for everything to stabilize, then try these two queries:
Packit fcad23
Packit fcad23
   snmpget -v 1 -c whatever localhost sysDescr.0
Packit fcad23
   snmpget -v 1 -c whatever localhost hrSystemUptime.0
Packit fcad23
Packit fcad23
You should see something like:
Packit fcad23
Packit fcad23
   SNMPv2-MIB::sysDescr.0 = STRING: SunOS foo 5.6 Generic_105181-30 sun4u
Packit fcad23
Packit fcad23
which is Sun's daemon talking, and:
Packit fcad23
Packit fcad23
   HOST-RESOURCES-MIB::hrSystemUptime.0 = Timeticks: (78540910) 9 days, 2:10:09.10
Packit fcad23
Packit fcad23
which is net-snmp talking.  It is acting as a sub-agent through Sun's daemon.
Packit fcad23
Packit fcad23
If Sun's daemons fail, you will need to shut down the snmpd daemons by typing:
Packit fcad23
Packit fcad23
   pkill snmpd
Packit fcad23
Packit fcad23
Then do the following:
Packit fcad23
Packit fcad23
   /etc/rc3.d/S76snmpdx stop  (assuming you haven't renamed it)
Packit fcad23
   /etc/rc3.d/S77dmi stop     (assuming you haven't renamed it)
Packit fcad23
   /etc/rc3.d/S76snmpdx start (assuming you haven't renamed it)
Packit fcad23
   /etc/rc3.d/S77dmi start    (assuming you haven't renamed it)
Packit fcad23
Packit fcad23
rather than trying to individually clobber all the various Sun daemons.
Packit fcad23
Packit fcad23
This configuration appears to deal properly with snmpgets 
Packit fcad23
and handle mistakes gracefully.
Packit fcad23
Packit fcad23
Beyond this, your mileage may vary.
Packit fcad23
Packit fcad23
You may wish to modify the subtrees in net-snmp.reg as you find things
Packit fcad23
that do and don't work.  Remember to keep backup copies of working
Packit fcad23
configurations.
Packit fcad23
Packit fcad23
 -- Bruce Shaw <Bruce.Shaw at shaw.ca> from notes by Stefan Radman and C Wells
Packit fcad23
Packit fcad23
------------------------------------------------------------
Packit fcad23
Packit fcad23
8.  Monitoring disks, processes and execs (DISMAN-EVENT-MIB)
Packit fcad23
Packit fcad23
Important note: this section only applies to the old DISMAN-EVENT-MIB 
Packit fcad23
implementation called "disman/event-mib", *not* the current "disman/event" 
Packit fcad23
mib module which is active by default since net-snmp 5.3 and later.
Packit fcad23
Packit fcad23
For a full explanation of using DISMAN-EVENT-MIB, see:
Packit fcad23
Packit fcad23
http://www.net-snmp.org/man/snmpd.conf.html
Packit fcad23
Packit fcad23
To use this component, net-snmp must be compiled with the option..
Packit fcad23
Packit fcad23
--with-mib-modules="disman/event-mib"
Packit fcad23
Packit fcad23
This discussion concerns the use of DISMAN-EVENT-MIB with Solaris.
Packit fcad23
Packit fcad23
There is a bug preventing the use of some of its functionality.  This
Packit fcad23
discussion will document what is known to work and how to use it.
Packit fcad23
Packit fcad23
The problem revolves around the use of monitors.  The...
Packit fcad23
Packit fcad23
defaultMonitors yes
Packit fcad23
Packit fcad23
token will NOT work for reasons discussed below.  I suspect that the
Packit fcad23
notificationEvent tokens will not work for the same reason but this
Packit fcad23
has not been tested.  Your mileage may vary.  Same with includeAllDisks.
Packit fcad23
Packit fcad23
The documentation suggests using...
Packit fcad23
Packit fcad23
monitor -o prNames -o prErrMessage "process table" prErrorFlag != 0
Packit fcad23
Packit fcad23
to monitor all processes.  This will fail with ambiguous results.
Packit fcad23
Packit fcad23
To monitor processes, put a separate monitor line for each process.
Packit fcad23
Packit fcad23
For example:
Packit fcad23
######
Packit fcad23
proc smail
Packit fcad23
proc mdlogd
Packit fcad23
Packit fcad23
monitor -r 30 -i -o prNames.1 -o prErrMessage.1 "Process smail" prErrorFlag.1 !=0
Packit fcad23
monitor -r 30 -i -o prNames.2 -o prErrMessage.2 "Process Solstice Disksuite SNMP trap" prErrorFlag.2 !=0
Packit fcad23
Packit fcad23
To monitor disks, do the same.  An example:
Packit fcad23
Packit fcad23
########
Packit fcad23
# This example sends a trap if root has less than 10% available and /usr6 less t
Packit fcad23
han 90%
Packit fcad23
#
Packit fcad23
disk / 10%
Packit fcad23
disk /usr6 90%
Packit fcad23
Packit fcad23
monitor -i -r 30 -o dskPath.1 -o dskErrorMsg.1 "root file system" dskErrorFlag.1 !=0
Packit fcad23
monitor -i -r 30 -o dskPath.2 -o dskErrorMsg.2 "ORACLE file system" dskErrorFlag.2 != 0
Packit fcad23
#########
Packit fcad23
Packit fcad23
To implement an external program then monitor its results you need to set up your script.
Packit fcad23
Packit fcad23
Here is a sample script.
Packit fcad23
Packit fcad23
#!//usr/bin/ksh
Packit fcad23
xstatus=0
Packit fcad23
Packit fcad23
if [ $xstatus -eq 0 ];then
Packit fcad23
echo success: $0
Packit fcad23
else
Packit fcad23
echo FAILURE: $0
Packit fcad23
fi
Packit fcad23
Packit fcad23
exit $xstatus
Packit fcad23
###end of script tester##
Packit fcad23
Packit fcad23
Place this script in /usr/local/src and make it executable.  Make copies called
Packit fcad23
tester1, tester2 etc.
Packit fcad23
and make them executable.
Packit fcad23
Packit fcad23
Here is a sample snmpd.conf snippet that makes use of the exec feature:
Packit fcad23
##############
Packit fcad23
Packit fcad23
exec tester1 /usr/local/src/tester1
Packit fcad23
exec tester2 /usr/local/src/tester2
Packit fcad23
exec tester3 /usr/local/src/tester3
Packit fcad23
exec tester4 /usr/local/src/tester4
Packit fcad23
exec tester5 /usr/local/src/tester5
Packit fcad23
Packit fcad23
monitor -i -r 60 -o extNames.1 -o extOutput.1 "status table 1" extResult.1 != 0
Packit fcad23
monitor -i -r 60 -o extNames.2 -o extOutput.2 "status table 2" extResult.2 != 0
Packit fcad23
monitor -i -r 60 -o extNames.3 -o extOutput.3 "status table 3" extResult.3 != 0
Packit fcad23
monitor -i -r 60 -o extNames.4 -o extOutput.4 "status table 4" extResult.4 != 0
Packit fcad23
monitor -i -r 60 -o extNames.5 -o extOutput.5 "status table 5" extResult.5 != 0
Packit fcad23
##############
Packit fcad23
Packit fcad23
While snmpd is running, go to /usr/local/src and modify one of the tester programs eg. tester1
Packit fcad23
Packit fcad23
xstatus=1
Packit fcad23
Packit fcad23
and save the file.  Sometime in the next 60 seconds, a trap will be generated.
Packit fcad23
Change the value back to 0, then modify another file.
Packit fcad23
Packit fcad23
If you are unsure of the correct row number within a specific table, do an snmpwalk eg.
Packit fcad23
Packit fcad23
snmpwalk -v 2c -c public -m ALL localhost prNames
Packit fcad23
Packit fcad23
The same methodology can presumably be used for fileName and laNames.  Your mileage may vary.
Packit fcad23
Packit fcad23
Packit fcad23
 -- Bruce Shaw <Bruce.Shaw at shaw.ca>  with Allan McIntosh and Wes Hardaker
Packit fcad23
Packit fcad23
------------------------------------------------------------
Packit fcad23
Packit fcad23
9.  Monitoring CPU temp, fan and power supply sensors (LM-SENSORS-MIB)
Packit fcad23
Packit fcad23
Note: This module (ucd-snmp/lmSensors) works in "read only" mode to examine 
Packit fcad23
sensors.  It cannot change switch or fan settings.
Packit fcad23
Packit fcad23
It has been tested at least on the following platforms:
Packit fcad23
Packit fcad23
Enterprise 450
Packit fcad23
V880
Packit fcad23
280R
Packit fcad23
Packit fcad23
If you have information about other platforms this is desperately needed.  For 
Packit fcad23
example, the only "state" that I'm aware of for an i2c is "OK".  The more
Packit fcad23
information we have, the richer the components.
Packit fcad23
Packit fcad23
Please report any performance statistics, bugs or omissions to the users list.
Packit fcad23
Please report any code suggestions to the coders list.  See links below.
Packit fcad23
Packit fcad23
Packit fcad23
This component delivers information that you would normally see by typing:
Packit fcad23
Packit fcad23
/usr/platform/`uname -m`/sbin/prtdiag -v
Packit fcad23
Packit fcad23
At present this is only supported on the Ultra (sun4u) platform.
Packit fcad23
Packit fcad23
To display this information, net-snmp must be compiled with the option:
Packit fcad23
Packit fcad23
--with-mib-modules="ucd-snmp/lmSensors"
Packit fcad23
Packit fcad23
Early Ultra servers such as the Ultra 1 or Ultra 2 did not report
Packit fcad23
any sensor information at all.  Later servers, such as the Enterprise 450
Packit fcad23
reported this information using kstat.  Sun's latest servers make use
Packit fcad23
of the picld daemon to control system resources and report fan information.
Packit fcad23
This module reads in the information from picld.  It cannot modify settings.
Packit fcad23
Packit fcad23
You can see this information by typing:
Packit fcad23
Packit fcad23
prtpicl -v | more
Packit fcad23
Packit fcad23
The following is typical output from net-snmp:
Packit fcad23
Packit fcad23
E450# snmpwalk -v 2c -c public -m ALL localhost lmSensors
Packit fcad23
LM-SENSORS-MIB::lmTempSensorsIndex.1 = INTEGER: 0
Packit fcad23
LM-SENSORS-MIB::lmTempSensorsIndex.2 = INTEGER: 1
Packit fcad23
LM-SENSORS-MIB::lmTempSensorsIndex.3 = INTEGER: 2
Packit fcad23
LM-SENSORS-MIB::lmTempSensorsIndex.4 = INTEGER: 3
Packit fcad23
LM-SENSORS-MIB::lmTempSensorsDevice.1 = STRING: Ambient
Packit fcad23
LM-SENSORS-MIB::lmTempSensorsDevice.2 = STRING: CPU1
Packit fcad23
LM-SENSORS-MIB::lmTempSensorsDevice.3 = STRING: CPU2
Packit fcad23
LM-SENSORS-MIB::lmTempSensorsDevice.4 = STRING: CPU3
Packit fcad23
LM-SENSORS-MIB::lmTempSensorsValue.1 = Gauge32: 22
Packit fcad23
LM-SENSORS-MIB::lmTempSensorsValue.2 = Gauge32: 45
Packit fcad23
LM-SENSORS-MIB::lmTempSensorsValue.3 = Gauge32: 46
Packit fcad23
LM-SENSORS-MIB::lmTempSensorsValue.4 = Gauge32: 49
Packit fcad23
LM-SENSORS-MIB::lmFanSensorsIndex.1 = INTEGER: 0
Packit fcad23
LM-SENSORS-MIB::lmFanSensorsIndex.2 = INTEGER: 1
Packit fcad23
LM-SENSORS-MIB::lmFanSensorsIndex.3 = INTEGER: 2
Packit fcad23
LM-SENSORS-MIB::lmFanSensorsDevice.1 = STRING: fan type CPU number 0
Packit fcad23
LM-SENSORS-MIB::lmFanSensorsDevice.2 = STRING: fan type PWR number 0
Packit fcad23
LM-SENSORS-MIB::lmFanSensorsDevice.3 = STRING: fan type AFB number 0
Packit fcad23
LM-SENSORS-MIB::lmFanSensorsValue.1 = Gauge32: 33
Packit fcad23
LM-SENSORS-MIB::lmFanSensorsValue.2 = Gauge32: 31
Packit fcad23
LM-SENSORS-MIB::lmFanSensorsValue.3 = Gauge32: 63
Packit fcad23
LM-SENSORS-MIB::lmVoltSensorsIndex.1 = INTEGER: 0
Packit fcad23
LM-SENSORS-MIB::lmVoltSensorsIndex.2 = INTEGER: 1
Packit fcad23
LM-SENSORS-MIB::lmVoltSensorsIndex.3 = INTEGER: 2
Packit fcad23
LM-SENSORS-MIB::lmVoltSensorsDevice.1 = STRING: power supply 0
Packit fcad23
LM-SENSORS-MIB::lmVoltSensorsDevice.2 = STRING: power supply 1
Packit fcad23
LM-SENSORS-MIB::lmVoltSensorsDevice.3 = STRING: power supply 2
Packit fcad23
LM-SENSORS-MIB::lmVoltSensorsValue.1 = Gauge32: 38
Packit fcad23
LM-SENSORS-MIB::lmVoltSensorsValue.2 = Gauge32: 39
Packit fcad23
LM-SENSORS-MIB::lmVoltSensorsValue.3 = Gauge32: 39
Packit fcad23
LM-SENSORS-MIB::lmMiscSensorsIndex.1 = INTEGER: 0
Packit fcad23
LM-SENSORS-MIB::lmMiscSensorsIndex.2 = INTEGER: 1
Packit fcad23
LM-SENSORS-MIB::lmMiscSensorsIndex.3 = INTEGER: 2
Packit fcad23
LM-SENSORS-MIB::lmMiscSensorsDevice.1 = STRING: FSP
Packit fcad23
LM-SENSORS-MIB::lmMiscSensorsDevice.2 = STRING: Backplane4
Packit fcad23
LM-SENSORS-MIB::lmMiscSensorsDevice.3 = STRING: Backplane8
Packit fcad23
LM-SENSORS-MIB::lmMiscSensorsValue.1 = Gauge32: 192
Packit fcad23
LM-SENSORS-MIB::lmMiscSensorsValue.2 = Gauge32: 0
Packit fcad23
LM-SENSORS-MIB::lmMiscSensorsValue.3 = Gauge32: 0
Packit fcad23
Packit fcad23
V880# snmpwalk -v 2c -c public -m ALL localhost lmSensors
Packit fcad23
LM-SENSORS-MIB::lmTempSensorsIndex.1 = INTEGER: 0
Packit fcad23
LM-SENSORS-MIB::lmTempSensorsIndex.2 = INTEGER: 1
Packit fcad23
LM-SENSORS-MIB::lmTempSensorsIndex.3 = INTEGER: 2
Packit fcad23
LM-SENSORS-MIB::lmTempSensorsIndex.4 = INTEGER: 3
Packit fcad23
LM-SENSORS-MIB::lmTempSensorsIndex.5 = INTEGER: 4
Packit fcad23
LM-SENSORS-MIB::lmTempSensorsIndex.6 = INTEGER: 5
Packit fcad23
LM-SENSORS-MIB::lmTempSensorsIndex.7 = INTEGER: 6
Packit fcad23
LM-SENSORS-MIB::lmTempSensorsIndex.8 = INTEGER: 7
Packit fcad23
LM-SENSORS-MIB::lmTempSensorsIndex.9 = INTEGER: 8
Packit fcad23
LM-SENSORS-MIB::lmTempSensorsIndex.10 = INTEGER: 9
Packit fcad23
LM-SENSORS-MIB::lmTempSensorsDevice.1 = STRING: CPU0_DIE_TEMPERATURE_SENSOR
Packit fcad23
LM-SENSORS-MIB::lmTempSensorsDevice.2 = STRING: CPU2_DIE_TEMPERATURE_SENSOR
Packit fcad23
LM-SENSORS-MIB::lmTempSensorsDevice.3 = STRING: CPU1_DIE_TEMPERATURE_SENSOR
Packit fcad23
LM-SENSORS-MIB::lmTempSensorsDevice.4 = STRING: CPU3_DIE_TEMPERATURE_SENSOR
Packit fcad23
LM-SENSORS-MIB::lmTempSensorsDevice.5 = STRING: CPU4_DIE_TEMPERATURE_SENSOR
Packit fcad23
LM-SENSORS-MIB::lmTempSensorsDevice.6 = STRING: CPU6_DIE_TEMPERATURE_SENSOR
Packit fcad23
LM-SENSORS-MIB::lmTempSensorsDevice.7 = STRING: MB_AMB_TEMPERATURE_SENSOR
Packit fcad23
LM-SENSORS-MIB::lmTempSensorsDevice.8 = STRING: IOB_AMB_TEMPERATURE_SENSOR
Packit fcad23
LM-SENSORS-MIB::lmTempSensorsDevice.9 = STRING: DBP0_AMB_TEMPERATURE_SENSOR
Packit fcad23
LM-SENSORS-MIB::lmTempSensorsDevice.10 = STRING: DBP1_AMB_TEMPERATURE_SENSOR
Packit fcad23
LM-SENSORS-MIB::lmTempSensorsValue.1 = Gauge32: 71
Packit fcad23
LM-SENSORS-MIB::lmTempSensorsValue.2 = Gauge32: 60
Packit fcad23
LM-SENSORS-MIB::lmTempSensorsValue.3 = Gauge32: 66
Packit fcad23
LM-SENSORS-MIB::lmTempSensorsValue.4 = Gauge32: 59
Packit fcad23
LM-SENSORS-MIB::lmTempSensorsValue.5 = Gauge32: 65
Packit fcad23
LM-SENSORS-MIB::lmTempSensorsValue.6 = Gauge32: 69
Packit fcad23
LM-SENSORS-MIB::lmTempSensorsValue.7 = Gauge32: 28
Packit fcad23
LM-SENSORS-MIB::lmTempSensorsValue.8 = Gauge32: 25
Packit fcad23
LM-SENSORS-MIB::lmTempSensorsValue.9 = Gauge32: 25
Packit fcad23
LM-SENSORS-MIB::lmTempSensorsValue.10 = Gauge32: 24
Packit fcad23
LM-SENSORS-MIB::lmFanSensorsIndex.1 = INTEGER: 0
Packit fcad23
LM-SENSORS-MIB::lmFanSensorsIndex.2 = INTEGER: 1
Packit fcad23
LM-SENSORS-MIB::lmFanSensorsIndex.3 = INTEGER: 2
Packit fcad23
LM-SENSORS-MIB::lmFanSensorsIndex.4 = INTEGER: 3
Packit fcad23
LM-SENSORS-MIB::lmFanSensorsIndex.5 = INTEGER: 4
Packit fcad23
LM-SENSORS-MIB::lmFanSensorsIndex.6 = INTEGER: 5
Packit fcad23
LM-SENSORS-MIB::lmFanSensorsIndex.7 = INTEGER: 6
Packit fcad23
LM-SENSORS-MIB::lmFanSensorsIndex.8 = INTEGER: 7
Packit fcad23
LM-SENSORS-MIB::lmFanSensorsIndex.9 = INTEGER: 8
Packit fcad23
LM-SENSORS-MIB::lmFanSensorsIndex.10 = INTEGER: 9
Packit fcad23
LM-SENSORS-MIB::lmFanSensorsDevice.1 = STRING: CPU0_PFAN_TACH
Packit fcad23
LM-SENSORS-MIB::lmFanSensorsDevice.2 = STRING: CPU1_PFAN_TACH
Packit fcad23
LM-SENSORS-MIB::lmFanSensorsDevice.3 = STRING: CPU0_SFAN_TACH
Packit fcad23
LM-SENSORS-MIB::lmFanSensorsDevice.4 = STRING: CPU1_SFAN_TACH
Packit fcad23
LM-SENSORS-MIB::lmFanSensorsDevice.5 = STRING: IO_BRIDGE_PFAN_TACH
Packit fcad23
LM-SENSORS-MIB::lmFanSensorsDevice.6 = STRING: IO_BRIDGE_SFAN_TACH
Packit fcad23
LM-SENSORS-MIB::lmFanSensorsDevice.7 = STRING: IO0_PFAN_TACH
Packit fcad23
LM-SENSORS-MIB::lmFanSensorsDevice.8 = STRING: IO1_PFAN_TACH
Packit fcad23
LM-SENSORS-MIB::lmFanSensorsDevice.9 = STRING: IO0_SFAN_TACH
Packit fcad23
LM-SENSORS-MIB::lmFanSensorsDevice.10 = STRING: IO1_SFAN_TACH
Packit fcad23
LM-SENSORS-MIB::lmFanSensorsValue.1 = Gauge32: 2439
Packit fcad23
LM-SENSORS-MIB::lmFanSensorsValue.2 = Gauge32: 2586
Packit fcad23
LM-SENSORS-MIB::lmFanSensorsValue.3 = Gauge32: 2459
Packit fcad23
LM-SENSORS-MIB::lmFanSensorsValue.4 = Gauge32: 2564
Packit fcad23
LM-SENSORS-MIB::lmFanSensorsValue.5 = Gauge32: 3409
Packit fcad23
LM-SENSORS-MIB::lmFanSensorsValue.6 = Gauge32: 0
Packit fcad23
LM-SENSORS-MIB::lmFanSensorsValue.7 = Gauge32: 3947
Packit fcad23
LM-SENSORS-MIB::lmFanSensorsValue.8 = Gauge32: 3896
Packit fcad23
LM-SENSORS-MIB::lmFanSensorsValue.9 = Gauge32: 4000
Packit fcad23
LM-SENSORS-MIB::lmFanSensorsValue.10 = Gauge32: 3896
Packit fcad23
LM-SENSORS-MIB::lmVoltSensorsIndex.1 = INTEGER: 0
Packit fcad23
LM-SENSORS-MIB::lmVoltSensorsIndex.2 = INTEGER: 1
Packit fcad23
LM-SENSORS-MIB::lmVoltSensorsIndex.3 = INTEGER: 2
Packit fcad23
LM-SENSORS-MIB::lmVoltSensorsIndex.4 = INTEGER: 3
Packit fcad23
LM-SENSORS-MIB::lmVoltSensorsIndex.5 = INTEGER: 4
Packit fcad23
LM-SENSORS-MIB::lmVoltSensorsIndex.6 = INTEGER: 5
Packit fcad23
LM-SENSORS-MIB::lmVoltSensorsIndex.7 = INTEGER: 6
Packit fcad23
LM-SENSORS-MIB::lmVoltSensorsIndex.8 = INTEGER: 7
Packit fcad23
LM-SENSORS-MIB::lmVoltSensorsIndex.9 = INTEGER: 8
Packit fcad23
LM-SENSORS-MIB::lmVoltSensorsIndex.10 = INTEGER: 9
Packit fcad23
LM-SENSORS-MIB::lmVoltSensorsIndex.11 = INTEGER: 10
Packit fcad23
LM-SENSORS-MIB::lmVoltSensorsIndex.12 = INTEGER: 11
Packit fcad23
LM-SENSORS-MIB::lmVoltSensorsDevice.1 = STRING: PS0_3_3V_I_SENSOR
Packit fcad23
LM-SENSORS-MIB::lmVoltSensorsDevice.2 = STRING: PS0_5V_I_SENSOR
Packit fcad23
LM-SENSORS-MIB::lmVoltSensorsDevice.3 = STRING: PS0_12V_I_SENSOR
Packit fcad23
LM-SENSORS-MIB::lmVoltSensorsDevice.4 = STRING: PS0_48V_I_SENSOR
Packit fcad23
LM-SENSORS-MIB::lmVoltSensorsDevice.5 = STRING: PS1_3_3V_I_SENSOR
Packit fcad23
LM-SENSORS-MIB::lmVoltSensorsDevice.6 = STRING: PS1_5V_I_SENSOR
Packit fcad23
LM-SENSORS-MIB::lmVoltSensorsDevice.7 = STRING: PS1_12V_I_SENSOR
Packit fcad23
LM-SENSORS-MIB::lmVoltSensorsDevice.8 = STRING: PS1_48V_I_SENSOR
Packit fcad23
LM-SENSORS-MIB::lmVoltSensorsDevice.9 = STRING: PS2_3_3V_I_SENSOR
Packit fcad23
LM-SENSORS-MIB::lmVoltSensorsDevice.10 = STRING: PS2_5V_I_SENSOR
Packit fcad23
LM-SENSORS-MIB::lmVoltSensorsDevice.11 = STRING: PS2_12V_I_SENSOR
Packit fcad23
LM-SENSORS-MIB::lmVoltSensorsDevice.12 = STRING: PS2_48V_I_SENSOR
Packit fcad23
LM-SENSORS-MIB::lmVoltSensorsValue.1 = Gauge32: 6
Packit fcad23
LM-SENSORS-MIB::lmVoltSensorsValue.2 = Gauge32: 4
Packit fcad23
LM-SENSORS-MIB::lmVoltSensorsValue.3 = Gauge32: 3
Packit fcad23
LM-SENSORS-MIB::lmVoltSensorsValue.4 = Gauge32: 4
Packit fcad23
LM-SENSORS-MIB::lmVoltSensorsValue.5 = Gauge32: 6
Packit fcad23
LM-SENSORS-MIB::lmVoltSensorsValue.6 = Gauge32: 4
Packit fcad23
LM-SENSORS-MIB::lmVoltSensorsValue.7 = Gauge32: 3
Packit fcad23
LM-SENSORS-MIB::lmVoltSensorsValue.8 = Gauge32: 4
Packit fcad23
LM-SENSORS-MIB::lmVoltSensorsValue.9 = Gauge32: 6
Packit fcad23
LM-SENSORS-MIB::lmVoltSensorsValue.10 = Gauge32: 4
Packit fcad23
LM-SENSORS-MIB::lmVoltSensorsValue.11 = Gauge32: 3
Packit fcad23
LM-SENSORS-MIB::lmVoltSensorsValue.12 = Gauge32: 4
Packit fcad23
Packit fcad23
This component also reports information for switches, LEDs
Packit fcad23
and i2c's (devices accessing the i2c bus).
Packit fcad23
Because the MIB only allows us to display numeric
Packit fcad23
information a certain amount of translation has been done.
Packit fcad23
Packit fcad23
Switches:
Packit fcad23
Packit fcad23
0 = OFF
Packit fcad23
1 = ON
Packit fcad23
2 = NORMAL
Packit fcad23
3 = LOCKED
Packit fcad23
4 = UNKNOWN
Packit fcad23
5 = DIAG
Packit fcad23
6 = SECURE
Packit fcad23
99 = other
Packit fcad23
Packit fcad23
LEDs:
Packit fcad23
Packit fcad23
0 = OFF
Packit fcad23
1 = ON
Packit fcad23
2 = BLINK (this may not exist)
Packit fcad23
99 = other
Packit fcad23
Packit fcad23
i2c's:
Packit fcad23
0 = OK
Packit fcad23
99 = other
Packit fcad23
Packit fcad23
In order to prevent inordinant consumption of machine resources,
Packit fcad23
some sensor information is cached.  Currently, information
Packit fcad23
retrieved from picld is cached for six seconds.  
Packit fcad23
Packit fcad23
 -- Bruce Shaw <Bruce.Shaw at shaw.ca>
Packit fcad23
Packit fcad23
------------------------------------------------------------
Packit fcad23
Packit fcad23
10.  MIB rewrites for IF-MIB, TCP-MIB and UDP-MIB
Packit fcad23
Packit fcad23
net-snmp 5.4 has started to include rewrites for the IF-MIB, TCP-MIB and
Packit fcad23
UDP-MIB implementations. They need to be explicitely enabled, though:
Packit fcad23
Packit fcad23
  ./configure --enable-mfd-rewrites ...
Packit fcad23
Packit fcad23
See the Net-SNMP Wiki (http://www.net-snmp.org/wiki/index.php/IF-MIB_rewrite)
Packit fcad23
for further details.
Packit fcad23
Packit fcad23
Thanks to Sun for the excellent patches.
Packit fcad23
Packit fcad23
Packit fcad23
 -- Thomas Anders <tanders@users.sourceforge.net>
Packit fcad23
Packit fcad23
------------------------------------------------------------
Packit fcad23
Packit fcad23
11.  Files descriptors and fopen
Packit fcad23
Packit fcad23
Solaris has a limitation on the number of file descriptors (255)
Packit fcad23
available in stdio, so that fopen() fails if more than
Packit fcad23
255 file descriptors (sockets) are open. This prevents mibs from 
Packit fcad23
being loaded after 250 sockets are open, since parse.c uses stdio.
Packit fcad23
Packit fcad23
SEan <burke_sp@pacbell.net> investigated this problem, and had this
Packit fcad23
report on using the SFIO package to solve this problem.
Packit fcad23
Packit fcad23
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Packit fcad23
Packit fcad23
The SFIO package ( http://www.research.att.com/sw/tools/sfio/ ) 
Packit fcad23
is a buffered streams IO package that is much more more sophisticated 
Packit fcad23
than stdio, but it does support stdio API's for backward compatibility,
Packit fcad23
and that's the aspect that is important here.
Packit fcad23
Packit fcad23
To compile with SFIO, we simply add -I/usr/local/sfio/include to the
Packit fcad23
$CPPFLAGS before compiling net-snmp. This causes SFIO's stdio.h to
Packit fcad23
preempt Solaris stdio, mapping calls like fopen() and fprintf() to
Packit fcad23
the SFIO implementations. This produces a libnetsnmp that does not
Packit fcad23
have the fopen() limitation. Any application that links to this 
Packit fcad23
libnetsnmp must also be linked to libsfio. 
Packit fcad23
Packit fcad23
Here are the two caveats:
Packit fcad23
Packit fcad23
A. libsfio exports the functions 'getc' and 'putc', for reasons that
Packit fcad23
are not clear. These are the only symbols it exports that conflict
Packit fcad23
with stdio. While getc and putc are traditionally macros, Solaris
Packit fcad23
makes them functions in multithreaded code (compiled with -mt,
Packit fcad23
-pthread, or -D_REENTRANT). If your native stdio code links to the
Packit fcad23
libsfio versions, a crash will result.
Packit fcad23
Packit fcad23
There are two solutions to this problem. You may remove getc and putc 
Packit fcad23
from libsfio, since SFIO defines getc and putc as macros, by doing:
Packit fcad23
Packit fcad23
	ar d libsfio.a getc.o
Packit fcad23
	ar d libsfio.a putc.o
Packit fcad23
Packit fcad23
or link to SFIO's stdio compatibility library, libstdio, ahead of
Packit fcad23
libsfio. This library wraps all of the native stdio calls with 
Packit fcad23
versions that are safe for native or sfio streams, in case you
Packit fcad23
need to share streams between SFIO and native stdio codes.
Packit fcad23
Packit fcad23
B. libsfio provides 64-bit offsets in fseek(), ftell(). This is
Packit fcad23
a good thing, since SFIO is intended to avoid needless limitations,
Packit fcad23
but it means that SFIO's stdio.h defines off_t to be a 64-bit offset. 
Packit fcad23
Net-SNMP uses readdir(), which returns a struct dirent containing 
Packit fcad23
a 32-bit off_t, so the code compiled for SFIO doesn't access 
Packit fcad23
struct dirent's correctly.
Packit fcad23
Packit fcad23
There are two solutions to this problem, as well. The first is to
Packit fcad23
include <dirent.h> at the start of SFIO's stdio.h. Since SFIO 
Packit fcad23
defines a macro substitution for off_t, this leaves struct dirent's 
Packit fcad23
definition unchanged.
Packit fcad23
Packit fcad23
An alternative, which I haven't verified, is to define _FILE_OFFSET_BITS
Packit fcad23
to be 64 when compiling libnetsnmp. According to what I see in Solaris's 
Packit fcad23
/usr/include/sys/feature_tests.h, you can select a 64-bit off_t at 
Packit fcad23
compile time with this setting, which should make readdir()'s off_t 
Packit fcad23
compatible with SFIO's ftell(), fseek().
Packit fcad23
 [[ We have received reports that this approach does not in fact work 
Packit fcad23
(see Perl discussion below)]]
Packit fcad23
Packit fcad23
Finally, thanks to Phong Vo and AT&T Labs for a fast, robust and
Packit fcad23
portable package that solves this headache very neatly.
Packit fcad23
Packit fcad23
-SEan <burke_sp@pacbell.net>
Packit fcad23
Packit fcad23
------------------------------------------------------------
Packit fcad23
Packit fcad23
12.  Perl
Packit fcad23
Packit fcad23
Net-SNMP may be compiled with Perl support by configuring like:
Packit fcad23
Packit fcad23
   ./configure -enable-embedded-perl ...
Packit fcad23
Packit fcad23
This should only be done if you are sure you really need Perl, 
Packit fcad23
for the following reasons:
Packit fcad23
Packit fcad23
Solaris 8 and later ship with a version of Perl compiled using Sun's cc. 
Packit fcad23
Packit fcad23
This causes a problem when attempting to compile net-snmp 
Packit fcad23
with Perl functionality ie.:
Packit fcad23
Packit fcad23
   ./configure --with-mib-modules="ucd-snmp/lmSensors ucd-snmp/diskio \
Packit fcad23
      smux mibII/mta_sendmail" --enable-embedded-perl
Packit fcad23
Packit fcad23
because during the Perl section of the compile, it attempts to do so 
Packit fcad23
using the methodology used to compile the original Perl, not
Packit fcad23
what you're currently using.  This can be discovered by typing:
Packit fcad23
Packit fcad23
   perl -V
Packit fcad23
Packit fcad23
and it says (among other things)
Packit fcad23
Packit fcad23
  Compiler:
Packit fcad23
    cc='cc'
Packit fcad23
Packit fcad23
and you don't have the full version of Sun's C compiler on your 
Packit fcad23
system, it's going to break.
Packit fcad23
Packit fcad23
In addition if it was compiled with:
Packit fcad23
Packit fcad23
   LFS_CFLAGS      -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
Packit fcad23
Packit fcad23
net-snmp will not compile correctly.
Packit fcad23
Packit fcad23
Given that the Perl provided with Solaris 8 (5.005_03) and Solaris 9 
Packit fcad23
(5.005_03 and 5.6.1) is somewhat stale, upgrading may be to your advantage.
Packit fcad23
Packit fcad23
Perl did not ship with Solaris before version 8.  If you installed a
Packit fcad23
version from www.sunfreeware.com, it is compiled with some extra flags
Packit fcad23
that cause the net-snmp compile to break.  
Packit fcad23
Packit fcad23
In either case, you will need to compile and install Perl.
Packit fcad23
Packit fcad23
There are, however, some issues.
Packit fcad23
Packit fcad23
A.  Some applications (eg. /usr/bin/kstat) require this exact version 
Packit fcad23
of Perl because of libraries.  These instructions below install Perl
Packit fcad23
in /usr/local/bin (and optionally /usr/bin/).  The original is left
Packit fcad23
intact in /usr/perl5/bin/perl where, in fact, the kstat script looks 
Packit fcad23
for it.  If you have version specific scripts, you will need to do
Packit fcad23
the same either by invoking /usr/perl5/bin/perl or putting:
Packit fcad23
Packit fcad23
#!/usr/perl/bin/perl -w
Packit fcad23
Packit fcad23
as the first line of your script and making it executable 
Packit fcad23
(see the /usr/bin/kstat source as an example).
Packit fcad23
Packit fcad23
B.  The instructions below disable large file support.  
Packit fcad23
Packit fcad23
This means that Perl would be unable to deal
Packit fcad23
successfully with files larger than 2 Gb.  
Packit fcad23
Again, using /usr/perl5/bin/perl or a version compiled
Packit fcad23
with this functionality would solve this.
Packit fcad23
Packit fcad23
Hence the ideal solution is a net-snmp specific Perl in its own directory.
Packit fcad23
Packit fcad23
The following instructions will install a working Perl in /usr/local/net-snmp.
Packit fcad23
Packit fcad23
Install gcc version 3.3.2 (or later) from www.sunfreeware.com.
Packit fcad23
Packit fcad23
Download the current stable release of Perl
Packit fcad23
Packit fcad23
   http://www.cpan.org/src/stable.tar.gz 
Packit fcad23
Packit fcad23
and gunzip and untar.  (This document assumes Perl 5.8.3 or later)
Packit fcad23
Packit fcad23
cd to the source directory and type the following:
Packit fcad23
Packit fcad23
  sh Configure -Dcc=gcc -Dprefix=/usr/local/net-snmp -Uinstallusrbinperl \
Packit fcad23
               -Duseshrplib -Dcf_email=your_email@your_domain \
Packit fcad23
               -Dperladmin=your_email@your_domain -Uuselargefiles -de
Packit fcad23
Packit fcad23
Replace your_email@your_domain by your real email address. If you intend
Packit fcad23
to compile Net-SNMP with Sun cc later on, replace gcc with cc above.
Packit fcad23
Packit fcad23
When it is finished, do:
Packit fcad23
Packit fcad23
   grep cppsymbols config.sh
Packit fcad23
Packit fcad23
and make sure "-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" does NOT appear.
Packit fcad23
Packit fcad23
Then do:
Packit fcad23
Packit fcad23
   make
Packit fcad23
   make test  (optional)
Packit fcad23
   make install
Packit fcad23
   /usr/local/net-snmp/bin/perl -V
Packit fcad23
Packit fcad23
if everything looks all right, compile net-snmp (see above) with the 
Packit fcad23
following differences:
Packit fcad23
Packit fcad23
env PERLPROG=/usr/local/net-snmp/bin/perl ./configure --enable-embedded-perl \ 
Packit fcad23
 --with-mib-modules=ucd-snmp/lmSensors,ucd-snmp/diskio,smux,mibII/mta_sendmail \
Packit fcad23
 --with-cc=gcc && make && make test && make install
Packit fcad23
Packit fcad23
Make sure you specify the correct path to your self-compiled Perl binary
Packit fcad23
and use the same compiler like the one you used when building Perl above.
Packit fcad23
Feel free to add other configure options, of course.
Packit fcad23
Packit fcad23
"make test" includes some tests for the Net-SNMP Perl functionalities.
Packit fcad23
Packit fcad23
Once you have compiled and installed net-snmp you can test the Perl 
Packit fcad23
capabilities of the final installation by doing the following:
Packit fcad23
Packit fcad23
Copy the perl_module.pl script found at 
Packit fcad23
Packit fcad23
http://www.net-snmp.org/tutorial-5/toolkit/perl/index.html
Packit fcad23
Packit fcad23
to /usr/local/net-snmp
Packit fcad23
Packit fcad23
and modify your /usr/local/share/snmp/snmpd.conf file to contain the entry:
Packit fcad23
Packit fcad23
perl do "/usr/local/net-snmp/perl_module.pl";
Packit fcad23
Packit fcad23
then do:
Packit fcad23
Packit fcad23
/usr/local/bin/snmpwalk -v 2c -c whatever localhost .1.3.6.1.4.1.8072.999
Packit fcad23
Packit fcad23
It should return the following:
Packit fcad23
Packit fcad23
NET-SNMP-MIB::netSnmp.999.1.2.1 = STRING: "hello world"
Packit fcad23
Packit fcad23
WARNING!!  If you are planning on creating binary versions of net-snmp with 
Packit fcad23
Perl capability, you will also need to ship the Perl which you created in 
Packit fcad23
/usr/local/net-snmp.
Packit fcad23
Packit fcad23
 -- Bruce Shaw <Bruce.Shaw at shaw.ca>
Packit fcad23
 -- Thomas Anders <tanders@users.sourceforge.net>
Packit fcad23
Packit fcad23
------------------------------------------------------------
Packit fcad23
Packit fcad23
13.  sed
Packit fcad23
Packit fcad23
Various sed versions in older Solaris releases (Solaris 8 and earlier 
Packit fcad23
at least) have serious limitations that may affect ./configure
Packit fcad23
when building net-snmp. All these issues *should* have been addressed
Packit fcad23
in net-snmp 5.4 and later. If you still have problems, please let us know
Packit fcad23
and consider:
Packit fcad23
Packit fcad23
- installing GNU sed and putting it in front of your PATH
Packit fcad23
- installing the available Sun patches for the various sed versions
Packit fcad23
  (/usr/bin/sed, /usr/xpg4/bin/sed, /usr/ucb/sed)
Packit fcad23
- try the suggestions below
Packit fcad23
Packit fcad23
The version of sed in /usr/ucb on Solaris 2.5.1 and 2.6 can't
Packit fcad23
cope with the size of the substitution strings used in config.status.
Packit fcad23
Packit fcad23
Putting /usr/bin ahead of /usr/ucb in the search path fixes this.
Packit fcad23
Packit fcad23
/usr/xpg4/bin/sed is seen to segfault under Solaris 8 when running configure.
Packit fcad23
Putting /usr/bin ahead of /usr/xpg4/bin fixes this.
Packit fcad23
Packit fcad23
Packit fcad23
 -- Thomas Anders <tanders@users.sourceforge.net>
Packit fcad23
 -- zach dot metzinger at microtune dot com
Packit fcad23
Packit fcad23
------------------------------------------------------------
Packit fcad23
Packit fcad23
14.  OpenSSL and crle
Packit fcad23
Packit fcad23
If compiling with OpenSSL (e.g. from sunsolve), it's possible that
Packit fcad23
the agent won't successfully load the crypto library (typically
Packit fcad23
in /usr/local/ssl/lib) when it is in use and will return a
Packit fcad23
cannot find library error message of some sort.
Packit fcad23
Packit fcad23
To rectify this, you will need to use the /usr/bin/crle command, which
Packit fcad23
did NOT ship with some versions of Solaris, but came as part of later
Packit fcad23
patches.  You should make sure the following patches are up to date:
Packit fcad23
Packit fcad23
107733 (Solaris 2.6)
Packit fcad23
106950 (Solaris 2.7)
Packit fcad23
109147 (Solaris 8)
Packit fcad23
115833 (Trusted Solaris 8)
Packit fcad23
112693 (Solaris 9)
Packit fcad23
Packit fcad23
Then type the following:
Packit fcad23
Packit fcad23
/usr/bin/crle
Packit fcad23
Packit fcad23
It will return something like:
Packit fcad23
Packit fcad23
Default configuration file (/var/ld/ld.config) not found
Packit fcad23
  Default Library Path (ELF):  /usr/lib (system default)
Packit fcad23
  Trusted Directories (ELF):   /usr/lib/secure (system default)
Packit fcad23
Packit fcad23
Find the location of the libcrypto libraries by typing:
Packit fcad23
Packit fcad23
find /usr -name "libcrypto*" -print
Packit fcad23
Packit fcad23
which will probably display:
Packit fcad23
Packit fcad23
/usr/local/ssl/lib/libcrypto.a
Packit fcad23
/usr/local/ssl/lib/libcrypto.so
Packit fcad23
/usr/local/ssl/lib/libcrypto.so.0
Packit fcad23
/usr/local/ssl/lib/libcrypto.so.0.9.7
Packit fcad23
Packit fcad23
which is the default installation for OpenSSL.
Packit fcad23
Packit fcad23
To include this in the loader search path, type:
Packit fcad23
Packit fcad23
/usr/bin/crle -u -l /usr/local/ssl/lib
Packit fcad23
Packit fcad23
/usr/bin/crle will now display:
Packit fcad23
Packit fcad23
Configuration file [3]: /var/ld/ld.config  
Packit fcad23
  Default Library Path (ELF):   /usr/lib:/usr/local/ssl/lib
Packit fcad23
  Trusted Directories (ELF):    /usr/lib/secure  (system default)
Packit fcad23
Packit fcad23
Command line:
Packit fcad23
  crle -c /var/ld/ld.config -l /usr/lib:/usr/local/ssl/lib
Packit fcad23
Packit fcad23
If this fails, usually by displaying:
Packit fcad23
Packit fcad23
crle: /var/ld/ld.config: open failed: No such file or directory
Packit fcad23
Packit fcad23
you will need to create this directory by hand by doing the following:
Packit fcad23
Packit fcad23
mkdir /var/ld
Packit fcad23
cd /var/ld
Packit fcad23
ln -s . 32
Packit fcad23
mkdir sparcv9
Packit fcad23
chgrp bin sparcv9
Packit fcad23
ln -s sparcv9 64
Packit fcad23
touch ld.config
Packit fcad23
Packit fcad23
then do:
Packit fcad23
Packit fcad23
crle -c /var/ld/ld.config -l /usr/lib:/usr/local/ssl/lib
Packit fcad23
Packit fcad23
Thanks to Dave Shield and Johannes Schmidt-Fischer
Packit fcad23
Packit fcad23
 -- Bruce Shaw <Bruce.Shaw at shaw.ca>
Packit fcad23
Packit fcad23
------------------------------------------------------------
Packit fcad23
Packit fcad23
15. IPv6
Packit fcad23
Packit fcad23
Starting with net-snmp 5.4 you can enable the UDPIPv6 and TCPIPv6 
Packit fcad23
transports on Solaris:
Packit fcad23
Packit fcad23
   ./configure --enable-ipv6
Packit fcad23
Packit fcad23
There's no support for the mibII/ipv6 mib module, though.
Packit fcad23
Packit fcad23
Packit fcad23
 -- Thomas Anders <tanders@users.sourceforge.net>
Packit fcad23
Packit fcad23
------------------------------------------------------------
Packit fcad23
Packit fcad23
16. Wish list
Packit fcad23
Packit fcad23
A.  Code cleanup
Packit fcad23
Packit fcad23
There may be opportunities for shared code between UCD-SNMP 
Packit fcad23
and HOST-RESOURCES-MIB.
Packit fcad23
Packit fcad23
There may be opportunities to optimize caching perhaps 
Packit fcad23
using the new auto-caching code.
Packit fcad23
Packit fcad23
B.  LM-SENSORS-MIB
Packit fcad23
Packit fcad23
We need a complete list of sensors from various platforms so
Packit fcad23
they can be displayed properly.
Packit fcad23
Packit fcad23
C.  ORACLE
Packit fcad23
Packit fcad23
How to get ORACLE's SNMP functionality to work as a sub-agent.
Packit fcad23
Packit fcad23
D. Largefile support
Packit fcad23
Packit fcad23
Rework the host mib module to work even if net-snmp is built with
Packit fcad23
largefile support. This would eliminate the most important problems 
Packit fcad23
with Perl (see section 12).
Packit fcad23
Packit fcad23
 -- Bruce Shaw <Bruce.Shaw at shaw.ca>
Packit fcad23
 -- Thomas Anders <tanders@users.sourceforge.net>
Packit fcad23
Packit fcad23
------------------------------------------------------------
Packit fcad23
Packit fcad23
17.  Known Bugs!!
Packit fcad23
Packit fcad23
A.  hrDeviceTable (HOST-RESOURCES-MIB)
Packit fcad23
Packit fcad23
This section of code is only aware of disk controllers 0 through 7.
Packit fcad23
Hence, anything on controller c8 and above will be invisible.
Packit fcad23
Packit fcad23
B.  hrPartitionTable (HOST-RESOURCES-MIB)
Packit fcad23
Packit fcad23
At present, hrPartitionSize data only works for regular ufs
Packit fcad23
partitions eg. /dev/dsk/c0t0d0s0 that are mounted.  They
Packit fcad23
are displayed in partition order rather than the order
Packit fcad23
they are mounted.  Partitions mounted as mirrors, metastate
Packit fcad23
database replicas, swap or members of a RAID display size 0.
Packit fcad23
Packit fcad23
As a workaround, put entries for disks you are
Packit fcad23
interested in in snmpd.conf and examine
Packit fcad23
using UCD-SNMP-MIB.
Packit fcad23
Packit fcad23
Packit fcad23
 -- Bruce Shaw <Bruce.Shaw at shaw.ca>
Packit fcad23
Packit fcad23
------------------------------------------------------------
Packit fcad23
Packit fcad23
18.  Discussion and further information
Packit fcad23
Packit fcad23
For discussion or further information contact the coders and users
Packit fcad23
lists at http://sourceforge.net/mail/?group_id=12694 .
Packit fcad23