0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【ONTAP管理操作】ONTAPのMIBファイルからBuilt-in-Trap確認

0
Last updated at Posted at 2026-03-30

はじめに

本記事では、NetApp ONTAP環境で利用されるMIBファイルの概要と、その中に定義されているBuilt-in Trapを一覧表示するPythonスクリプトを紹介します。
SNMPによるTrap監視を行う際には、どのようなTrapが標準で通知されているかを把握することは、障害検知や運用設計の効率化に直結します。
本稿では、ONTAPのMIB構造を簡単に解説したうえで、MIBファイルを解析し、Trap情報を抽出・可視化する方法を記載します。

002.png

何をしたい?できる?

  • スクリプトを使用してMIBファイルからONTAPのBuilt-in-Trap対象を表示させる
  • event generateコマンドでイベント生成し、Built-in Trapの通知を確認する

MIBファイルとは

MIB(Management Information Base)ファイルは、SNMP(Simple Network Management Protocol)で機器情報(CPU使用率、トラフィックなど)を取得・監視する際、何を見ればよいかを定義した標準規格です。

MIBで定義される情報は、.1.3.6.1.4.1.789.0.1のような形で表現されるOID(Object Identifier)という階層構造の番号で管理されており、取得した数値については、MIBファイルを参照することで、このOIDが何を表しているか確認する事ができます。

また、Trap通知では障害検知やイベント監視に欠かせない仕組みですが、通知されたOIDについてはMIBファイルが無いとTrapの内容を正しく理解することができない形となります。

003.png

ONTAPのMIBファイル取得方法

NetAppのサポートサイトもしくは、実機から取得することができます。

実機からの取得方法については、マニュアルを参照してください。

ONTAPのMIBファイルの構成について

ネット上でNETAPP-MIBの一覧を確認できますし、リンク上のサイトの下方にBuilt-iin(組み込み)のTrapで定義されている内容が確認できます。

qiita-square

MIBファイルの中身を確認すると、後半の方にBuilt-in-Trapが定義されている部分が確認できます。
また、{ netapp 0 85 } のような数値(OID)の末番がpriorityとなります。
(85なので、5はwarning)

> cat netapp.mib
(中略)
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
        -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
        -- NetApp trap definitions
        -- See RFC 1215 for instructions on building traps
        --
        -- All EnterpriseSpecific Traps of NetApp
        -- contain the OIDs 'productTrapData and productSerialNum'
        --
        -- The last digit of a trap contains information about the
        -- priority of the trap:
        --
        -- 1 emergency
        -- 2 alert
        -- 3 critical
        -- 4 error
        -- 5 warning
        -- 6 notification
        -- 7 information
        -- 8 debug
        --
        -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
        -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

(中略)

	volumeNearlyFull                NOTIFICATION-TYPE
	OBJECTS                         {productTrapData, productSerialNum}
	STATUS                          current
	DESCRIPTION
		"At least one volume is more than 95% full.
		The string sent with the trap gives the
		name of the volume or volumes which exceed
		the volumeFull or volumeNearlyFull thresholds"

	::= { netapp 0 85 }
(中略)

記事における環境情報

本記事では、以下の環境で実施した内容となります。

OSやモジュールは以下の構成としています。

  • ONTAP 9.18.1
  • Windows Server 2025
  • AlmaLinux 10.1
  • Python 3.12.12

環境のイメージとしては以下の通りです。
qiita-square

設定手順

1. ONTAPのMIBからBuilt-in-Trap対象を表示させるスクリプト作成

1-1. Pythonスクリプト作成

Linux上で以下内容が表示されるようなコードを作成します。

  • TRAP名, Priority, OID, 説明が表示されるようにする
  • 表示内容は,(カンマ)で区切られるようにする
mib-separate.py
import re
import csv
import sys

def parse_netapp_mib(file_path):
    # 優先度のマッピング定義 (MIB内のコメント)
    priority_map = {
        '1': 'emergency',
        '2': 'alert',
        '3': 'critical',
        '4': 'error',
        '5': 'warning',
        '6': 'notice',
        '7': 'information',
        '8': 'debug'
    }

    try:
        # ファイルを開く(エンコーディングは環境に合わせて調整)
        with open(file_path, 'r', encoding='utf-8', errors='ignore') as f:
            content = f.read()
    except FileNotFoundError:
        print(f"Error: {file_path} not found.", file=sys.stderr)
        return []

    # NOTIFICATION-TYPE(トラップ)定義を抽出する正規表現
    trap_pattern = re.compile(
        r'(\w+)\s+NOTIFICATION-TYPE.*?'
        r'DESCRIPTION\s+"(.*?)"\s+'
        r'::=\s+{\s+netapp\s+0\s+(\d+)\s+}',
        re.DOTALL
    )

    extracted_traps = []
    for match in trap_pattern.finditer(content):
        name = match.group(1)
        # 説明文の改行や連続した空白を1つのスペースに集約
        description = " ".join(match.group(2).split())

        trap_id_suffix = match.group(3)
        # OIDの組み立て
        full_oid = f".1.3.6.1.4.1.789.0.{trap_id_suffix}"

        # 優先度の判定(IDの下一桁を使用)
        ones_digit = trap_id_suffix[-1]
        priority = priority_map.get(ones_digit, "unknown")

        extracted_traps.append({
            "name": name,
            "priority": priority,
            "oid": full_oid,
            "description": description
        })

    return extracted_traps

def main():
    # 入力ファイル名
    mib_file = 'netapp.mib'
    traps = parse_netapp_mib(mib_file)

    if not traps:
        print("No traps found or file not accessible.", file=sys.stderr)
        return

    # CSV形式での出力設定
    writer = csv.writer(sys.stdout, lineterminator='\n')

    # ヘッダーの書き込み
    writer.writerow(["SNMP-TRAP Name", "Priority", "TRAP ID", "Description"])

    # データの書き込み
    for t in traps:
        writer.writerow([
            t['name'],
            t['priority'],
            t['oid'],
            t['description']
        ])

if __name__ == "__main__":
    main()

1-2. Pythonスクリプト実行

netapp.mibと同じディレクトリにスクリプトを置いて実行します。
必要に応じでファイル出力を実施します。

# netapp.mibと同ディレクトリにある事の確認
> ls
mib-separate.py  netapp.mib


# スクリプト実行
> python mib-separate.py
SNMP-TRAP Name,Priority,TRAP ID,Description
userDefined,alert,.1.3.6.1.4.1.789.0.2,A polling-style trap built using the 'snmp traps' command on the filer.
dhmNoticeDegradedIO,notice,.1.3.6.1.4.1.789.0.6,Disk Health Monitor - Reported a Disk Degraded-I/O Event
dhmNoticePFAEvent,information,.1.3.6.1.4.1.789.0.7,Disk Health Monitor - Reported a Disk Predictive-Failure Event
emergencyTrap,emergency,.1.3.6.1.4.1.789.0.11,"A user-defined trap indicating an extremely urgent situation, usually indicating that the system has failed and is shutting down."
(中略)
volumeNearlyFull,warning,.1.3.6.1.4.1.789.0.85,At least one volume is more than 95% full. The string sent with the trap gives the name of the volume or volumes which exceed the volumeFull or volumeNearlyFull thresholds
(中略)
vsaCloudProviderScheduledEventScheduled,alert,.1.3.6.1.4.1.789.0.1302,This message occurs when a cloud-provider maintenance event has been initially scheduled.
vsaCloudProviderScheduledEventUpdate,critical,.1.3.6.1.4.1.789.0.1303,This message occurs when the status of a previously scheduled cloud-provider maintenance event has been updated.

Linuxが用意できなくても、PythonなのでGoogle Colaboratoryのノートブックでも動作します
(MIBをドラッグ&ドロップでUploadは必要です)

008.png

2. SNMPの有効化とイベント生成

2-1. ONTAPのSNMP設定

ONTAPのMIBからBuilt-in-Trapのみ通知されるような設定を実施します。

# SNMP通知を確認できる最低限の設定を実施
> snmp traphost add 192.168.1.100
> snmp community add ro public
> snmp init 1

2-2. ONTAPのイベント生成

event generateコマンドでevent log showに表示される任意のイベントを生成することができます。
MIBの内容では、event log showに表示されるEvent名は確認できないので、ONTAPのCLIでBuilt-in-Trapの通知対象を確認します。

> event catalog show -snmp-trap-type Built-in
Message                          Severity         SNMP Trap Type
-------------------------------- ---------------- -----------------
LUN.destroy                      NOTICE           Built-in
LUN.move.dstPresent              INFORMATIONAL    Built-in
Nblade.vscanConnInactive         NOTICE           Built-in
Nblade.vscanVirusDetected        ERROR            Built-in
app.log.alert                    ALERT            Built-in
app.log.debug                    DEBUG            Built-in
app.log.emerg                    EMERGENCY        Built-in
app.log.err                      ERROR            Built-in
app.log.info                     INFORMATIONAL    Built-in
app.log.notice                   NOTICE           Built-in
(中略)
monitor.volume.nearlyFull        ERROR            Built-in
(中略)

この記事では上記で表示されたmonitor.volume.nearlyFull についてイベントを生成します。
event generateコマンドはDiag Modeで実施が必要となります。
また、event generate実行時に、event logに合わせて値の入力が必要になります。
(イベント毎に必要な項目が異なる)

> set diag

Warning: These diagnostic commands are for use by NetApp personnel only.
Do you want to continue? {y|n}: y


# Valuesの部分は、1,2,3,4,5,6のような形でも動作自体はします
# Node名は環境に合わせて下さい
*> event generate -node PS-A400-01 -message-name monitor.volume.nearlyFull -values volume,vol01,12345,56789,90,91


# イベントが生成されている事の確認
::*> event log show -message-name monitor.volume.nearlyFull
Time                Node             Severity      Event
------------------- ---------------- ------------- ---------------------------
3/30/2026 17:48:37  PS-A400-01       ERROR         monitor.volume.nearlyFull: volume vol011234556789 is nearly full (using or reserving 90% of space and 91% of inodes).

2-2. Trapが通知されている事の確認

OID 1.3.6.1.4.1.789.0.85が通知されている事を確認します

SNMP Managerの表示
qiita-square

Wiresharkの表示
qiita-square

(参考) 個別に指定したEventのTrap通知について

Built-in-Trapには、以下のようなEventの個別Trap通知指定に対応したものが用意されています。

TRAP Name Priority OID
alertTrap alert 1.3.6.1.4.1.789.0.12
criticalTrap critical 1.3.6.1.4.1.789.0.13
errorTrap error 1.3.6.1.4.1.789.0.14
warningTrap warning 1.3.6.1.4.1.789.0.15
notificationTrap notification 1.3.6.1.4.1.789.0.16

例えば、ARP機能でSnapshot作成された際にTrapを飛ばしたいという場合は、
以下のイベントをTrap通知設定をする事になりますが、SeverityがNOTICEなので、
上記の1.3.6.1.4.1.789.0.16 が通知される形になります。
詳細についてはTrapの中を確認が必要で、全eventにOIDが付与されているという事では無い形になります。

> event catalog show -message-name arw.*.created
Message                          Severity         SNMP Trap Type
-------------------------------- ---------------- -----------------
arw.snapshot.created             NOTICE           Severity-based
qiita-square

参考及びリンク

Learn about SNMP on the ONTAP network

SNMP Support in Data ONTAP

SNMP MIB Database - Observium

How to generate EMS Events manually for testing purposes

【ONTAP管理操作】Event logの通知設定

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?