勝手にSNMP Trap Translator v1.3翻訳


久しぶりにSNMPTT触っていたら、斜め読みで設定していたら若干抜けが出た。
整理兼ねて公式サイトのページの一部を日本語化してみた。
だんだん後半に行くにつれて雑になってますがそこはご勘弁。

SNMP Trap Translator v1.3

(SNMPTT)
This file was last updated on: November 15th, 2009

Installation – Overview

The following outlines the general steps required to install and configure SNMPTT:

  1. Install Net-SNMP and SNMPTT as described below
  2. Create an snmptt.conf file by hand, or using
    snmpttconvertmib
  3. Modify snmptt.ini to include the snmptt.conf file and set any desired options
  4. Start snmptt
  5. Configure your network devices to send traps to the Net-SNMP / SNMPTT machine
  6. Initiate a trap on your network device and check the SNMPTT log files for the result
  7. Secure the SNMPTT installation

SNMPTTをインストールおよび構成するための必要な一般的な手順の概略を以下に示します:

  1. Net-SNMPとSNMPTTを下記の通りインストールします。
  2. snmptt.confファイルを作成します。作成は手動、またはsnmpttconvertmibを使用して行います。
  3. snmptt.iniを変更して、snmptt.confファイルをインクルードし、任意のオプションを設定します。
  4. snmpttを開始します。
  5. Net-SNMP / SNMPTTマシンにトラップを送信するようネットワークデバイスのコンフィグを行います。
  6. ネットワークデバイスからトラップを送付し、結果をSNMPTTのログファイルで確認します。
  7. SNMPTTインストールを安全にしておきます。

Installation – Unix

Standard handler

The standard handler is a small Perl program that is called each time a trap is received by snmptrapd when using daemon mode.
 The limitations of this handler are:

  • Each time a trap is received, a process must be created to run the snmptthandler program and snmptt.ini is read each time.
  • SNMPv3 EngineID and names are not passed by snmptrapd to snmptthandler

The benefits of using this handler are:

  • Does not require embedded Perl for snmptrapd
  • Has been around since v0.1 if snmptt.
  • Sufficient for most installations

1.  Read this entire file to understand how snmptt
works

2.  Copy snmptt to /usr/sbin/ and ensure it is executable (chmod +x snmptt)

3.  Copy snmptthandler to /usr/sbin/ and ensure it is executable (chmod +x snmptthandler)

4.  Copy snmptt.ini to /etc/snmp/ or /etc/ and edit the options inside the file.

5.  Create the log folder /var/log/snmptt/.

6a.   For standlone mode: 

Modify the Net-SNMP snmptrapd.conf file by adding the following line:

traphandle default /usr/sbin/snmptt

Note:   It is possible to configure snmptrapd to execute snmptt based on the specific trap received, but using the default option is preferred

6b.   For daemon mode:

Modify the Net-SNMP snmptrapd.conf file by adding the following line:

traphandle default
/usr/sbin/snmptthandler

Create the spool folder /var/spool/snmptt/:

mkdir
/var/spool/snmptt/

A startup script is included which can be used to start and stop snmptt on Mandrake, RedHat and other systems. Copy the script to the init.d directory (renaming the file during the copy):

cp snmptt.init.d /etc/rc.d/init.d/snmptt

Add the service using chkconfig:

chkconfig –add snmptt

Configure the service to start at runlevel 2345:

chkconfig –level 2345 snmptt on

Snmptt will be started at the next reboot, or can be started immediately with:

service snmptt start

or

/etc/rc.d/init.d/snmptt start

To manually start snmptt, use:

snmptt –daemon

7.       A log rotation script is included which can be used to rotate the log files on Mandrake, RedHat and other systems.  Copy the file to the logrotate.directory (renaming the file during the copy):

cp snmptt.logrotate /etc/logrotate.d/snmptt

Edit the /etc/logrotate.d/snmptt and update
the paths and rotate frequency as needed.

8.       Start snmptrapd using the command line: snmptrapd -On.

You should be able to edit the /etc/rc.d/init.d/snmptrapd script if you have one and change
the OPTIONS to “-On”.

Note:  The -On is recommended.  This
will make snmptrapd pass OIDs in numeric form
and prevent SNMPTT from having to translate the symbolic name to numerical form.  If the
UCD-SNMP / Net-SNMP Perl module is not installed, then you MUST use the -On switch.  Depending on the version of UCD-SNMP / Net-SNMP, some symbolic names may not translate correctly.  See the FAQ for more info.

As an alternative, you can edit your snmp.conf file to include the line:
printNumericOids 1. 
This setting will take effect no matter what is used on the command line.

9.       See the Securing SNMPTT section.

Standard handler

standard handler は、daemon mode 使用時に trap が snmptrapd に受信されるたびに呼び出される小さなPerlプログラムです。このハンドラの制限は以下のとおりです。:

  • trapを受信するたびに、snmptthandlerのプログラムを実行するためのプロセスが作成される必要があり、snmptt.ini は毎回読み込まれます。
  • SNMPv3 EngineID と name は snmptrapd からsnmptthandler へは渡されません

このハンドラを使用する利点は以下のとおりです。:

  • snmptrapdへの組み込みのPerlが要求されません。
  • snmptt場合、v0.1 から存在している。
  • ほとんどのインストールで充分です。(???

1.  snmptt がどのように機能するか此方のすべてのファイルを読んでください。

2.  snmptt/usr/sbin/ にコピーし、実行可能であることを確認してください。(chmod +x snmptt)

3.  snmptthandler/usr/sbin/ にコピーし、実行可能であることを確認してください。(chmod +x snmptthandler)

4.  snmptt.ini/etc/snmp/ または/etc/ にコピーし、ファイル内のオプションを編集してください。

5.  ログファイルフォルダを /var/log/snmptt/に作成します。

6a.   standlone mode の場合:

Net-SNMP の snmptrapd.conf ファイルに以下の行を加えることで変更します。:

traphandle default /usr/sbin/snmptt

注:   snmptt が特定の trap 受信時に動作するようsnmptrapdを設定することは可能ですが、
default オプションでの利用を推奨します。

6b.   daemon modeの場合:

Net-SNMP の snmptrapd.conf ファイルに以下の行を加えることで変更します。:

traphandle default /usr/sbin/snmptthandler

spool フォルダを/var/spool/snmptt/に作成します。:

mkdir /var/spool/snmptt/

Mandrake、RedHatおよび他のシステムでsnmpttを起動、停止できる起動スクリプトが含まれています。そのスクリプトを
init.dディレクトリにコピーしてください。(コピー時にファイル名を変更してください。):

cp snmptt.init.d /etc/rc.d/init.d/snmptt

chkconfigを利用してサービス追加します。:

chkconfig –add snmptt

runlevel 2345 で起動するようサービス設定します。:

chkconfig –level 2345 snmptt on

snmptt は次の再起動で開始されます。もしくは、以下のコマンドですぐに開始できます:

service snmptt start

または

/etc/rc.d/init.d/snmptt start

マニュアルで snmptt を開始するには以下を利用してください。:

snmptt –daemon

7.       Mandrake、RedHatや他のシステム上のログファイルをローテーションするために使えるログローテーションのスクリプトが含まれています。logrotate.d ディレクトリにファイルをコピーします。(コピー時にファイル名を変更してください。)

cp snmptt.logrotate /etc/logrotate.d/snmptt

/etc/logrotate.d/snmptt を編集し、pathとローテート頻度を必要に応じて更新します。

8.       snmptrapd をコマンド: snmptrapd -Onで起動します。

/etc/rc.d/init.d/snmptrapd スクリプトを一度編集することで変更しましょう。

オプション“-On”を追加します。

注:  -On の推奨について。 これは、snmptrapd が数値形式でOIDを受け渡し、SNMPTTがシンボリック名形式から数値形式へ変換することを防止します。UCD-SNMP/Net-SNMPのPerlモジュールがインストールされていない場合は、必ず -On 変換を利用してください。UCD-SNMP/Net-SNMPのバージョンによっては、一部の記号名は正しく変換されないことがあります。詳細はFAQを参照してください。

代替手段として、snmp.conf ファイルに1行:printNumericOids 1. と挿入することも可能です。
この設定はコマンドラインで実行されているかどうかに関係なく有効です。

9.       あとはSecuring SNMPTT セクションを見てください。

Installation – Windows

(本節の翻訳は省略します。ご容赦ください。)

Securing SNMPTT

As with most software, SNMPTT should be run without root or administrator privileges.  Running with a non privileged account can help restrict what actions can occur when using features such as EXEC and REGEX.

For Linux and Unix, if you start SNMPTT as root, a user called ‘snmptt‘ should be created and the snmptt.ini option daemon_uid should be set to the numerical user id (eg: 500) or textual user id (snmptt). Only define daemon_uid if starting snmptt using root.

If you start SNMPTT as a non-root user, then daemon_uid is not required (and will probably not work).

When using daemon_uid in daemon mode, there will be two SNMPTT processes. The first will run as root and will be
responsible for creating the .pid file, and for cleaning up the .pid file on exit. The second process will run as the user defined
by daemon_uid. If the system syslog (syslog_system_enable) is enabled, a message will be logged stating the user id has been changed. All processing from that point on will be as the new user id. This can be verified by checking the user id in the syslog for traps and system messages. For example, if the user id was changed to 500, the syslog would contain entries with snmptt[500].  When running as root, entries will contain snmptt[0].

For Windows, a local or domain user account called ‘snmptt‘ should be created.  If running as an NT service, the service should be configured to use the snmptt user account.  Otherwise the system should be logged in locally with the snmptt account before launching SNMPTT in daemon mode.

The script snmptthandler which is called from Net-SNMP’s snmptrapd will be executed in the same security context as snmptrapd

The snmptt user should be configured with the following permissions:

  • read / delete access to spool directory to be able to read new traps, and delete processed traps
  • read access to configuration files (snmptt.ini and all snmptt.conf files)
  • write access to log folder /var/log/snmptt/ or c:\snmp\log\.
  • any other permissions required for EXEC statements to execute

If snmptrapd is run as a non root / administrator, it should be configured with the following permissions:

  • write access to spool directory

Note:  It is recommended that only the user running snmptrapd and the snmptt user be given permission to the spool folder.  This will prevent other users from placing files into the spool folder such as non-trap related files, or the !reload file which causes SNMPTT to reload.

ほとんどのソフトウェアと同様に、SNMPTTは、rootまたはAdministrator権限なしで実行する必要があります。非特権アカウントで実行することで、EXECREGEXなどの機能を使用する際に発生するアクションを制限することができます。

LinuxおよびUnixの場合は、rootとしてSNMPTTを開始した場合、”snmptt“というユーザーを作成し、snmptt.ini のオプション daemon_uid に、ユーザID番号(例:500)またはテキスト形式のユーザーID(snmptt)を設定する必要があります。snmpttをルートにて開始する場合のみdaemon_uid定義します。

非ルートユーザで SNMPTT を開始するならば、daemon_uid は必要となりません。(and will probably not work).

daemon mode で daemon_uid を使用する場合、二つのSNMPTTプロセスが存在します。最初はrootとして実行され、.pidファイルの作成と終了時における削除を担当します。
二番目のプロセスはdaemon_uidによって定義されたユーザーとして実行されます。
そのシステムのsyslog(syslog_system_enable)が有効になっている場合、ユーザIDが変更されているメッセージが記録されます。
その時点からのすべての処理は、新しいユーザIDとなります。
これは、トラップおよびシステムメッセージのsyslogにおけるユーザIDを見ることで確認できます。たとえば、ユーザIDを500に変えた場合に、syslogに snmptt[500] を持つエントリが含まれます。ルートとして実行する場合、エントリが snmptt[0] が含まれます。
Windowsの場合、’snmptt‘のローカルまたはドメインユーザを作成してください。  NTサービスとして起動する場合、 snmpttユーザアカウントでサービス起動するよう設定してください。  もしくはsnmpttアカウントにてシステムログインしてSNMPTTをデーモンモードで起動してください。

Net-SNMPのsnmptrapdから呼び出されるスクリプトsnmptthandlersnmptrapdのと同じセキュリティコンテキストで実行されます。

snmpttのユーザは、次の権限で構成する必要があります。:

  • 新たなtrapを読み取り、処理されたtrapを削除するため、スプールディレクトリ への読取/削除権限
  • コンフィグファイルへの読み取り権限(snmptt.ini and all snmptt.conf files)
  • /var/log/snmptt/ または c:\snmp\log\ のログフォルダへの書き込み権限
  • そのほかは EXEC 文の実行に必要な権限が必要になります。

snmptrapdが、非root/administratorとして実行されている場合は、以下の権限で構成する必要があります。:

  • スプールディレクトリへの書き込みアクセス権限

注:  snmptrapdおよびsnmpttの起動ユーザーにのみスプールフォルダのアクセス許可が付与することを推奨します。  これは、非trapに関連するファイルや、SNMPTTをリロードする!reloadリロードファイルなどを別ユーザがスプールフォルダにファイルを配置することを予防します。

Configuration Options – snmptt.ini

As mentioned throughout this document, configuration options are set by editing the snmptt.ini file.

For Linux / Unix, the following directories are searched to locate snmptt.ini:

/etc/snmp/
/etc/
/usr/local/etc/snmp/
/usr/local/etc/

For Windows, the file should be in %SystemRoot%\
For example, c:\winnt or c:\windows.

The location of the ini file can be set on the command line using the -ini= parameter.  See Command Line Arguments.

A sample snmptt.ini is provided in this package.  For Windows NT, be sure to copy the snmptt.ini-nt file to
%SystemRoot%\snmptt.ini.  Be sure to remove the -nt from the end of the filename.

This readme file does not document all configuration options available in the snmptt.ini as the snmptt.ini file contains detailed descriptions for each option.

この文書でこれまで述べたように、設定オプションはsnmptt.iniのファイルを編集することでセットされます。

Linux / Unix の場合、次のディレクトリがsnmptt.iniを見つけるために検索されます。:

/etc/snmp/
/etc/
/usr/local/etc/snmp/
/usr/local/etc/

Windows の場合、%SystemRoot%\に snmptt.ini ファイルがある必要があります。 たとえば、c:\winntc:\windowsとなります。

iniファイルの場所は、コマンドラインにおいては-ini=パラメータを利用することでセットできます。  これについてはCommand Line Argumentsを参照してください。

サンプルの snmptt.iniはパッケージにおいて提供されます。  Windows NTの場合、snmptt.ini-ntファイルを%SystemRoot%\snmptt.iniにコピーしてください。 必ずファイル名の末尾の -nt を取るのを忘れないでください。

snmptt.iniファイルは、各オプションの詳しい説明が含まれているため、このreadmeファイルでは、snmptt.iniで使用可能なすべての設定オプションを文書化していません。

Logging – Standard

Translated traps can be sent to standard output and to a log file.  The output format is:

date trap-oid severity category hostname translated-trap

To configure standard output or regular logging, edit the snmptt.ini file and modify the following variables:

enable_stdout
enable_log
log_file

翻訳されたtrapは、標準出力およびログファイルに送信することができます。出力フォーマットは以下のとおりです。:

date trap-oid severity category hostname translated-trap

標準出力または通常のロギングを設定するには、snmptt.iniファイルにおける次の変数を変更します。

enable_stdout
enable_log
log_file

Logging – Unknown traps

Logging of unrecognized traps is also possible.  This would be used mainly for troubleshooting purposes.

To configure unknown trap logging, edit the snmptt.ini file and modify the following variables:

enable_unknown_trap_log
unknown_trap_log_file

Unknown traps can also be logged to a SQL table as described in the Database section.

認識されていないtrapのロギングも可能です。 これは、主にトラブルシューティングの目的に使用されます。

未知のトラップのロギングを設定するには、snmptt.iniファイルを編集し、次の変数を変更します。:

enable_unknown_trap_log
unknown_trap_log_file

Databaseで説明するように未知のトラップは、SQLテーブルにも記録することができます。

Logging – Syslog

Translated traps can also be sent to syslog.  The format of the entries will be similar to above without the date (as syslogd logs the date):

trap-oid severity category hostname translated-trap

Syslog entries normally start with: date hostname snmptt[pid]:

To configure syslog, edit the snmptt ini file and modify the following variables:

syslog_enable
syslog_facility
syslog_level

SNMPTT system errors can be sent to syslog by editing the snmptt.ini file and modifying the following variables:

syslog_system_enable
syslog_system_facility
syslog_system_level

Syslog system entries normally start with: date hostname snmptt-sys[pid]:

The following errors are logged:

SNMPTT (version) started (*)
Unable to enter spool dir x (*)
Unable to open spool dir x (*)
Unable to read spool dir x (*)
Could not open trap file x (*)
Unable to delete trap file x from spool dir (*)
Unable to delete !reload file spool dir (*)
Unable to delete !statistics file spool dir (*)
Reloading configuration file(s) (*)
SNMPTT (version) shutdown (*)
Loading snmpttconfigfile (*)
Could not open configuration file:
snmpttconfigfile(*)
Finished loading x lines from snmpttconfigfile(*)
MySQL error: Unable to connect to database
SQL error: Unable to connect to DSN
Can not open log file logfile
MySQL error: Unable to perform PREPARE
MySQL error: Unable to perform INSERT INTO (EXECUTE)
DBI DBD::ODBC error: Unable to perform INSERT INTO
Win32::ODBC error: Unable to perform INSERT INTO
PostgreSQL error: Unable to connect to database
PostgreSQL error: Unable to perform PREPARE
PostgreSQL error: Unable to perform INSERT INTO (EXECUTE)

* (daemon mode only)

翻訳トラップは、syslogに送信することができます。 エントリの形式は(syslogdの時間記録と同様)日付なしで上記のようになります。:

trap-oid severity category hostname translated-trap

syslogエントリは、通常右のような形式で書き出されます。:date hostname snmptt[pid]:

syslogを設定するには、snmptt iniファイルを編集し、次の変数を変更します。:

syslog_enable
syslog_facility
syslog_level

snmptt.iniファイルを編集し、以下の変数を変更することでSNMPTTのシステムエラーをsyslogに送信することができます。:

syslog_system_enable
syslog_system_facility
syslog_system_level

Syslog system entries normally start with:
syslogシステムのエントリは、通常で右のような形式で書き出されます。:date hostname snmptt-sys[pid]:

次のエラーが記録されます。:

SNMPTT (version) started (*)
Unable to enter spool dir x (*)
Unable to open spool dir x (*)
Unable to read spool dir x (*)
Could not open trap file x (*)
Unable to delete trap file x from spool dir (*)
Unable to delete !reload file spool dir (*)
Unable to delete !statistics file spool dir (*)
Reloading configuration file(s) (*)
SNMPTT (version) shutdown (*)
Loading snmpttconfigfile (*)
Could not open configuration file:snmpttconfigfile(*)
Finished loading x lines from snmpttconfigfile(*)
MySQL error: Unable to connect to database
SQL error: Unable to connect to DSN
Can not open log file logfile
MySQL error: Unable to perform PREPARE
MySQL error: Unable to perform INSERT INTO (EXECUTE)
DBI DBD::ODBC error: Unable to perform INSERT INTO
Win32::ODBC error: Unable to perform INSERT INTO
PostgreSQL error: Unable to connect to database
PostgreSQL error: Unable to perform PREPARE
PostgreSQL error: Unable to perform INSERT INTO (EXECUTE)

* (daemon mode 限定)

Logging – EventLog

Translated traps can also be sent to the NT EventLog.  All traps are logged under EventID 2 under the source SNMPTT.  The format of the entries will be similar to above without the date (as the Event Log logs the date):

trap-oid severity category hostname translated-trap

To configure eventlog support, edit the snmptt ini file and modify the following variables:

eventlog_enable
eventlog_type

SNMPTT system errors can be sent to the Event Log by editing the snmptt.ini file and modifying the following variables:

eventlog_system_enable

The following errors are logged.  Note that each error contains a unique EventID:

EventID 0: SNMPTT (version) started (*)
EventID 3: Unable to enter spool dir x (*)
EventID 4: Unable to open spool dir x (*)
EventID 5: Unable to read spool dir x (*)
EventID 6: Could not open trap file x (*)
EventID 7: Unable to delete trap file x from spool dir(*)
EventID 20: Unable to delete !reload file spool dir(*)
EventID 21: Unable to delete !statistics file spool dir (*)
EventID 8: Reloading configuration file(s) (*)
EventID 1: SNMPTT (version) shutdown (*)
EventID 9: Loading snmpttconfigfile (*)
EventID 10: Could not open configuration file: snmpttconfigfile(*)
EventID 11: Finished loading x lines from snmpttconfigfile(*)
EventID 12: MySQL error: Unable to connect to database
EventID 13: SQL error: Unable to connect to DSN dsn
EventID 14: Can not open log file logfile
EventID 23: MySQL error: Unable to perform PREPARE
EventID 15: MySQL error: Unable to perform INSERT INTO (EXECUTE)
EventID 16: DBI DBD::ODBC error: Unable to perform INSERT INTO
EventID 17: Win32::ODBC error: Unable to perform INSERT INTO
EventID 18: PostgreSQL error: Unable to connect to database
EventID 22: PostgreSQL error: Unable to perform PREPARE
EventID 19: PostgreSQL error: Unable to perform INSERT INTO (EXECUTE)

* (daemon mode only)

Note:

To prevent “Event Message Not Found” messages in the Event Viewer, an Event Message File must be used.  For
information on installing the message file, see the Installation section for Windows.

翻訳トラップは、NT EventLogに送信することができます。 すべてのトラップは、EventID 2、ソースがSNMPTTとしてログに記録されます。 エントリフォーマットは、(イベントログの時間記録と同様に)日付なしの上記のようになります。:

trap-oid severity category hostname translated-trap

イベントログのサポートを設定するには、snmptt iniファイルを編集し、次の変数を変更します。:

eventlog_enable
eventlog_type

snmptt.iniファイルを編集し、以下の変数を変更することによってSNMPTTのシステムエラーをイベントログに送信することができます。:

eventlog_system_enable

次のエラーが記録されます。  各エラーは、ユニークなEventIDを含んでいることに注意してください。:

EventID 0: SNMPTT (version) started (*)
EventID 3: Unable to enter spool dir x (*)
EventID 4: Unable to open spool dir x (*)
EventID 5: Unable to read spool dir x (*)
EventID 6: Could not open trap file x (*)
EventID 7: Unable to delete trap file x from spool dir(*)
EventID 20: Unable to delete !reload file spool dir(*)

EventID 21: Unable to delete !statistics file spool dir (*)
EventID 8: Reloading configuration file(s) (*)
EventID 1: SNMPTT (version) shutdown (*)
EventID 9: Loading snmpttconfigfile (*)
EventID 10: Could not open configuration file: snmpttconfigfile(*)
EventID 11: Finished loading x lines from snmpttconfigfile(*)
EventID 12: MySQL error: Unable to connect to database
EventID 13: SQL error: Unable to connect to DSN dsn
EventID 14: Can not open log file logfile
EventID 23: MySQL error: Unable to perform PREPARE
EventID 15: MySQL error: Unable to perform INSERT INTO (EXECUTE)
EventID 16: DBI DBD::ODBC error: Unable to perform INSERT INTO
EventID 17: Win32::ODBC error: Unable to perform INSERT INTO
EventID 18: PostgreSQL error: Unable to connect to database
EventID 22: PostgreSQL error: Unable to perform PREPARE
EventID 19: PostgreSQL error: Unable to perform INSERT INTO (EXECUTE)

* (daemon mode 限定)

注:

イベントビューアのメッセージにおいて、”イベントメッセージが見つかりません”となるのを防ぐために、イベントメッセージファイルを使用する必要があります。メッセージファイルのインストールについては、Installation section for Windowsを参照してください。

Logging – Database

Translated and unrecognized traps can also be sent to a database.  MySQL (tested under Linux), PostgreSQL (tested under Linux) and ODBC (tested under Windows NT) can be used.

To configure unknown trap logging, edit the snmptt.ini file and modify the following variables:

enable_unknown_trap_log
db_unknown_trap_format

翻訳されたものも認識されていなものも、trapをデータベースに送信することもできます。  MySQL(Linux環境でテスト)、PostgreSQL(Linux環境でテスト)、ODBC(Windows NT環境でテスト)が利用できます。

unknown trapのロギングを設定するには、snmptt.iniファイルを編集し、次の変数を変更します。:

enable_unknown_trap_log
db_unknown_trap_format

DBD::MySQL

To configure SNMPTT for MySQL, modify the following variables in
the snmptt.ini file.

mysql_dbi_enable
mysql_dbi_host
mysql_dbi_port
mysql_dbi_database
mysql_dbi_table
mysql_dbi_table_unknown
mysql_dbi_username
mysql_dbi_password

Note:  Sample values are defined in the default ini file.  Defining mysql_dbi_table_unknown is optional.

The following MySQL script can create the database and table. Permissions etc should also be defined. Run ‘mysql‘ as root and enter:

CREATE DATABASE snmptt;
USE snmptt;

DROP TABLE snmptt;
CREATE TABLE snmptt (
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
eventname VARCHAR(50),
eventid VARCHAR(50),
trapoid VARCHAR(100),
enterprise VARCHAR(100),

community VARCHAR(20),
hostname VARCHAR(100),
agentip  VARCHAR(16),
category VARCHAR(20),
severity VARCHAR(20),
uptime  VARCHAR(20),
traptime VARCHAR(30),
formatline VARCHAR(255));

Note: To store the traptime as a real date/time (DATETIME data type), change ‘traptime VARCHAR(30),’ to ‘traptime DATETIME,’ and set date_time_format_sql in snmptt.ini to %Y-%m-%d %H:%M:%S.

Note: If you do not want the auto-incrementing id column, remove the ‘id INT…’ line.

If logging of unknown traps to a SQL table is required, create the snmptt_unknown table using:

USE snmptt;

DROP TABLE snmptt_unknown;
CREATE TABLE snmptt_unknown (
trapoid VARCHAR(100),
enterprise VARCHAR(100),

community VARCHAR(20),
hostname VARCHAR(100),
agentip  VARCHAR(16),
uptime  VARCHAR(20),
traptime VARCHAR(30),
formatline VARCHAR(255));

Note: To store the traptime as a real date/time (DATETIME data type), change ‘traptime VARCHAR(30),’ to ‘traptime DATETIME,’ and set date_time_format_sql in snmptt.ini to %Y-%m-%d %H:%M:%S.

If logging of statistics to a SQL table is required, create the snmptt_statistics table using:

USE snmptt;

DROP TABLE snmptt_statistics;
CREATE TABLE snmptt_statistics (
stat_time VARCHAR(30),
total_received BIGINT,
total_translated BIGINT,
total_ignored BIGINT,
total_unknown BIGINT);

Note: To store the stat_time as a real date/time (DATETIME data type), change ‘stat_time VARCHAR(30),’ to ‘stat_time DATETIME,’ and set stat_time_format_sql in snmptt.ini to %Y-%m-%d %H:%M:%S.

Note: The variable lengths I have chosen above should be sufficient, but they may need to be increased depending on your environment.

To add a user account called ‘snmptt‘ with a password of ‘mytrap‘ for use by SNMPTT, use the following SQL statement:

GRANT ALL PRIVILEGES ON *.* TO ‘snmptt’@’localhost’ IDENTIFIED BY ‘mytrap’;

MySQLのSNMPTTを設定するには、snmptt.iniファイルにおける以下の変数を変更します。

mysql_dbi_enable
mysql_dbi_host
mysql_dbi_port
mysql_dbi_database
mysql_dbi_table
mysql_dbi_table_unknown
mysql_dbi_username
mysql_dbi_password

Note:  Sample values are defined in the default ini file.  Defining mysql_dbi_table_unknown is optional.

注:  サンプルの値は、デフォルトのiniファイルで定義されています。 mysql_dbi_table_unknownの定義はオプションです。

以下のMySQLスクリプトで、データベースとテーブルを作成することができます。権限などの定義も必要です。’mysql‘をrootにて実行し、入力してください。:

CREATE DATABASE snmptt;
USE snmptt;

DROP TABLE snmptt;
CREATE TABLE snmptt (
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
eventname VARCHAR(50),
eventid VARCHAR(50),
trapoid VARCHAR(100),
enterprise VARCHAR(100),

community VARCHAR(20),
hostname VARCHAR(100),
agentip  VARCHAR(16),
category VARCHAR(20),
severity VARCHAR(20),
uptime  VARCHAR(20),
traptime VARCHAR(30),
formatline VARCHAR(255));

注:trapTimeに実際の日付/時刻(DATETIME データ型)をストアする為、’traptime VARCHAR(30),’から’traptime DATETIME,’へ変更し、snmptt.iniにおけるdate_time_format_sql%Y-%m-%d %H:%M:%Sに設定してください。

注:自動インクリメントのID列を使用しない場合は、’id INT…’ 行を削除してください。

unknown trapsのロギングにSQLのテーブルが必要な場合は、snmptt_unknownのテーブルを作成して使用してください。:

USE snmptt;

DROP TABLE snmptt_unknown;
CREATE TABLE snmptt_unknown (
trapoid VARCHAR(100),
enterprise VARCHAR(100),

community VARCHAR(20),
hostname VARCHAR(100),
agentip  VARCHAR(16),
uptime  VARCHAR(20),
traptime VARCHAR(30),
formatline VARCHAR(255));

注:trapTimeに実際の日付/時刻(DATETIME データ型)をストアする為、’traptime VARCHAR(30),’から’traptime DATETIME,’へ変更し、snmptt.iniにおけるdate_time_format_sql%Y-%m-%d %H:%M:%Sに設定してください。

statisticsのロギングにSQLのテーブルが必要な場合は、snmptt_statisticsのテーブルを作成して使用してください。:

USE snmptt;

DROP TABLE snmptt_statistics;
CREATE TABLE snmptt_statistics (
stat_time VARCHAR(30),
total_received BIGINT,
total_translated BIGINT,
total_ignored BIGINT,
total_unknown BIGINT);

注:stat_timeに実際の日付/時刻(DATETIME データ型)をストアする為、’traptime VARCHAR(30),’から’traptime DATETIME,’へ変更し、snmptt.iniにおけるdate_time_format_sql%Y-%m-%d %H:%M:%Sに設定してください。

注:上記で選定した変数長は充分なものですが、環境により増やす必要がある可能性があります。

SNMPTTにより使用される’mytrap‘のパスワードを持った’snmptt‘ユーザーのアカウントを追加するため、次のSQL文を使用します。:

GRANT ALL PRIVILEGES ON *.* TO ‘snmptt’@’localhost’ IDENTIFIED BY ‘mytrap’;

DBD::PgPP (PostgreSQL)

(本節の翻訳は省略します。ご容赦ください。)

DBD::ODBC

(本節の翻訳は省略します。ご容赦ください。)

Win32::ODBC

(本節の翻訳は省略します。ご容赦ください。)

Executing an external program

An external program can be launched when a trap is received.  The command line is defined in the configuration file.  For example, to send a page using QPAGE (http://www.qpage.org), the following
command line could be used:

qpage -f TRAP notifygroup1 “$r $x $X Compaq Drive Array Spare Drive on controller $4, bus $5, bay $6 status is $3.”

$r is translated to the hostname, and $x is the current date, and $X is the current time (described in detail below)

To enable or disable the execution of EXEC definitions, edit the snmptt.ini file and modify the following variable:

exec_enable

It is also possible to launch an external program when an unknown trap is received. This can be enabled by defining unknown_trap_exec in snmptt.ini. Passed to the command will be all standard and enterprise variables, similar to unknown_trap_log_file but without the newlines.

トラップの受信時に外部プログラムを起動することができます。 コマンドラインは、コンフィギュレーションファイルで定義されます。 例えば、QPAGE(http://www.qpage.org)を使用してページを送信するには、次のコマンドラインを使用することができます。:

qpage -f TRAP notifygroup1 “$r $x $X Compaq Drive Array Spare Drive on controller $4, bus $5, bay $6 status is $3.”

$r は、ホスト名、$x は現在の日付、$X は現在の時刻に変換されます。(詳細は以下に記載)

EXEC定義の実行を有効または無効にするには、snmptt.iniファイルを編集し、次の変数を変更します。:

exec_enable

unknown trapが受信時に外部プログラムを起動することも可能です。これは、snmptt.iniにてunknown_trap_execを定義することで有効になります。改行された行を含まないすべての標準とエンタープライズ変数が、unknown_trap_log_fileと同様にコマンドに渡されます。

Modes of Operation

SNMPTT can be run in two modes:  standalone mode and daemon mode.

スタンドアローンモードと、デーモンモード: SNMPTTは2つのモードで実行することができます。

Standalone mode

To use SNMPTT in standalone mode, the snmptrapd.conf file would contain a
traphandle statement such as:

traphandle default /usr/sbin/snmptt

When a trap is received by SNMPTRAPD, the trap is passed to the /usr/sbin/snmptt script.  SNMPTT performs the following tasks:

  • reads trap passed from snmptrapd
  • loads configuration file(s) containing trap definitions
  • searches traps for a match
  • logs, executes EXEC statement etc
  • quits

With a 450 Mhz PIII and a 9000 line snmptt.conf containing 566 unique traps (EVENTs), it takes under a second to process the trap including logging and executing the qpage program.  The larger the snmptt.conf file is, the longer it will take to process.  If there are a large number of traps being received, daemon mode should be used.  If it takes 1 second to process one trap, then obviously you shouldn’t try to process more than one trap per second.

Running SNMPTT without the –daemon command line option will result standalone mode unless the mode variable in the snmptt.ini file is set to daemon.  For standalone mode, the mode variable in the snmptt.ini file should be set standalone.

Note: Enabling the UCD-SNMP / Net-SNMP Perl module will greatly increase the startup time of SNMPTT.  Daemon mode is recommended.

standalone modeでSNMPTTを使用するには、snmptrapd.confファイルには次のようなtraphandle文を含めます。:

traphandle default /usr/sbin/snmptt

SNMPTRAPDによってtrapが受信されると、trapは/usr/sbin/snmpttスクリプトに渡されます。 SNMPTTは次のタスクを実行します。:

  • snmptrapdのから渡されたtrapを読み取ります
  • トラップ定義を含む設定ファイル(複数可)をロードします
  • 条件に一致するtrapを検索します
  • ログおよびEXEC文の実行などを行います
  • 終了

450MHzのPIII、566のトラップ(イベント)条件を含む9000行のsnmptt.confで、ロギングとqpageのプログラムを実行することtrap処理に1秒以下の時間となります。snmptt.confファイルが大きいほど処理に時間を要します。 大量のtrapを受信する場合、daemon mode での利用する必要があります。当然のことですが、1つのトラップを処理するために1秒かかるようであれば、1秒間の処理に2つ以上のトラップを処理させようとすることはしないでください。
SNMPTT起動時において、snmptt.iniファイルのmode変数をdaemonに設定せず、コマンドラインのオプションに–daemonを含めずに起動することでstandalone modeで動作します。 スタンドアロンモードの場合は、snmptt.iniファイルのmode変数は、standaloneと設定する必要があります。

注: UCD-SNMP / Net-SNMP のPerlモジュールを有効にすると、大幅にSNMPTTの起動時間が増加します。この場合daemon modeが推奨されます。

Daemon mode

When SNMPTT is run in daemon mode, the snmptrapd.conf file would contain a traphandle statement such as:

traphandle default
/usr/sbin/snmptthandler

When a trap is received by SNMPTRAPD, the trap is passed to the /usr/sbin/snmptthandler
script.  SNMPTTHANDLER performs the following tasks:

  • reads trap passed from snmptrapd
  • writes the trap in a new unique file to a spool directory such as /var/spool/snmptt
  • quits

SNMPTT running in daemon mode performs the following tasks:

  • loads configuration file(s) containing trap definitions at startup
  • reads traps passed from spool directory
  • searches traps for a match
  • logs, executes EXEC statement etc
  • sleeps for 5 seconds (configurable)
  • loops back up to ‘reads traps passed from spool directory’

Using SNMPTTHANDLER and SNMPTT in daemon mode, a large number of traps per minute should be handled easily.

Running SNMPTT with the –daemon command line option or setting the mode variable in the snmptt.ini file to
daemon will cause SNMPTT to run in daemon mode.

By setting the snmptt.ini variable
use_trap_time to 1 (default), the date and time used for logging will be the date and time passed inside the trap spool
file.  If use_trap_time is set to 0, the date and time that the trap was processed by SNMPTT is used.  Setting use_trap_time to 0 can result in inaccurate time stamps in log files due to the length of time SNMPTT sleeps between spool directory polling.

Note:  When running on a non Windows platform, SNMPTT will fork to the background and create a pid file in /var/run/snmptt.pid if daemon_fork is set to 1.  If the user is not able to create the /var/run/snmptt.pid file, it will attempt to create one in the current working directory.

Sending the HUP signal to SNMPTT when running as a daemon will cause it to reload the configuration file including the .ini file, snmptt.conf files listed in the .ini file and any NODES files if dynamic_nodes is disabled.  A reload can also be forced by adding a file to the spool directory called !reload.  The filename is not case sensitive.  If this file is detected, it will flag a reload to occur and will delete the file.  This would be the only way to cause a reload when using Windows as Windows does not support signals.

Statistical logging of total traps received, total traps translated and total unknown traps can be enabled by setting the statistics_interval snmptt.ini variable to a value greater than 0.  At each interval (defined in seconds), the statistics will be logged to syslog or the event log.

Sending the USR1 signal will also cause the statistical information for total traps received, total traps translated and total unknown traps to be logged.  This could be used for example if you want to log statistics at a set time each day using a task scheduler instead of using the interval time defined in the snmptt.ini variable statistics_interval.  A statistics dump can also be forced by adding a file to the spool directory called !statistics which is processed similar to the !reload file.

SNMPTTをdaemon modeで利用している場合、snmptrapd.confファイルには次のようなtraphandle文が含まれます、:

traphandle default
/usr/sbin/snmptthandler

SNMPTRAPDによってtrapが受信されると、trapは/usr/sbin/snmpttスクリプトに渡されます。 SNMPTTは次のタスクを実行します。:

  • snmptrapdのから渡されたtrapを読み取ります
  • /var/spool/snmptt のようなスプールディレクトリにtrapの情報を新しい一意のファイルに書き込みます。
  • 終了

バックアップのループ”は、スプールディレクトリから渡されたトラップを読み取って”
デーモンモードでSNMPTTHANDLERとSNMPTTを使用して、毎分トラップの多数は容易に処理する必要があります。
とSNMPTTを実行する – デーモンのコマンドラインオプションまたはデーモンへsnmptt.iniファイルでモード変数を設定すると、SNMPTTがデーモンモードで実行するようになります。
daemon modeのSNMPTTは、次のタスクを実行します。:

  • トラップ定義を含む設定ファイル(複数可)をロードします
  • スプールディレクトリから渡されたtrapを読み取ります
  • 条件に一致するtrapを検索します
  • ログおよびEXEC文の実行などを行います
  • 5秒間スリープします(設定可能)
  • ‘スプールディレクトリから渡されたtrapを読み取ります’の工程に戻ります

daemon modeのSNMPTTとSNMPTTHANDLERを使用して、毎分の大量のトラップの処理を容易にしましょう。

とSNMPTTを実行する – デーモンのコマンドラインオプションまたはデーモンへsnmptt.iniファイルでモード変数を設定すると、SNMPTTがデーモンモードで実行するようになります。

–daemonのコマンドラインオプションをつけてSNMPTTを起動するか、snmptt.iniファイルでmode変数をdaemonへ設定すると、SNMPTTがdaemon modeで実行するようになります。

snmptt.iniuse_trap_time変数を1 (default)に設定することで、ログ記録に使用される日付および時刻は、トラップのスプールファイルの内部に渡された日付と時刻になります。 use_trap_time0に設定されている場合は、トラップがSNMPTTによって処理された日付と時刻が使用されます。 0use_trap_timeを設定すると、SNMPTTはスプールディレクトリのポーリングの間にあるスリープ時間の長さにより、ログファイル内のタイムスタンプが不正確になる可能性があります。

注: Windowsプラットフォーム上で実行すると、daemon_forkが1に設定されていれば、SNMPTTはバックグラウンドでforkされ、/var/run/snmptt.pidにpidファイルを作成します。 ユーザが/var/run/snmptt.pidファイルを作成できない場合、現在の作業ディレクトリ内に作成しようとします。

daemonとして実行するときにSNMPTTにHUPシグナルを送ると、dynamic_nodesが無効になっている場合、snmptt.confのファイルにリストされる.iniファイルと、任意のNODESファイルを含む設定ファイルをリロードします。 また、!reloadと呼ばれるものをスプールディレクトリにファイルを追加することによってリロードを強制することができます。 ファイル名は大文字と小文字は区別しません。 このファイルが検出された場合、リロードフラグを設定し、ファイルを削除します。 Windowsはシグナルをサポートしていないため、Windowsを使用している場合、これがリロードを発生させる唯一の方法となります。

snmptt.inistatistics_interval変数を0より大きい値にの設定することで、total traps receivedtotal traps translatedtotal unknown trapsの統計ロギングを有効にできます。 それぞれの間隔(秒単位での定義)で、統計情報がsyslogまたはイベントログに記録されます。

また、USR1シグナルを送ることでも、total traps receivedtotal traps translatedtotal unknown trapsの統計情報をログに記録します。 たとえば、snmptt.iniにおける変数statistics_intervalで時間間隔を定義する代わりに、タスクスケジューラを使用して、毎日設定した時刻に統計をログに記録するような場合に使用することができます。 スプールディレクトリに!statisticsファイルを追加することで、!reloadファイルと同様、統計のダンプを強制処理させることができます。

Command line arguments

The following command line arguments are supported:

Usage:
    snmptt [<options>]
Options:
   –daemon                        Start in daemon mode
   –debug=n                       Set debug level (1 or 2)
   –debugfile=filename    Set debug output file
   –dump                              Dump (display) defined traps
   –help                                Display this message
   –ini=filename                 Specify path to snmptt.ini file
   –version                           Display author and version information
   –time                                Use to see how long it takes to load and
                                             process trap file (eg: time snmptt –time)
 

次のコマンドライン引数がサポートされています。:

使用法:
    snmptt [<options>]
オプション:
   –daemon                        daemon modeでの起動
   –debug=n                       デバッグレベル設定 (1 or 2)
   –debugfile=filename    デバッグファイル出力先の設定
   –dump                              定義トラップのダンプ(表示)
   –help                                このメッセージの出力
   –ini=filename                 snmptt.iniファイルパスの指定
   –version                           作成者とバージョン情報の表示
   –time                                トラップのファイルをロードして処理するのにかかる
                                             時間を確認する目的で使用(eg: time snmptt –time)
 

SNMPTT.CONF Configuration file format

The configuration file (usually /etc/snmp/snmptt.conf or c:\snmp\snmptt.conf) contains a list of all the defined traps.

If your snmptt.conf file is getting rather large and you would like to divide it up into many smaller files, then do the following:

-create additional snmptt.conf files
-add the file names to the snmptt_conf_files section in the snmptt.ini file.

For example:

snmptt_conf_files = <<END
/etc/snmp/snmptt.conf.generic
/etc/snmp/snmptt.conf.compaq
/etc/snmp/snmptt.conf.cisco
/etc/snmp/snmptt.conf.hp
/etc/snmp/snmptt.conf.3com
END

The syntax of the snmptt.conf file  is:

EVENT event_name event_OID “category” severity

FORMAT format_string

[EXEC command_string]

[NODES sources_list]

[MATCH [MODE=[or | and]] | [$n:[!][(    ) | n | n-n | > n |< n | x.x.x.x | x.x.x.x-x.x.x.x | x.x.x.x/x]]

[REGEX (    )(   )[i][g][e]]

[SDESC]
[EDESC]

Note: Lines starting with a # will be ignored.

Note:  The EVENT and FORMAT line are REQUIRED. Commands in [] are optional.  Do NOT include the []s in the configuration file!

設定ファイル (通常 /etc/snmp/snmptt.conf または c:\snmp\snmptt.conf) はすべての定義済みのトラップのリストが含まれています。

あなたのsnmptt.confファイルがかなり大きくなり、小さなファイルに分割したい場合、次の操作を行います。:

-追加のsnmptt.confファイルを作成する
-snmptt.iniファイルのsnmptt_conf_filesセクションにファイル名を追加する

例:

snmptt_conf_files = <<END
/etc/snmp/snmptt.conf.generic
/etc/snmp/snmptt.conf.compaq
/etc/snmp/snmptt.conf.cisco
/etc/snmp/snmptt.conf.hp
/etc/snmp/snmptt.conf.3com
END

snmptt.confファイルの構文は次のとおりです。:

EVENT event_name event_OID “category” severity

FORMAT format_string

[EXEC command_string]

[NODES sources_list]

[MATCH [MODE=[or | and]] | [$n:[!][(    ) | n | n-n | > n |< n | x.x.x.x | x.x.x.x-x.x.x.x | x.x.x.x/x]]

[REGEX (    )(   )[i][g][e]]

[SDESC]
[EDESC]

注: #で始まる行は無視されます。

注: EVENTおよびFORMAT行は必須です。 [ ] 内のコマンドはオプションです。設定ファイルには[ ] は入れないでください!

EVENT:

EVENT event_name event_OID “category” severity

event_name:

Unique text label (alias) containing no spaces.  This would match the name on the TRAP-TYPE or NOTIFICATION-TYPE line in the MIB file when converted using snmpttconvertmib.

event_OID:

Object identifier string in dotted format or symbolic notation containing no spaces.

For example, a Compaq (enterprise .1.3.6.1.4.1.232) cpqHoGenericTrap trap (trap 11001) would be written as:

.1.3.6.1.4.1.232.0.11001

Symbolic names can also be used if the UCD-SNMP / Net-SNMP Perl module is installed and enabled by setting net_snmp_perl_enable in the snmptt.ini file.  For example:

linkDown

IF-MIB::linkDown

Note:

Net-SNMP 5.0.9 and earlier does not support including the module name (eg: IF-MIB::) when translating an OID.  A patch is available for 5.0.8+ that is included in Net-SNMP 5.1.1 and higher. The patch is available from the Net-SNMP patch page.  If the version of Net-SNMP you are using does not support this feature and the event OID is specified with the module name, the event definition will be ignored. Also note that UCD-SNMP may not properly convert symbolic names to numeric OIDs which could result in traps not being matched.

SNMP V1 traps are in the format of enterprise ID (.1.3.6.1.4.1.232) followed by a 0, and then followed by the trap number (11001).

There can be multiple entries for the same trap OID in the configuration file.  If multiple_event is enabled in the snmptt.ini, then it will process all matching traps.  If multiple_event is disabled, only the first matching entry will be used.

Wildcards in dotted format notation can  also be used.  For example:

.1.3.6.1.4.1.232.1.2.*

Note:

Specific trap matches are performed before wildcards so if you have an entry for .1.3.6.1.4.1.232.1.2.5 AND .1.3.6.1.4.1.232.1.2.*, it will process the .5 trap when received even if the wildcard is defined first.

Wildcard matches are only matched if there are NO exact matches.  This takes into consideration the NODES list. 
Therefore, if there is a matching trap, but the NODES list prevents it from being considered a match, the wildcard entry will only be used if there are no other exact matches.

category:

Character string enclosed in double “s.  Used when logging output (see above).

If the category is “IGNORE“, no action will take place even if the snmptt.conf contains FORMAT and / or EXEC statements.

If the category is “LOGONLY“, the trap will be logged as usual, but the EXEC statement will be ignored.

Note:   If you plan on using an external program such as Nagios for logging, paging etc, you probably do not want any traps defined with LOGONLY as the EXEC line would never be used to submit the passive service check.

severity:

Character string of the severity of the event. Used in the output when logging.  Example: Minor, Major,Normal, Critical, Warning.  The snmptt.ini contains options to match the syslog level or NT Event Log type to the severity level.

EVENT event_name event_OID “category” severity

event_name:

スペースを含まないユニークなテキストラベル(別名)。 これは、snmpttconvertmibを使用して変換するMIBファイルのTRAP-TYPEやNOTIFICATION-TYPEライン上で名前を一致させる。

event_OID:

ドットで区切られたフォーマットまたはシンボリック表記のスペースを含まないオブジェクト識別子の文字列。

たとえば、Compaq (enterprise .1.3.6.1.4.1.232) の cpqHoGenericTrap trap (trap 11001) は以下のように記述されます:

.1.3.6.1.4.1.232.0.11001

UCD-SNMP / Net-SNMP のPerlモジュールがインストールされ、snmptt.iniファイルにnet_snmp_perl_enableを有効に設定している場合、シンボル名を使用することもできます。次に例を示します。:

linkDown

IF-MIB::linkDown

注:

Net-SNMPの5.0.9およびそれ以前バージョンはOIDの変換にモジュール名(例:IF-MIB::)を含むことはサポートされません。 パッチは、5.0.8以上で利用可能で、Net-SNMP 5.1.1以降には同梱しています。パッチは、Net-SNMP patch pageから入手可能です。 使用しているNet-SNMPのバージョンがこの機能をサポートせず、イベントOIDがモジュール名で指定されている場合は、イベントの定義は無視されます。 また、UCD-SNMPではシンボル名から数値OIDへの変換が正しく行えず、trapがマッチングしない結果になることがあるので注意してください。

SNMP V1 traps は、エンタープライズID (.1.3.6.1.4.1.232) に0が続き、トラップ番号(11001)が続く形式になります。

コンフィギュレーションファイルに同じトラップOIDに対して複数のエントリがある場合もあります。 multiple_eventsnmptt.iniで有効になっている場合、一致するすべてのトラップを処理します。 multiple_eventが無効になっている場合、最初に一致したエントリだけが使用されます。

ドット区切り形式の表記でワイルドカードを使用することもできます。 次に例を示します。:

.1.3.6.1.4.1.232.1.2.*

注:

Specific trap matches は、ワイルドカードより前に処理されますので、もし、.1.3.6.1.4.1.232.1.2.5 と .1.3.6.1.4.1.232.1.2.* のエントリがある場合、もしワイルドカードの定義が先行していても .5 trap を受信した場合にはそちらが処理されます。

Wildcard matches は、正確に一致するデータが存在しない場合のみ一致となります。 これはNODESリストも考え合わせます。 したがって、マッチするtrapがあっても、NODESリストで一致したとみなされない場合には、他の正確な一致条件がない場合のみワイルドカードと一致します。

はワイルドカードの一致にのみ一致します。これは考慮ノードのリストを取ります。他の正確な一致がない場合したがって、そこにマッチするトラップがあるが、ノードのリストが一致したと見なされることを防止する場合、ワイルドカードエントリにのみ使用されます。

category:

カテゴリは”IGNORE“されている場合snmptt.confは、FORMATおよび/またはEXECステートメントが含まれている場合でも、何もアクションは行われません。ログ出力する際に、二重の ” で囲まれた文字列が使用されます。(上記参照)

category が “IGNORE“の場合、FORMATおよび/またはEXECステートメントが含まれている場合でも、何もアクションは行われません。

category が “LOGONLY“の場合、trapはいつものように記録されますが、EXECステートメントは無視されます。

注:  ログ記録や、ページングなどでNagiosのような外部プログラムの使用を予定している場合、パッシブサービスチェックのための EXEC行が利用されないLOGONLYで定義されたtrapは一切不要となるでしょう。

severity:

イベントの重大度の文字列。 ログ出力に使用。 例:Minor, Major,Normal, Critical, Warning。 snmptt.iniは、重大度レベルにsyslogレベルまたはNTイベントログのタイプを一致させるオプションを含んでいます。

FORMAT:

FORMAT format_string

There can be only one FORMAT line per EVENT.

The format string is used to generate the text that will be logged to any of the supported logging methods.

Variable substitution is performed on this string using the following variables:

$A – Trap agent host name (see Note 1)
$aA – Trap agent IP address
$Be – securityEngineID (snmpEngineID) (see Note 7)
$Bu – securityName (snmpCommunitySecurityName) (see Note 7)
$BE – contextEngineID (snmpCommunityContextEngineID) (see Note 7)
$Bn – contextName (snmpCommunityContextName) (see Note 7)
$c – Category
$C – Trap community string
$D – Description text from SNMPTT.CONF or MIB file (see Note 6)
$E – Enterprise trap OID in symbolic format
$e  – Enterprise trap OID in number format
$Fa  – alarm (bell) (BEL)
$Ff  – form feed (FF)
$Fn  – newline (LF, NL)
$Fr  – return (CR)
$Ft  – tab (HT, TAB)
$Fz  – Translated FORMAT line (EXEC only)
$G  – Generic trap number (0 if enterprise trap)
$H  – Host name of the system running SNMPTT
$S  – Specific trap number (0 if generic trap)
$N  – Event name defined in .conf file of matched entry
$i  – Event OID defined in .conf file of matched entry (could be a wildcard OID)
$O – Trap OID in symbolic format (see Note 4)
$o – Trap OID in numerical format (see Note 4)
$R, $r  – Trap hostname (see Note 1)
$aR, $ar – IP address
$s  – Severity
$T  – Uptime:  Time since network entity was initialized
$X  – Time trap was spooled (daemon mode) or current time (standalone mode)
$x  – Date trap was spooled (daemon mode) or current date (standalone mode)
$# – Number of (how many) variable-bindings in the trap
$$  – Print a $
$@ – Number of seconds since the epoch of when the trap was spooled (daemon mode) or the current time (standalone mode)
$n  – Expand variable-binding n (1-n) (see Note 2,5)
$+n  – Expand variable-binding n (1-n) in the format of variable name:value (see Note 2,3,5)
$-n  – Expand variable-binding n (1-n) in the format of variable name (variable type):value (see Note 2,3,5)
$vn  – Expand variable name of the variable-binding n (1-n)(see Note 3)
$*  – Expand all variable-bindings (see Note 5)
$+*  – Expand all variable-bindings in the format of variable name:value (see Note 2,3,5)
$-*  – Expand all variable-bindings in the format of variable name (variable type):value (see Note 2,3,5)

Example:

FORMAT NIC switchover to slot $3, port $4 from slot $5, port $6

Note:

For the text log file, the output will be formatted as:

date time trap-OID severity category hostname – format

For all other log files except MySQL, DBD::ODBC and Win32::ODBC, the output will be formatted as:

trap-OID severity category hostname – format

For MySQL, DBD::ODBC and Win32::ODBC, the formatline column will contain only the format text.

Note (1):

See the section ‘Name Resolution / DNS‘ for important DNS information.

Note (2):

If  translate_integers is enabled in the snmptt.ini file, SNMPTT will attempt to convert integer values received in traps into text by performing a lookup in the MIB file.

You must have the UCD-SNMP / Net-SNMP Perl module installed for this to work and you must enable support for it by enabling net_snmp_perl_enable in the snmptt.ini file.

For this feature to work, you must ensure UCD-SNMP / Net-SNMP is configured correctly with all the required MIBS.  If the option is enabled, but the value can not be found, the integer value will be used.  If the MIB files are present, but translations do not occur, ensure UCD-SNMP / Net-SNMP is correctly configured to process all the required mibs.  This is configured in the UCD-SNMP / Net-SNMP snmp.conf file.  Alternatively, you can try setting the mibs_enviroment
variable in snmptt.ini to ALL (no quotes) to force all MIBS to be initialized at SNMPTT startup.

If translate_integers is enabled while using stand-alone mode, it may take longer to process each trap due to the initialization of the MIB files.

Note (3):

$vn, $+n and $-n variable names and variable type are translated into the text name by performing a lookup in the MIB file.  You must have the UCD-SNMP / Net-SNMP Perl module installed for this to work and you must enable support for it by enabling net_snmp_perl_enable in the snmptt.ini file.  If net_snmp_perl_enable is not enabled, the $vn variable will be replaced with the text ‘variablen‘ where n is the variable number (1+).

For the name translation to work, you must ensure UCD-SNMP / Net-SNMP is configured correctly with all the required MIBS.  If the option is enabled and the correct name is not returned, ensure UCD-SNMP / Net-SNMP is correctly configured to process all the required mibs.  This is configured in the UCD-SNMP / Net-SNMP snmp.conf file.  Alternatively, you can try setting the mibs_enviroment variable in snmptt.ini to ALL (no quotes) to force all MIBS to be initialized at SNMPTT startup.

Note (4):

If  translate_trap_oid is enabled in the snmptt.ini file, SNMPTT will attempt to convert the numeric OID of the received trap into symbolic form such as IF-MIB::linkDown.  You must have the UCD-SNMP / Net-SNMP Perl module installed for this to work and you must enable support for it by enabling net_snmp_perl_enable in the snmptt.ini file.  If net_snmp_perl_enable is not enabled, it will default to using the numeric OID. 

Net-SNMP 5.0.9 and earlier does not support including the module name (eg: IF-MIB::) when translating an OID and most of the 5.0.x versions do not properly tranlsate numeric OIDs to long symbolic names.  A patch is available for 5.0.8+ that is included in Net-SNMP 5.1.1 and higher. The patch is available from the Net-SNMP patch page.

Note (5):

If  translate_oids is enabled in the snmptt.ini file, SNMPTT will attempt to convert any numeric OIDs found inside the variables passed inside the trap to symbolic form.  You must have the UCD-SNMP / Net-SNMP Perl module installed for this to work and you must enable support for it by enabling net_snmp_perl_enable in the snmptt.ini file.  If net_snmp_perl_enable is not enabled, it will default to using the numeric OID. 

Net-SNMP 5.0.9 and earlier does not support including the module name (eg: IF-MIB::) when translating an OID and most of the 5.0.x versions do not properly tranlsate numeric OIDs to long symbolic names.  A patch is available for 5.0.8+ that is inlcuded in Net-SNMP 5.1.1 and higher. The patch is available from the Net-SNMP patch page.

Note (6):

The snmptt.ini description_mode option must be set to either 1 or 2. If set to 1, the description is pulled from the SNMPTT.CONF files. If set to 2, the description is pulled from the MIB file. If using the MIB file, you must have the UCD-SNMP / Net-SNMP Perl module installed and enabled.

Note (7):

These variables are only available when using the embedded trap handler for snmptrapd (snmptthandler-embedded).

FORMAT format_string

EVENTごとに1つのFORMAT行を含めることができます。

フォーマット文字列はテキスト生成に使用され、サポートされるログ方法のいずれかで記録されます。

変数置換は、次の変数を使用して、フォーマット文字列に対して実行されます。:

$A – Trap agent host name (注1を参照)
$aA – Trap agent IP address
$Be – securityEngineID (snmpEngineID) (注 7参照)
$Bu – securityName (snmpCommunitySecurityName) (注 7参照)
$BE – contextEngineID (snmpCommunityContextEngineID) (注 7参照)
$Bn – contextName (snmpCommunityContextName) (注 7参照)
$c – Category
$C – Trap community string
$D – SNMPTT.CONFまたはMIBファイルからの説明のテキスト (注6を参照)
$E – シンボリック形式のEnterprise trap OID
$e – 数値形式のEnterprise trap OID
$Fa – アラーム(ベル)(BEL)
$Ff – フォームフィード (FF)
$Fn – 改行 (LF, NL)
$Fr – リターン (CR)
$Ft – タブ (HT, TAB)
$Fz – 翻訳されたFORMAT行(EXEC only)
$G – Generic trap number (enterprise trapならば0)
$H – SNMPTTを実行しているシステムのホスト名
$S – Specific trap number (generic trapならば0)
$N – .confファイルにおいて条件一致するEvent name
$i – .confファイルにおいて条件一致するEvent OID(ワイルドカードOIDの場合もあります)
$O – シンボリック形式のTrap OID (注4を参照)
$o – 数値形式のTrap OID (注4を参照)
$R, $r – Trap hostname (注1を参照)
$aR, $ar – IPアドレス
$s – Severity
$T – Uptime: ネットワークエンティティが初期化されてからの時間
$X – trapがスプールされた時間(daemon mode)または、現在の時刻(standalone mode)
$x – trapがスプールされた日付(daemon mode)または、現在の日付(standalone mode)
$# – trapにおけるvariable-bindingsの数(いくつ変数があるか)
$$ – $のプリント
$@ – トラップがスプールされた時刻(daemon mode) または現在の時刻(standalone mode)のUNIX時刻
$n – 変数バインディングn(1-n)の展開 (注2,5を参照)
$+n変数名:値 の形式での変数バインディングn(1-n)の展開 (注2,3,5を参照)
$-n変数名(変数型):値 の形式での変数バインディングn(1-n)の展開 (注2,3,5を参照)
$vn – 変数名n (1-n)の展開 (see Note 3)
$* – 全ての変数バインディングの展開 (see Note 5)
$+* – 変数名:値 の形式での全ての変数バインディングの展開 (注2,3,5を参照)
$-* – 変数名(変数型):値 の形式での全ての変数バインディングの展開 (see Note 2,3,5)

例:

FORMAT NIC switchover to slot $3, port $4 from slot $5, port $6

注:

テキストログファイルの場合、出力は次のようにフォーマットされます。:

date time trap-OID severity category hostname – format

MySQL、DBD::ODBC そして Win32::ODBC を除く他のすべてのログファイルについては、出力は次のようにフォーマットされます。:

trap-OID severity category hostname – format

MySQL、DBD::ODBC そして Win32::ODBC は、formatline の列には、専用形式のテキストが含まれます。

注 (1):

重要なのDNS情報は、セクション’Name Resolution / DNS‘を参照してください。

注 (2):

translate_integerssnmptt.iniファイルで有効になっている場合、SNMPTTは、MIBファイル内を参照し、trapで受け取った整数値をテキストに変換しようとします。

snmptt.iniファイルでnet_snmp_perl_enableを有効に機能させるため、 UCD-SNMP / Net-SNMP Perl モジュールをインストールする必要があります。

この機能を動作させるためには、必要なすべてのMIBとともに UCD-SNMP / Net-SNMP を正しく設定する必要があります。オプションが有効になっているものの、値が見つからない場合は、整数値が使用されます。オプションが有効になっているものの、値が見つからない場合は、整数値が使用されます。 MIBファイルが存在するものの、変換が動作しない場合は、UCD-SNMP / Net-SNMP が正しく設定され、必要なすべてのMIBを処理するようになっているか確認してください。これは UCD-SNMP / Net-SNMP の snmp.confファイルに設定されています。あるいは、snmptt.inimibs_enviroment値をALL(引用符なし)に設定することで、SNMPTTの起動時にすべてのMIBを強制的に初期化するように強制することを試すことができます。

stand-aloneモードを使用中で、translate_integersが有効になっている場合、MIBファイルの初期化のために、各trapの処理に時間がかかることがあります。

注 (3):

$vn、$+n そして $-n は、変数名 と 変数の型 MIBファイル内を参照してテキスト名に変換されます。 これが機能するために、UCD-SNMP / Net-SNMP Perl モジュールをインストールして、snmptt.iniファイルにおいてnet_snmp_perl_enableを有効にしておく必要があります。 net_snmp_perl_enableが無効の場合、$vnの変数は1以上の変数である’variablen‘に置き換えられます。

名前の変換を機能させるには、UCD-SNMP / Net-SNMPが必要なすべてのMIBを使用して正しく設定されていることを確認する必要があります。 オプションが有効になっており、正しい名前が返ってこない場合、ensure UCD-SNMP / Net-SNMPが正しく、必要なすべてのMIBを処理するように構成されていることを確認してください。 snmp.confファイルで UCD-SNMP / Net-SNMP は設定されています。  あるいは、snmptt.inimibs_enviroment値をALL(引用符なし)に設定することで、SNMPTTの起動時にすべてのMIBを強制的に初期化するように強制することを試すことができます。

注意(4):

snmptt.iniファイルにおいてtranslate_trap_oidが有効になっている場合、SNMPTTは数値形式のOIDで受信したtrapをIF-MIB::linkDownのようなシンボリック形式に変換しようとします。 これ機能するには、UCD-SNMP / Net-SNMP Perl モジュールがインストールされ、snmptt.iniファイルでnet_snmp_perl_enableの有効化がサポートされる必要があります。installed for this to work and you must enable support for it by enabling net_snmp_perl_enable in the snmptt.ini file. net_snmp_perl_enableが有効になっていない場合、数値形式のOIDを使用するよう標準設定されます。

Net-SNMP 5.0.9 およびそれ以前のバージョンでは、モジュール名(例: IF-MIB::)を含むことはサポートされていません。OIDの変換の際に、5.0.xののほとんどのバージョンでは、数値形式のOIDから長いシンボル名へ正しく変換しません。 5.0.8以上のバージョンでパッチが利用可能で、Net-SNMP 5.1.1以上で含まれます。パッチはNet-SNMP patch pageから入手できます。

注 (5):

snmptt.iniファイルでtranslate_oidsが有効な場合、SNMPTTは渡されたtrapから任意の数値形式のOIDを見つけ、シンボリック形式に変換しようとします。 
これが機能するには、UCD-SNMP / Net-SNMP Perlモジュールをインストールし、 snmptt.iniファイルにおけるnet_snmp_perl_enableの有効化をする必要があります。 net_snmp_perl_enableが有効な場合、数値形式のOIDを使用するようにデフォルト設定されます。

Net-SNMP 5.0.9 およびそれ以前のバージョンでは、モジュール名(例: IF-MIB::)を含むことはサポートされていません。OIDの変換の際に、5.0.xののほとんどのバージョンでは、数値形式のOIDから長いシンボル名へ正しく変換しません。 5.0.8以上のバージョンでパッチが利用可能で、Net-SNMP 5.1.1以上で含まれます。パッチはNet-SNMP patch pageから入手できます。

注 (6):

snmptt.iniにおけるdescription_modeオプションは1または2のいずれかに設定する必要があります。1に設定されている場合、SNMPTT.CONFファイルの説明が取得されます。2に設定されている場合、MIBファイルから取得されます。MIBファイルを使用している場合には、UCD-SNMP / Net-SNMP Perlモジュールがインストールされて有効になっている必要があります。

注 (7):

snmptrapd (snmptthandler-embedded)用の、組込み用のトラップハンドラを使用するときのみにこれらの変数が使用可能です。

EXEC:

[EXEC command_string]

There can be multiple EXEC lines per EVENT.

Optional string containing a command to execute when trap is received and arguments to pass to the program.  The EXEC lines are executed in the order that they appear.

EXEC uses the same variable substitution as the FORMAT line.

Example:

EXEC /usr/bin/qpage -f TRAP alex “$r: $x $X – NIC switchover to slot $3, port $4 from slot $5, port $6”

or

EXEC c:\snmp\pager netops “$r: $x $X – NIC switchover to slot $3, port $4 from slot $5, port $6”

Note: Unlike the FORMAT line, nothing is prepended to the message.  If you would like to include the hostname and date in the page above, you must use the variables such as $r, $x and $X.

[EXEC command_string]

イベントごとに複数のEXECの行が存在することが可能です。

トラップを受信し、引数をプログラムに渡す際に実行されるコマンドを含むオプション文字列。 EXEC行は表示順で実行されます。

EXECは、FORMATのラインと同じ変数置換を使用しています。

例:

EXEC /usr/bin/qpage -f TRAP alex “$r: $x $X – NIC switchover to slot $3, port $4 from slot $5, port $6”

または

EXEC c:\snmp\pager netops “$r: $x $X – NIC switchover to slot $3, port $4 from slot $5, port $6”

注: Unlike the FORMAT line, nothing is prepended to the message.  If you would like to include the hostname and date in the page above, you must use the variables such as $r, $x and $X.
FORMATのラインとは異なり、何もメッセージの前に付加されません。 上記の通知でホスト名と日付を含むようにしたい場合は、そのような$r, $x, $Xのような変数を使用する必要があります。

PREEXEC:

[PREEXEC command_string]

There can be multiple PREEXEC lines per EVENT.

Optional string containing a command to execute after a trap is received but before the FORMAT and EXEC statements are processed. The output of the external program is stored in the $pn variable where n is a number starting from 1. Multiple PREEXEC lines are permitted. The first PREEXEC stores the result of the command in $p1, the second in $p2 etc. Any ending newlines are removed. The snmptt.ini parameter pre_exec_enable can be used to enable / disable PREEXEC statements.

PREEXEC uses the same variable substitution as the FORMAT line.

Example:

EVENT linkDown .1.3.6.1.6.3.1.1.5.3 “Status Events” Normal
FORMAT Link down on interface $1($p1). Admin state: $2. Operational state: $3
PREEXEC /usr/local/bin/snmpget -v 1 -Ovq -c public $aA ifDescr.$1

Sample output:

Link down on interface 69(“100BaseTX Port 1/6 Name SERVER1”). Admin state up. Operational state: down

In the above example the result is in quotes because that is
what comes back from snmpget (it is not added by SNMPTT).

[PREEXEC command_string]

EVENTごとに複数のPREEXEC行が存在することができます。

オプション文字列はトラップ受信後の実行コマンドを含みますが、FORMAT と EXEC 文の前に処理されます。
外部プログラムの出力は、1から始まる数字nを持った$pn変数に保存されます。複数のPREEXECの行は許可されています。PREEXECによる最初のコマンド実行結果は$p1、2番目は$p2とストアされます。行末の改行は削除されます。snmptt.ini のパラメータ pre_exec_enable は、PREEXEC 宣言の有効/無効にするため利用できます。

PREEXECはFORMATと同じ変数置換を使用しています。

例:

EVENT linkDown .1.3.6.1.6.3.1.1.5.3 “Status Events” Normal
FORMAT Link down on interface $1($p1). Admin state: $2. Operational state: $3
PREEXEC /usr/local/bin/snmpget -v 1 -Ovq -c public $aA ifDescr.$1

サンプル出力:

Link down on interface 69(“100BaseTX Port 1/6 Name SERVER1”). Admin state up. Operational state: down

上記の例の結果では、snmpget(SNMPTTによって追加されていない)から得られた結果を引用符で囲んでいます。

NODES:

[NODES sources_list]

Used to limit which devices can be mapped to this EVENT definition. 

There can be multiple NODES lines per EVENT.

Optional string containing any combination of host names, IP addresses, CIDR network address, network IP address ranges, or a filename.  If this keyword omitted then ALL sources will be accepted.  Each entry is checked for a match.  As soon as one match occurs, searching stops.

For example, if you only wanted devices on the subnet 192.168.1.0/24 to trigger this EVENT, you could use a NODES entry of:

NODES 192.168.1.0/24

If a filename is specified, it must be specified with a full path. 

There are two modes of operation: POS (positive – the default) and NEG (negative). If set to POS, then NODES is a ‘match’ if any of the NODES entries match. If set to NEG, then NODES is a ‘match’ only if none of the NODES entries match. To change the mode of operation, use one of the following statements:

NODES MODE=POS
NODES MODE=NEG

A common use for this feature is when you have devices that implement a trap in a non-standard way (added additional variables for example) such as the linkDown and linkUp traps. By defining two EVENT statements and using NODES statements with NODES MODE, you can have one EVENT statement handle the standard devices, and the other handle the other devices with the extended linkDown / linkUp traps.

Example 1:

This example will match any hosts called fred, barney, betty or wilma:

NODES fred barney betty wilma

Example 2:

This example will match any hosts not called fred, barney, betty or wilma:

NODES fred barney betty wilma
NODES MODE=NEG

Example 3:

This example will load the file /etc/snmptt-nodes (see below), and match any hosts called fred, barney, betty, network ip addresses 192.168.1.1, 192.168.1.2, 192.168.1.3, 192.168.2.1, network range 192.168.50.0/22 or network range 192.168.60.0-192.168.61.255:

NODES /etc/snmptt-nodes

Example 4:

This example will load both files /etc/snmptt-nodes and /etc/snmptt-nodes2 (see above example):

NODES /etc/snmptt-nodes /etc/snmptt-nodes2

Example 5:

NODES 192.168.4.0/22 192.168.60.0-192.168.61.255 etc/snmptt-nodes2

Example 6:

NODES fred /etc/snmptt-nodes pebbles /etc/snmptt-nodes2 barney

where snmptt-nodes contains:

fred
barney betty
# comment lines
192.168.1.1 192.168.1.2 192.168.1.3
192.168.2.1
192.168.50.0/22

192.168.60.0-192.168.61.255

wilma

Notes:

The names are NOT case sensitive and comment lines are permitted by starting the line with a #.

CIDR network addresses must be specified using 4 octets followed by a / followed by the number of bits.  For example: 172.16.0.0/24.  Using 172.16/24 will NOT work.

Do not use any spaces between network ranges as they will be interpreted as two different values.  For example, 192.168.1.1   –    192.168.1.20 will not work.  Use 192.168.1.1-192.168.1.20 instead.

By default, NODES files are loaded when the snmptt.conf files are loaded (during startup of SNMPTT).  The snmptt.ini option dynamic_nodes can be set to 1 to have the nodes files loaded each time an EVENT is processed.

See the section ‘Name Resolution / DNS‘ for important DNS information.

[NODES sources_list]

そのEVENT定義をマップすることができるデバイスを制限するために使用します。 

EVENTごとに複数のNODES行がある場合もあります。

オプション文字列はホスト名、IPアドレス、CIDRネットワークアドレス、ネットワークIPアドレスレンジやファイル名などの任意の組み合わせを含みます。 各エントリーで、一致するか評価がされます。 一致条件が発生した時点で検索は停止します。

たとえば、192.168.1.0/24のサブネットのデバイスのみでEVENTのトリガーを発生したい場合に、以下のNODESエントリを利用できます。:

NODES 192.168.1.0/24

ファイル名で指定する場合は、ファイルをフルパスで指定する必要があります。 

2つの操作モードがあります。:POS (positive – 標準) と NEG (negative)です。POSに設定した場合、NODESNODESのエントリで一致する条件があれば”マッチ”となります。NEGに設定した場合、NODESNODESのエントリに一致しなかったものがマッチとみなされます。操作モードを変更するには、以下の宣言のいずれかを使用します。:

NODES MODE=POS
NODES MODE=NEG

2つのイベント文を定義し、ノードモードでノード文を使用して、1つのEVENT文は、標準的なデバイスを扱うことができ、他のは、拡張リンクダウン/リンクアップトラップを持つ他のデバイスを扱う。
この機能での一般的な用途は、リンクダウンやリンクアップトラップを(たとえば、追加の変数が追加されているなどで)非標準的な方法でトラップを実装しているデバイスがある場合です。
2つのイベント文を定義し、ノードモードでノード文を使用して、一方のEVENTは標準のデバイス扱うことができ、もう一方は拡張リンクダウン/リンクアップトラップを持つ他のデバイスを扱うことができます。

例 1:

この例では、fred, barney, betty, wilmaと呼ばれる任意のホストにマッチします。:

NODES fred barney betty wilma

例 2:

この例では、fred, barney, betty, wilmaと呼ばれない任意のホストにマッチします。:

NODES fred barney betty wilma
NODES MODE=NEG

例 3:

この例では、ファイル/etc/snmptt-nodes(下記参照)をロードし、ホスト名ではfred, barney, betty
ネットワークIPアドレスでは192.168.1.1, 192.168.1.2, 192.168.1.3, 192.168.2.1ネットワークの範囲では192.168.50.0/22または192.168.60.0-192.168.61.255と一致します。(ん?wilmaは???):

NODES /etc/snmptt-nodes

例 4:

この例では、ファイル/etc/snmptt-nodes/etc/snmptt-nodes2の両方をロードします。 (上記例参照):

NODES /etc/snmptt-nodes /etc/snmptt-nodes2

例 5:

NODES 192.168.4.0/22 192.168.60.0-192.168.61.255 etc/snmptt-nodes2

例 6:

NODES fred /etc/snmptt-nodes pebbles /etc/snmptt-nodes2 barney

snmptt-nodesでは以下を含む:

fred
barney betty
# comment lines
192.168.1.1 192.168.1.2 192.168.1.3
192.168.2.1
192.168.50.0/22

192.168.60.0-192.168.61.255

wilma

注:

ホスト名は大文字小文字を区別しません。また、 #で開始される行はコメント行としてみなされます。

CIDRネットワークアドレスはビット数が続く / 4オクテット形式を使用して指定する必要があります。たとえば、172.16.0.0/24です。 172.16/24と設定しても動作しません。

2つの異なる値として解釈されるため、ネットワークの範囲でスペースは利用してはいけません。 たとえば、192.168.1.1-192.168.1.20の代わりに、192.168.1.1 &nbsp-    192.168.1.20 は動作しません。

By default, NODES files are loaded when the snmptt.conf files are loaded (during startup of SNMPTT).
デフォルトでは、NODESのファイルは、(SNMPTTの起動時に)snmptt.confファイルがロードされるときロードされます。 snmptt.iniオプションのdynamic_nodes1に設定することでEVENTが処理されるたびにnodesファイルをロードするよう設定できます。

重要なDNSに関する情報は’Name Resolution / DNS‘を参照してください。

MATCH:

[MATCH [MODE=[or | and]] |
[
$n:[!][(    )[i] | n | n-n | >
n | < n | x.x.x.x | x.x.x.x-x.x.x.x | x.x.x.x/x]]

Optional match expression that must
be evaluated to true for the trap to be considered a match to this EVENT definition.

このイベントの定義にマッチする部分を考慮するトラップをtrueに評価されなければ、オプションの一致式。

If a MATCH statement exists, and no matches evaluate to true, then the default will be to NOT match this EVENT definition.

matchステートメントが存在し、かつマッチがtrueに評価されない場合、デフォルトでは、このイベントの定義と一致しなくなります。

The following Perl regular expression modifiers are supported:

次のPerlの正規表現修飾子がサポートされています。

i – マッチするときにするときに大文字小文字を無視する

次のコマンド形式を使用できます:

MATCH MODE=[or | and]
MATCH $x: [!] (reg) [i]
MATCH $x: [!] n
MATCH $x: [!] n-n
MATCH $x: [!] < n
MATCH $x: [!] > n
MATCH $x: [!] & n
MATCH $x: [!] x.x.x.x
MATCH $x: [!] x.x.x.x-x.x.x.x
MATCH $x: [!] x.x.x.x/x

where:

or or and set the default evaluation mode for ALL matches
デバイスがIPアドレス/トラップを送信したデバイス/エージェントのホスト名に基づいて、このイベントの定義にマップすることができる制限するには、NODESのキーワードが推奨されます。
$x is any variable (example: $3, $A etc)
一致モードは、マッチがない他の試合が行われないと、最終的な結果が真され発生した後に、’または’です。
reg is a regular expression
! is used to negate the result (not)
& is used to perform a bitwise AND
n is a number
x.x.x.x is an IP address
x.x.x.x-x.x.x.x is an IP network address range
x.x.x.x/x is an IP CIDR network addresss
注:

トラップを送信したデバイス/エージェントのIPアドレス/ホスト名に基づいて、EVENT定義のマッピングを制限するには、NODESのキーワードが推奨されます。

マッチモードが’or’の場合、一度条件一致し、その他は一致しない処理であっても、終了結果は正(true)となります。

マッチモードが’and’の場合、一度条件一致に失敗して、他の一致条件も処理されない場合、終了結果は偽(false)となります。

To use parentheses ( or ) in the search expression, they must be backslashed (\).

MATCH MODE= 行が存在しない場合、標準で’or’として扱われます。

EVENTごとに唯一のマッチモードが存在できます。 複数のMATCH MODE= 行がある場合、リスト最後のものが利用されます。

例:

$2が1000から2000の間である必要があります。:

MATCH $2: 1000-2000

以下のいずれか一つと一致していなければなりません(or):$3 が 52、$4 が 192.168.1.10 から 192.168.1.20 の間のIPアドレス、重大度が’Major’:

MATCH $3: 52
MATCH $4: 192.168.1.10-192.168.1.20
MATCH $s: (Major)
以下のすべてが一致していなければいけません(and): $3 が 20 より大きい、かつ、 $5 に alarm や critical の単語を含まない、かつ、$6 に ‘(1) remaining’ を含む、かつ、$7 に大文字小文字を区別せずに文字列 ‘power’ を含む。:

MATCH $3: >20

MATCH $5:!(alarm|critical)

MATCH $6: (\(1\) remaining)
MATCH $7:(power)i

MATCH MODE=and

整数 $1 で4bit目がセット(1)されている。:

MATCH $1: &8

REGEX:

[REGEX(    )(   
)[i][g][e]
]

Optional regular expression to perform a search and replace on the translated FORMAT / EXEC line. Multiple REGEX (    )(    ) lines are permitted.

オプションの正規表現は、翻訳されたFORMAT行/ EXEC行において検索と置換を実行することができます。複数のREGEX (    )(    ) 行が許可されます。

最初の (    ) は、検索式が含まれています。
二番目の (    ) は、置換テキストが含まれています。

次のPerlの正規表現修飾子がサポートされています。:

i – 左のマッチをトライする際に大文字小文字を無視する
g – 最初だけでなくすべての出現箇所を置換する
e – 右側の(評価)をコードとして実行する

キャプチャ(メモリの括弧)またはe修飾子を使用して置換を使用するには、まずsnmptt.iniファイルのallow_unsafe_regex1を設定することにより、サポートを有効にする必要があります。 
注: because the contents of the 安全ではないコードが含まれる可能性があるPerlで右側の(評価)が実行されるため、これは安全ではないとみなされます。.このオプションが有効になっている場合、SNMPTTの設定ファイルがセキュアであることを確実にしてください!

各REGEX行は上から下の順番で累積されてに処理されます。 ふたつ目のREGEXは最初のREGEXの結果にに沿って動作します。

例:

処理前のFORMAT行: UPS has detected a building alarm. Cause: UPS1 Alarm #14: Building alarm 3.

REGEX (Building alarm 3)(Computer room high temperature)
REGEX (Building alarm 4)(Moisture detection alarm)

REGEX (roOm)(ROOM)ig

REGEX (UPS)(The big UPS)
REGEX (\s+)( )g

処理後のFORMAT行:  The big UPS has detected a building alarm. Cause: UPS1 Alarm #14: Computer
ROOM high temperature

検索式に括弧を(または)を使用して、それらがキャプチャとして解釈されそうなものはバックスラッシュ(\)する必要があります。(下記参照) 置換テキストは、バックスラッシュする必要はありません。

例:

置換前のFORMAT行: Alarm (1) and (2) has been triggered

REGEX (\(1\))(One)

REGEX (\(2\))((Two))


置換後のFORMAT行:  Alarm One and (Two) has been triggered

allow_unsafe_regexが有効であれば、キャプチャは、置換テキストで使用することができます。

例:

置換前のFORMAT行: 
The system has logged exception error 55 for the service testservice

REGEX (The system has logged exception error (\d+)
for the service (\w+
))(Service $2 generated error
$1)



置換後のFORMAT行:  Service
testservice generated error 55

allow_unsafe_regexが有効になってe修飾子が指定されている場合、右側の(評価)が実行されます。 これにより、16進数から小数、フォーマットのテキストに変換するなど、さまざまなタスクを実行するPerl関数を使用することができます、そしてすべてのテキストが引用符の内側にある必要があり、ドット(.)を使用して文を連結することができます。

例 1:

置換前のFORMAT行: 
Authentication Failure Trap from IP address: C0 A8 1 FE

REGEX (Address: (\w+)\s+(\w+)\s+(\w+)\s+(\w+))(“address: “.hex($1).”.”.hex($2).”.”.hex($3).”.”.hex($4))ei


置換後のFORMAT行:  Authentication Failure Trap from IP address: 192.168.1.254

例 2:

置換前のFORMAT行: 
Authentication Failure Trap from IP address: C0 A8 1 FE

REGEX (Address: (\w+)\s+(\w+)\s+(\w+)\s+(\w+))(“address:”.sprintf(“%03d.%03d.%03d.%03d”,hex($1),hex($2),hex($3),hex($4)))ie



置換後のFORMAT行: Authentication Failure Trap from IP address: 192.168.001.254

例 3

This example is for a BGP bgpBackwardTranstion trap.  The OID for the bgpBackwardTranstion trap has the IP address of the device that transitioned appended to the end of the OID.  To create a meaningful trap message, the IP address needs to be separated from the variable OID.  Because the IP address is part of the OID variable name instead of the OID value, a REGEX expression is needed.  The following uses the $+1 variable on the FORMAT line so REGEX can parse out the IP address.

この例では、BGPのbgpBackwardTranstionトラップのためです。 bgpBackwardTranstionトラップのOIDは、OIDの末尾に追加移行したデバイスのIPアドレスを持っています。 意味のあるトラップメッセージを作成するには、IPアドレスは、変数OIDから分離する必要があります。 IPアドレスは、OID値のOIDのvariable nameの一部であるため、REGEXの式が必要です。 以下では、FORMAT行で$+1変数を使用できるようREGEXのIPアドレスを解析しています。 

置換前のFORMAT行:  Peer:$+2

FORMAT line after substitution, but before
REGEX:  Peer:bgpPeerState.192.168.1.1:idle

REGEX (Peer:.*\.(\d+\.\d+\.\d+\.\d+):(.*))(“Peer: $1 has transitioned to $2”)e


置換後のFORMAT行:  Peer: 192.168.1.1 has transitioned to idle

例 4

This example is a sample of using
Perl subroutines inside of a REGEX statement.

置換前のFORMAT行:  Extremely severe error has occured

REGEX (Extremely severe error has occured)((“Better get a lotto ticket!!  Here is a lotto number to try:”.sprintf (“%s”, lottonumber());sub lottonumber { for(my $i=0;$i<6;$i++) { $temp = $temp . ” ” . (int(rand 49) +1); } return $temp; } )ie


置換後のFORMAT行:  Better get a lotto ticket!!  Here is a lotto number to try: 36 27 38
32 29 6

注: すべての変数置換が完了した後、最後に翻訳された FORMAT/ EXEC 行でREGEX式は実行されます。

SDESC

[SDESC]

説明のオプションの開始。 この行からEDESC行の間のすべてのテキストはsnmpttによって無視されます。このセクションは、あなた自身の用途でトラップに関するコメントを入力するために使用できます。あなたがSDESCを使用する場合は、EDESCが従わなければなりません。

EDESC

[EDESC]

説明のセクションを終了するために使用。

例:

SDESC
Trap used when power supply fails in
a server.
EDESC

SNMPTT.CONF Configuration file Notes

構成ファイル内で同じトラップの定義が複数存在する場合は、次の規則が適用されます。:

A match occurs when:

  • The received trap OID matches a defined OID in the configuration file
  • AND ( the hostname matches a defined hostname in the NODES entry OR there is no NODES entry )
  • AND ( the MATCH statement evaluates to TRUE OR the there is no MATCH entry  )

If multiple_event is set to 1 in snmptt.ini:

  • A trap is handled as many times as it matches in the configuration file
  • If any number of exact matches exist, the wildcard match is NOT performed
  • If an exact match does NOT exist, the wildcard match IS performed if ( the hostname matches a defined hostname in
    the NODES entry OR there is no NODES entry )
    AND ( the MATCH statement evaluates to TRUE OR the there is no MATCH entry  )

If multiple_event is set to 0 in snmptt.ini:

  • A trap is handled once using the first match in the configuration file
  • If an exact match exists, the wildcard match is NOT performed
  • If an exact match does NOT exist, the wildcard match IS performed if ( the hostname matches a defined hostname in the NODES entry OR there is no NODES entry )
    AND ( the MATCH statement evaluates to TRUE OR the there is no MATCH entry  )

Name resolution / DNS

snmptrapdはトラップ送信デバイス(ホスト)のIPアドレス、トラップ送信デバイス(ホスト)のホスト名(ホスト名を解決するために設定されている場合)、そして実際のSNMPエージェント(エージェント)のIPアドレスを渡します。

もし、dns_enable が0 (DNSが無効)に設定されている場合には、AGENTのホスト名である変数 $A はNODESマッチ、およびSQLデータベースのhostnameカラムにおいて利用できなくなります。 唯一の例外として、(ホスト)IPアドレスが(エージェント)IPアドレスとマッチし、snmptrapdがホスト名を解決するよう設定されている場合があります。 このケースでは、明らかな同一ホストとなるため、(ホスト)ホスト名は(エージェント)ホスト名として利用されます。

dns_enable が1 (DNSが有効)に設定されている場合には、ホストとエージェントの両方のホスト名がDNS経由で解決されます。 NODESエントリもマッチ処理の前にIPアドレスに解決されます。

ホスト名は完全修飾ドメイン名(FQDN)に解決される場合があります。例えば:barney.bedrock.comとします。あなたの /etc/hosts や、 %systemroot%\system32\drivers\etc\hosts に代わりとなる短いホスト名(barney)を加えているかもしれません。 SNMPTTのstrip_domain / strip_domain_listオプションはFQDN形式のホスト名からドメイン部分を取り除くすることができます。 詳細についてはsnmptt.iniファイルを参照してください。

IPアドレスをホスト名に解決できるようにするには、PTRレコードがDNSに存在しているか、ローカルホストファイルにすべてのホストが含まれている必要があります。

SNMPTT / snmptrapd が動作するマシンにおいてDNS がインストールされているか すべてのデバイスのlocal hostsファイルを設定していることが推奨されます。. DNSは受信トラップドメインのセカンダリ(権威サーバ)として設定する必要があります。これは、名前解決によるネットワークトラフィック、名前解決の速度、DNSネットワークへの依存を解消します。 ローカルDNSやhostsファイルが使用されていない場合では、全体のネットワーク管理ステーションは、DNS / リモートネットワーク停止時に役立たずになる可能性があり、ネットワーク管理ソフトウェアの誤警報が発生する可能性があります。

Sample1 SNMPTT.CONF file

snmptt.conf:

注:examplesのフォルダは、サンプルとなるsnmptt.confファイルが含まれています。

以下はsnmptt.conf:にある2つの定義されたトラップのサンプルです:

#
EVENT COMPAQ_11003 .1.3.6.1.4.1.232.0.11003 “LOGONLY” Normal
FORMAT Compaq Generic Trap: $*
EXEC qpage -f TRAP notifygroup1 “Compaq Generic Trap: $*”
NODES /etc/snmp/cpqnodes
SDESC
Generic test trap
EDESC
#
#
EVENT cpqDa3AccelBatteryFailed .1.3.6.1.4.1.232.0.3014 “Error Events” Critical
FORMAT Battery status is $3.
EXEC qpage -f TRAP notifygroup1 “$s $r $x $X: Battery status is $3”
NODES ntserver1 ntserver2 ntserver3
#
#

Sample2 SNMPTT.CONF file

以下はsnmptt.iniにロードするファイルのリストのサンプルです:

snmptt_conf_files = <<END
/etc/snmp/snmp-compaq.conf
/etc/snmp/snmp-compaq-hsv.conf
END

以下は/etc/snmp/snmptt-compaq.confに定義された1つのトラップのサンプルです。:

#
EVENT COMPAQ_11003 .1.3.6.1.4.1.232.0.11003 “LOGONLY” Normal
FORMAT Compaq Generic Trap: $*
EXEC qpage -f TRAP notifygroup1 “Compaq Generic Trap: $*”
NODES /etc/snmp/cpqnodes
SDESC
Generic test trap
EDESC
#

以下は/etc/snmp/snmptt-compaq-hsv.confに定義された1つのトラップのサンプルです。:

#
EVENT mngmtAgentTrap-16025 .1.3.6.1.4.1.232.0.136016025 “Status Events” Normal
FORMAT Host $1 : SCellName-TimeDate $2 : EventCode $3 : Description $4
EXEC qpage -f TRAP notifygroup1 “Host $1 : SCellName-TimeDate $2 : EventCode $3 : Description $4”
SDESC
“Ema EMU Internal State Machine Error [status:10]”
EDESC
#

Notes

既存のHP OpenViewのtrapd.confはほとんどの場合で使用することができますが、ファイルはバージョン3のファイルでなければなりません。 SNMPTTはHPOVに実装されているすべての変数をサポートしていませんが、ほとんどが使用可能です。次の変数は、またはHPOVに正確に一致しない場合があります。: $O, $o, $r, $ar, $R, $aR

一部のベンダーは、(CompaqやCiscoなど)、HP OpenViewのユーティリティを使用してHP OpenViewにインポート可能なファイルを提供しています。 Snmpttconvertsnmptt.conf形式にファイルを変換するために使用することができます。

一部のベンダーは、TRAPまたはNOTIFICATIONの定義を含むMIBファイルを提供しています。  Snmpttconvertmibsnmptt.conf形式にファイルを変換するために使用することができます。
 

Limitations

Standalone mode only:

450 MHzのPIIIにて、9000行のsnmptt.confで、566ユニークなトラップ(EVENT)定義を持つ場合、ロギングしてqpageのプログラム実行しすることを含めて、トラップ処理にかかる時間は1秒未満となる。 snmptt.confファイルが大きくなるほど、処理にかかる時間は長くなります。 受信するトラップ数が多い場合は、daemon modeを使用する必要があります。 1つのトラップを処理するために1秒かかるようであれば、当然、それ以上のtrapを毎秒処理複数のトラップを処理しようとしないでください。

注: UCD-SNMP / Net-SNMP Perl モジュールを有効化すると、SNMPTTのの起動時刻を大きく増加します。  Daemon modeが推奨されます。

Standalone or daemon mode:

SNMPTRAPDはtraphandleコマンドを実行中にプログラムのブロックします。 これは、終了しないプログラムが呼び出された場合に、SNMPTRAPDは永久に待ち続けることを意味します。 traphandlerの実行中にトラップが受信された場合、それはバッファされ、traphandlerが終了してから処理されます。このバッファの大きさがどの程度あるかわかりません。

The program called by SNMPTT (EXEC) blocks SNMPTT.  If you call a program that does not return, SNMPTT will be left
waiting.  In standalone mode, this would cause snmptrapd to wait forever also.SNMPTT(EXEC)によって呼び出されるプログラムはSNMPTTをブロックします。 もし、戻ってこないプログラムを呼び出してしまうと、SNMPTTはウェイティングのままになります。 standalone modeでは、これはsnmptrapdも永遠に待機させてしまう原因となります。
 

Feedback & Bugs

alex_b@users.sourceforge.net 宛にどんなことでも – 良いことも悪いことも – ご意見をお送りください。 変換トラップファイルに、何かしらの問題があれば、その際に変換しようとしていたファイルも含めてくださいメールを送ってください。私はそれを見るようにします。

Please also send any bug reports, patches or improvements so I
can fix / add them and add it to the next release.
バグレポート、パッチや改良もお送りください。修正/追加し、次のリリースに追加できるようにします。 また、バグや機能要求のためにSourceforgeのbugsfeature requestsを使用することができます。
 

Integration with other software

Nagios / Netsaint

Overview

Nagios / Netsaint is a system monitoring application. It monitors hosts and services and alerts you when things go wrong.  The name changed from Netsaint to Nagios in July of 2002.

This section will outline the basic steps to integrate SNMPTT with Nagios.  It will not attempt to explain how Nagios works.  There is very good documentation available on the Nagios web page.  You should be able to install and configuration Nagios before attempting to integrate it with SNMPTT.  You should also have a functioning SNMPTT system that can at least log translated traps to a log file.

Nagios / Netsaintは、システム監視アプリケーションです。 それは、ホストとサービスを監視し、物事がうまくいかないときに警告を発します。 名前は、2002年7月にNetsaintからNagiosに変更されました。

このセクションでは、NagiosでSNMPTTを統合する基本的な手順のアウトラインとなります。 これはNagiosがどのように動作するか説明しようとはしません。 Nagios web pageで利用できる非常に優れたドキュメントがあります。 SNMPTTと統合しようとする前にNagiosのインストールおよび構成はできている必要がります。 また、最低でもログファイルに変換トラップをログに記録できる機能をもつSNMPTTシステムが必要です。

Nagios Passive Service Checks

Passive service checks allow Nagios to process service check results that are submitted by external applications.  Using SNMPTT’s EXEC statement, the received trap can be passed to Nagios using the submit_check_result script included with Nagios.  Once received by Nagios, the trap can be logged, a page sent, email sent etc. 

One service is defined for each Nagios host that is to receive traps from SNMPTT.  The benefits of using only one service entry is that it is makes it easier to set up Nagios. Trying to define every possible trap for every host you have is not recommended.  For example, after converting the MIBS from Compaq, there are over 340traps defined.  Trying to define this for every Compaq server would not be a good idea as 40 servers * 340 traps = 13,600 service definitions.

The downside of using only one service entry is that you will only see the last trap that was recieved on the Nagios console.  Each received trap will be logged, emailed, paged etc but the console will only show the last one as being in the warning or critical state.  The service will remain in this state until you manually force a service check unless you have freshness checking enabled (Nagios 2.0 and higher).  See Clearing received traps in Nagios below.


パッシブサービスチェックはNagiosが外部アプリケーションによって送信されているサービスチェックの結果を処理することができます。 SNMPTTのEXECステートメントを利用して、submit_check_resultスクリプトをNagiosに付属することで受信trapをNagiosに渡すことができます。 1つのサービスがSNMPTTからトラップを受信する各Nagiosホスト用に定義されています。  Nagiosで一度トラップ受信した後、ログに記録し、ページ送信、メール送信などすることができます。 

SNMPTTからtrapを受信するため、1つのservice定義をNagiosのhostに対して設定します。hostでのエントリを使用する利点は、それが簡単にNagiosを設定するようになっているということです。 あなたが持っているすべてのホストに対し、可能なトラップのすべての定義をしようとすることは推奨されていません。 たとえば、Compaq の MIBS を変換すると、340以上のtraps定義があります。 すべてのCompaq製サーバのためにこれを定義して、40台のサーバ* 340のトラップが=13600サービスの定義となるのは良い考えではないでしょう。

1つのサービスのエントリを使用しての欠点は、Nagiosのコンソール上で受信された最後のトラップだけしか見えないということです。 Each received trap will be logged, emailed, paged etc but the console will only show the last one as being in the warning or critical state.受信したトラップはそれぞれ、ロギング、メール通知、ページ通知などされますが、コンソールが唯一の最後のものを表示し、warningや、criticalの状態になります。  (Nagiosの2.0およびそれ以降)で freshness checking を有効にしていない限り、手動でサービスチェックを強制するまでサービスはこの状態のままになります。
 下記のClearing received traps in Nagiosを参照してください。


Nagios Volatile Services

When defining the service for receiving the SNMPTT translated trap, the service must be defined as volatile.  When a service is changed from an OK state to a non-OK state, contacts are notified etc.  Normally, a service is Nagios is NOT defined volatile which means if another service check is performed and the state is STILL non-OK then NO contacts are notified.  Because there is only one service entry for the SNMP traps, we need to make sure we are contacted every time a trap comes in.

SNMPTT翻訳トラップを受信するためのサービスを定義するときに、サービスは、volatileとして定義する必要があります。 
サービスがOK状態からnon-OK状態へ変更された場合、contactsへ通知されるなどする。通常は、Nagiosではサービスはvolatileに定義されず、新たなサービスチェックが処理されて
継続してnon-OK状態を検知しても、
になり、contactsへの通知はされません。 SNMP trapのサービスが1つだけのエントリとなるため、我々は、トラップが登場するたびに通知できる状態であることを確認する必要があります。 

Creating the Nagios service entry

Following is a sample service entry for Nagios.  The Description column should
not be included in the definition.

以下は、Nagiosのサンプルサービスのエントリです。 Description列が定義に含まれるべきではない。

define service{ Description
host_name server01 Name of host
service_description TRAP Name of service.  What you use here must match the same value for the submit_check_result script
is_volatile 1 Enables volatile services
check_command check-host-alive Used to reset the status to OK when ‘Schedule an immediate check of this service’ is selected.
max_check_attempts 1 Leave as 1.
normal_check_interval 1 Leave as 1.
retry_check_interval 1 Leave as 1.
active_checks_enabled 0 Prevent active checks from occuring as we are only using passive checks.
passive_checks_enabled 1 Enables passive checks
check_period 24×7 Required for freshness checking.
notification_interval 31536000 Notification interval.  Set to a very high number to prevent you from getting pages of previously received traps (1 year – restart Nagios at least once a year! – do not set to 0!).
notification_period 24×7 When you can be notified.  Can be changed
notification_options w,u,c Notify on warning, unknown and critical.  Recovery is not enabled so we do not get notified when a trap is cleared.
notifications_enabled 1 Enable notifications
contact_groups cg_core Name of contact group to notify
    }

Note:  Previous versions of this documentation defined a check_period of none, and did not set active_checks_enabled to 0.  As of SNMPTT 1.2, setting active_checks_enabled to 0 instead of setting check_periodto none is recommened as freshness checks require it.  The recovery notification option has also been removed so we do not get notified when a trap is cleared.

Following is a sample service entry for Netsaint.  Netsaint does not support active_checks_enabled, so a check period of none is used.

service[server01]=TRAP;1;none;1;1;1;cg_core;31536000;24×7;0;1;1;;check-host-alive

See the Netsaint documentation and the Nagios table above for an explanation of the various fields.

注: このドキュメントの以前のバージョンでは、 check_period は none に定義し、 active_checks_enabled は 0 に設定していませんでした。
SNMPTT 1.2 では、鮮度チェックが必要なよう、 instead of setting check_period を none にする代わりに、active_checks_enabled を 0 にすることを推奨しています。トラップがクリアされるときに通知がされないよう、復旧通知オプションは削除されました。

以下はNetsaintのサンプルサービスのエントリです。 Netsaintがactive_checks_enabledサポートしていないため、check period は none が利用されています。

service[server01]=TRAP;1;none;1;1;1;cg_core;31536000;24×7;0;1;1;;check-host-alive

フィールドの説明については、上記のNetsaintドキュメントとNagiosの表を参照してください。

~~~~休憩中~~~~

コメントを残す