Mac OS X Server: How to Install, Enable, and Configure SNMP

manuales - MacOs X

Gracias tio jobs :)
This document explains how to set up the Simple Network Management Protocol (SNMP) on Mac OS X Server.

Installing SNMP

To use SNMP for monitoring or data collection, an SNMP agent (snmpd) must be running on the monitored Mac OS X Server host (computer). Mac OS X Server 10.1.5 or later includes a version of SNMP (UCD-SNMP v. 4.2.3 or later).

If you do not have the file /usr/sbin/snmpd, then SNMP is not installed.

The following operating systems require that SNMP be built and installed:

If you have access to a Mac OS X Server 10.1.5 or later Admin CD , the SNMP package on the CD may be used to install UCD-SNMP 4.2.3 on these systems.

Note: Mac OS X Server 10.1.5 is available only with Xserve computers shipped before the release of Mac OS X Server 10.2.

If you do not have access to the CD, you may download current SNMP source from the NET-SNMP Project Home Page (http://www.net-snmp.org/).

Note: Apple only provides technical support for the SNMP tools on the Admin CD when they are used with Mac OS X Server 10.1.5 or later.

Warnings


Starting snmpd

Follow these steps for Mac OS X Server 10.1.5 or later:

Note: For further instruction on editing configuration files, including important precautionary statements, see technical document 106619, "Mac OS X Server: How to Edit Configuration Files".

This change to hostconfig causes snmpd to be executed during system startup, with no options, as dictated by the file /System/Library/StartupItems/SNMP/SNMP.

As an alternative, the snmp agent (/usr/sbin/snmpd) can be executed at the command line at any time.


Configuring snmpd

The configuration (conf) file for snmpd is typically at /usr/share/snmp/ and named "snmpd.conf" or "snmpd.local.conf". If you have an environment variable SNMPCONF, snmpd will read any files named "snmpd.conf" and "snmpd.local.conf" in these directories. The snmpd process can be started with a "-c" flag to indicate other conf files. See the snmpd man page for more information on which conf files can be used.

Configuration files can be created and installed more elegantly using the included script /usr/bin/snmpconf. As root, use this script with the "-i" flag to install the file at /usr/share/snmp/. Otherwise the default location for the file to be written is the user's home directory (~/). Note that only root has write permission for /usr/share/snmp/.

Since snmpd reads its conf files at startup, changes to the conf files require that the process be stopped and restarted. You may stop snmpd with ProcessViewer or at the command line (kill -HUP <pid>).


Example of SNMP Configuration

I. Customize data

To customize the data provided by snmpd, you may add an snmpd.conf file using /usr/bin/snmpconf. As root or using sudo, execute this command:

/usr/bin/snmpconf -i

You will then see a series of text menus. Make these choices in this order:

Notice you have created an snmpd.conf file with creation date of today: ls -l /usr/share/snmpd.conf

II. Start snmpd as root

To start snmpd, execute this as root:

/usr/sbin/snmpd

If snmpd is already running, HUP the process instead:

set x=`ps cax |grep snmpd |awk '{print $1}'` ; kill -HUP $x ;

Note that the snmpd process is now running:

ps ax |grep snmpd

III. Collect SNMP information from the host

To get the SNMP-available information you just added, execute this command from a host that has the SNMP tools installed:

/usr/sbin/snmpget hostname public system.sysLocation.0

Note: You would replace "hostname" with the actual name of the target host.

You should see location you provided. In this example, you would see:

system.sysLocation.0 = server_room

The other options in the menu you were working in are:

/usr/bin/snmpget hostname public system.sysContact.0
/usr/bin/snmpget hostname public system.sysServices.0

The final ".0" indicates you are looking for the index object. The word "public" is the name of the snmp community which you did not alter. If you need information on either of these or explanations of snmp syntax, there are tutorials available on net-snmp.sourceforge.net.


Additional tools

Other than snmpget, there are a variety of snmp based tools and suites both free and commercial with varying complexity and reporting:

Intermapper by Dartware
http://dartware.com/

HP OpenView mrtg and rrdtool
http://people.ee.ethz.ch/~oetiker/webtools/mrtg/

You may also search for perl modules.


Additional information

Man pages

man -k snmp will provide a list of the known man pages.

Web sites

The Net SNMP-Project
http://www.net-snmp.org/
http://net-snmp.sourceforge.net/

Cisco Connection Documentation (Cisco Systems)
http://www.cisco.com/univercd/cc/td/doc/cisintwk/ito_doc/snmp.htm

Books

_Essential_SNMP_ by Douglas Mauro, Kevin Schmidt
Publisher: O'Reilly (First Edition July 2001)
ISBN: 0-596-00020-0, 326 pages

_Snmp,_Snmpv2,_Snmpv3,_and_Rmon_1and_2,
Publisher: Addison, Wesley. (Third Edition 1999)


Information about products not manufactured by Apple is provided for information purposes only, and does not constitute Apple's recommendation or endorsement. Please contact the vendor for additional information.
Usar puntuación: / 3
MaloBueno