net-snmp に関するインストールメモ(2003/05/20) 
 

net-snmpの設定方法

1) 既存の snmpマネージャを起動しない様に、管理者メニューから snmpの起動を停止します。設定終了後、ps コマンドで snmpサービスが起動されていない事を確認してください。

  NET-SNMP : 本家(英語) 

2) net-snmp のインストールを行う。./configure をかけると、問いかけがあります。(時間かかります)

% cd ./src
% wget http://flow.dl.sourceforge.net/sourceforge/net-snmp/net-snmp-5.0.8.tar.gz
% gzip -cd net-snmp-5.0.8.tar.gz | tar xf -
% cd net-snmp-5.0.8
% ./configure 

   ************** Configuration Section **************

   You are about to be prompted with a series of questions. Answer
   them carefully, as they determine how the SNMP agent and related
   applications are to function.

   After the configure script finishes, you can browse the newly
   created config.h file for further - less important - parameters to
   modify. Be careful if you re-run configure though, since config.h will
   be overwritten.

   -Press return to continue-  ←Enterを押します

   disabling above prompt for future runs... yes
   checking Default version of SNMP to use...


   *** Default SNMP Version:

   Starting with Net-SNMP 5.0, you can choose the default version of
   the SNMP protocol to use when no version is given explicitly on the
   command line, or via an 'snmp.conf' file. In the past this was set to
   SNMPv1, but you can use this to switch to SNMPv3 if desired. SNMPv3
   will provide a more secure management environment (and thus you're
   encouraged to switch to SNMPv3), but may break existing scripts that
   rely on the old behaviour. (Though such scripts will probably need to
   be changed to use the '-c' community flag anyway, as the SNMPv1
   command line usage has changed as well.).
   At this prompt you can select "1", "2" (for SNMPv2c), or "3" as
   the default version for the command tools (snmpget, ...) to use. This
   can always be overridden at runtime using the -v flag to the tools, or
   by using the "defVersion" token in your snmp.conf file.

   Default version of SNMP to use (3):  ←Enterを押します(デフォルトで)
   setting Default version of SNMP to use to... 3
   checking System Contact Information...


   *** System Contact Information:

   Describes who should be contacted about the host the agent is
   running on. This information is available in the MIB-II tree. This
   can also be over-ridden using the "syscontact" syntax in the agent's
   configuration files.

   System Contact Information (root@sea-bird.org): ←管理者のメールアドレスを入力します
   setting System Contact Information to... root@sea-bird.org
   checking System Location...


   *** System Location:

   Describes the location of the system. This information is
   available in the MIB-II tree. this can also be over-ridden using the
   "syslocation" syntax in the agent's configuration files.

   System Location (Unknown): Qube3J Server
   setting System Location to... Qube3J Server
   checking Location to write logfile...


   *** Logfile location:

   Enter the default location for the snmpd agent to dump
   information & errors to. If not defined (enter the keyword "none"
   at the prompt below) the agent will use stdout and stderr instead.
   (Note: This value can be over-ridden using command line options.)

   Location to write logfile (/var/log/snmpd.log): ←お好きな場所に♪
   setting Location to write logfile to... /var/log/snmpd.log
   checking Location to write persistent information...


   *** snmpd persistent storage location:

   Enter a directory for the SNMP library to store persistent
   data in the form of a configuration file. This default location is
   different than the old default location (which was for ucd-snmp). If
   you stay with the new path, I'll ask you in a second if you wish to
   copy your files over to the new location (once only). If you pick
   some other path than the default, you'll have to copy them yourself.
   There is nothing wrong with picking the old path (/var/ucd-snmp) if
   you'd rather.

   Location to write persistent information (/var/net-snmp): ←こちらも (^o^)丿 な
   setting Location to write persistent information to... /var/net-snmp
   
   ---------------------------------------------------------
   Net-SNMP configuration summary:
   ---------------------------------------------------------

   Net-SNMP Version: 5.0.8
   Building for: linux
   Network transport support: Callback Unix TCP UDP
   SNMPv3 Security Modules: usm
   Agent MIB code: mibII ucd_snmp snmpv3mibs notification target agent_mibs agentx agent_mibs utilities
   Authentication support: MD5 SHA1
   Encryption support: DES

   ---------------------------------------------------------

3) コンパイルと動作テストをします。(すげー時間かかります)

% make
% make test
    Summary: 34 / 34 succeeded.   ←こう表示されれば ok ♪
    make[1]: Leaving directory `/home/hoge/src/net-snmp-5.0.8/testing'

4) インストールをするだす。

% su
# umask 022
# make install

5) net-snmpエージェントの起動前設定をします。

# cp EXAMPLE.conf /usr/local/share/snmp/snmpd.conf
# vi /usr/local/share/snmp/snmpd.conf
    変更点
    # sec.name source community
    com2sec local localhost PRIVATE
    com2sec mynetwork 192.xxx.xxx.xxx/24 HOME
    # Second, map the security names into group names:
    #group MyRWGroup v1 local
    #group MyRWGroup v2c local
    #group MyRWGroup usm local
    group MyROGroup v1 mynetwork
    group MyROGroup v2c mynetwork
    group MyROGroup usm mynetwork
    # It is also possible to set the sysContact and sysLocation system
    # variables through the snmpd.conf file:
    syslocation Intel-Solaris8 Unix Server
    syscontact Me <hoge@hoge.co.jp>
    # Make sure mountd is running
    #proc mountd
    # Make sure there are no more than 4 ntalkds running, but 0 is ok too.
    #proc ntalkd 4
    # Make sure at least one sendmail, but less than or equal to 10 are running.
    #proc sendmail 10 1
    # a simple hello world
    #exec echotest /bin/echo hello world
    # Check the / partition and make sure it contains at least 10 megs.
    disk / 497829
    disk /usr/local 2522048

6) net-snmpエージェントの起動をします。

# /usr/local/sbin/snmpd
# ps -ef | grep snmpd
    root 26880 26734  0 16:22:25 pts/2 0:00 grep -n snmpd
    root 26878     1  0 16:22:18 pts/2 0:00 /usr/local/sbin/snmpd

7) 動作チェックを行います。下のコマンドを実行し、山の様になんか帰ってくれば ok です。

# snmpwalk -v1 -c コミニティ名 SNMPエージェントのIPアドレス  .1.3.6.1.2.1 

8) 自動起動するように設定します。

# cd /etc/rc.d/init.d
# vi net-snmp
# chmod +x net-snmp
# cd /etc/rc.d/rc3.d
# ln -s /etc/rc.d/init.d/net-snmp S77net-snmp