DynagenでCCIEを目指す
SNMP trap サーバ インストール手順
最終更新:
it_certification
-
view
1. 履歴
- 2010/08/08 初稿
2. はじめに
- SNMP trap サーバのインストール手順を記述します。
3. SNMPのインストール
3.1. SNMP有無の確認
net-snmp, net-snmp-utilsがインストール済みかどうかを確認します。Nインストール済みの場合は、手順「3. SNMPのインストール」を省略します。
[root@localhost ~]# rpm -qa | grep snmp [root@localhost ~]#
3.2. SNMPのインストール
[root@localhost ~]# yum install net-snmp net-snmp-utils
3.3. SNMP インストールの確認
net-snmp, net-snmp-utilsがインストールされた事を確認します。
[root@localhost ~]# rpm -qa | grep snmp net-snmp-5.4.2.1-5.fc10.i386 net-snmp-libs-5.4.2.1-5.fc10.i386 net-snmp-utils-5.4.2.1-5.fc10.i386 [root@localhost ~]#
4. SNMP trap サーバの設定
4.1. snmptrapデーモンの設定
snmptrapデーモンの設定を行います。コミュニティ名「RO_CCIE」に対して、syslogへの書き込み、スクリプトの実行、他サーバへの転送を許可します。/etc/snmp/snmptrapd.confを以下の通り編集して下さい。
- 変更前
# Example configuration file for snmptrapd # # No traps are handled by default, you must edit this file! # # authCommunity log,execute,net public # traphandle SNMPv2-MIB::coldStart /usr/bin/bin/my_great_script cold
- 変更後
# Example configuration file for snmptrapd # # No traps are handled by default, you must edit this file! # # authCommunity log,execute,net public # traphandle SNMPv2-MIB::coldStart /usr/bin/bin/my_great_script cold authCommunity log,execute,net RO_CCIE
4.2. snmptrapdの起動
snmptrapサービスを起動させます。
[root@localhost ~]# service snmptrapd start Starting snmptrapd: [ OK ] [root@localhost ~]#
次回OS起動時にNTPサービスが起動するよう、chkconfigも忘れずに設定しましょう。
[root@localhost ~]# chkconfig --level 345 snmptrapd on
4.3. snmptrapのテスト送信
snmptrapをテスト送信します。送信例は以下の通りです。
[root@localhost ~]# snmptrap -v 1 -c RO_CCIE localhost .1.3.6.1.4.1.8072.99999 localhost 6 1 '' .1.3.6.1.4.1.8072.99999.1 s "Test Message" [root@localhost ~]#
テスト送信されたtrapが/var/log/messagesに記録された事を確認します。
[root@localhost ~]# tail -f /var/log/messages Aug 8 11:30:50 localhost ntpd[2638]: synchronized to 130.69.251.23, stratum 1 Aug 8 11:38:10 localhost ntpd[2638]: synchronized to 210.171.226.40, stratum 1 Aug 8 11:41:39 localhost ntpd[2638]: synchronized to 130.69.251.23, stratum 1 Aug 8 11:48:47 localhost ntpd[2638]: synchronized to 210.171.226.40, stratum 1 Aug 8 12:00:54 localhost ntpd[2638]: synchronized to 130.69.251.23, stratum 1 Aug 8 12:16:57 localhost ntpd[2638]: synchronized to 210.171.226.40, stratum 1 Aug 8 12:24:01 localhost snmptrapd[2821]: 2010-08-08 12:24:01 NET-SNMP version 5.4.2.1 Stopped. Aug 8 12:24:01 localhost snmptrapd[2821]: Stopping snmptrapd Aug 8 12:24:01 localhost snmptrapd[3026]: NET-SNMP version 5.4.2.1 Aug 8 12:24:49 localhost snmptrapd[3026]: 2010-08-08 12:24:49 localhost [127.0.0.1] (via UDP: [127.0.0.1]:60157->[127.0.0.1]) TRAP, SNMP v1, community RO_CCIE#012#011NET-SNMP-MIB::netSnmp.99999 Enterprise Specific Trap (1) Uptime: 1:26:15.78#012#011NET-SNMP-MIB::netSnmp.99999.1 = STRING: "Test Message"
(メモ)traphandleの使い方も確かめておく