SNMPメッセージフォーマット (転載)
転載先: http://www.netwatcher.jp/snmp/snmp_main.html
| SNMPメッセージフォーマットについて説明します。 |
| SNMPメッセージ |
SNMPメッセージ フォーマット
+-------------+-------------+-----------------------+
UDPパケット | IPヘッダー | UDPヘッダー | データ |
+-------------+-------------+-----------------------+
| |
+---------------------------+ +--------+
| |
+------+------+------------+--------------+------------------+
SNMPメッセージ | 型 | 長さ | バージョン | コミュニティ | SNMPコマンド |
+------+------+------------+--------------+------------------+
| |
+-----------------------------------------+ +----------------------+
| |
+------+------+--------------+------------------+--------------------+--------------+
SNMPコマンド | 型 | 長さ | リクエストID | エラーステータス | エラーインデックス | データ |
(PDU : Trap以外) +------+------+--------------+------------------+--------------------+--------------+
| |
+--------------------------------------------------------------------+ |
| |
|
+------+------+-----------+-----------+ +------------+
データ | 型 | 長さ | データ1 | データ2 | ...... | データn |
+------+------+-----------+-----------+ +------------+
+------+------+------------+----------------------+----------+--------------+---------------+--------------+
SNMPコマンド | 型 | 長さ | 企業ID | エージェントアドレス | Trap番号 | 拡張Trap番号 |タイムスタンプ | データ |
(Trapの場合) +------+------+------------+----------------------+----------+--------------+---------------+--------------+
ASN.1(Abstract Syntax Notation 1) : データ型を定義するために用いる記述用言語 のBER(Basic Encoding Rule)
+--------------+----------+---------+
BERエンコーディング | 値の型 (Tag) | 値の長さ | 値 |
+--------------+----------+---------+
| | |
| | 可変長(バイト単位)
| 可変長
1バイト (長さが126以下の場合と127以上で異なる)
| 値の型(Tag)(コマンド) | 数値 |
|---|---|
| GETリクエスト | A0 Hex |
| GET NEXTリクエスト | A1 Hex |
| GETレスポンス | A2 Hex |
| SETリクエスト | A3 Hex |
| TRAP | A4 Hex |
| GETバルク | A5 Hex |
| INFORM | A6 Hex |
| TRAP2 | A7 Hex |
| メッセージレポート | A8 Hex |
| 値の型(Tag)(コマンド以外) | 数値 |
|---|---|
| 整数 | 02 Hex |
| 文字列 | 04 Hex |
| NULL(値なし) | 05 Hex |
| オブジェクトID | 06 Hex |
| 値の組み合わせ(シーケンス) | 30 Hex |
| 時間 | 32 Hex |
| IPアドレス | 40 Hex |
| カウンタ | 41 Hex |
| 増減カウンタ | 42 Hex |
| TimeTicks | 43 Hex |
| Opaque | 44 Hex |
| NsapAddress | 45 Hex |
| Counter64 | 46 Hex |
| Integer32 | 47 Hex |
| Opaque 型の 64bits カウンター | 76 Hex |
| Opaque 型の 32bits 浮動小数点(float) | 78 Hex |
| Opaque 型の 64bits 浮動小数点(double) | 79 Hex |
| Opaque 型の 64bits 符号あり整数 | 7A Hex |
| Opaque 型の 64bits 符号なし整数 | 7A Hex |
| SNMPマネージャからのGet Next Requestコマンド |
Receive date : 12:20:28 : Data length : 40Byte
30 26 02 01 00 04 06 70 75 62 6c 69 63 a1 19 02
+---------------+ |
コミュニティ Get Next Requestコマンド
01 04 02 01 00 02 01 00 30 0e 30 0c 06 08 2b 06
| OID
01 02 01 01 01 00 05 00
Version : 0 (SNMPv1)
Community : public
Command : a1 (GetNextRequest)
Request ID=4 Request OID=1.3.6.1.2.1.1.1.0
| SNMPエージェントからのGet Responseコマンド応答 |
Receive date : 12:11:18 : Data length : 99Byte
30 61 02 01 00 04 06 70 75 62 6c 69 63 a2 54 02
+---------------+ |
コミュニティ GetResponseコマンド
01 02 02 01 00 02 01 00 30 49 30 47 06 08 2b 06
+---------------+ |
エラーステータス/Index OID
01 02 01 01 01 00 04 3b 4c 69 6e 75 78 20 54 6f
| Value
73 68 69 62 61 20 32 2e 34 2e 32 30 2d 36 20 23
31 20 54 68 75 20 46 65 62 20 32 37 20 31 30 3a
30 36 3a 35 39 20 45 53 54 20 32 30 30 33 20 69
36 38 36
Version : 0 (SnmpV1)
Community : public
Command : a2 (GetResponse)
OID : 1.3.6.1.2.1.1.1.0
Value : Linux Toshiba 2.4.20-6 #1 Thu Feb 27 10:06:59 EST 2003 i686
Type : OCTETSTRING(04)
| SNMP V3パケットフォーマット |
SNMPv3 Packet Format
+-- +-----------------------+
| | msgVersion |
| |-----------------------|
| | msgID |
| |-----------------------| USM Security Parameters
| | msgMaxSize |
| |-----------------------| /+-----------------------------+
| | msgFlags | / | msgAuthoritativeEngineID |
scope of |-----------------------| / |-----------------------------|
authentication | msgSecurityModel | / | msgAuthoritativeEngineBoots |
| |-----------------------|/ |-----------------------------|
| | | | msgAuthoritativeEngineTime |
| | msgSecurityParameters | |-----------------------------|
| | | | msgUserName |
| +-- +-----------------------+\ |-----------------------------|
| | | | \ | msgAuthenticationParameters |
| | | | \ |-----------------------------|
| | | | \ | msgPrivacyParameters |
| scope of | scopedPDU | \+-----------------------------+
| encryption | |
| | | |
| | | |
| | | |
| | | |
+------+-- +-----------------------+
SnmpMessageProcessingModel
0, SNMPv1
1, SNMPv2c
2, SNMPv2u and SNMPv2*
3, SNMPv3
4-255, reserved for standards
256 - , enterprise specific
msgFlags(SnmpSecurityLevel)
1, No security, no authentication
2, Authentication, no security
3, Authentication, security
snmpEngineSecurityModel
0, ”Any”
1, SNMPv1
2, SNMPv2c
3, USM
4-255, reserved for standards
256 - , enterprise specific
| SNMPエージェントからの V3 GetResponseコマンド応答 |
Flags:3 priv(認証/暗号化)
-----------------------------------------------------------------
Receive data : 12:47:02 :
30 81 c0 02 01 03 30 0e 02 01 04 02 03 00 ff e3
-- --------
msgID msgMaxSize
04 01 03 02 01 03 04 39 30 37 04 0d 80 00 07 e5
-- -- +----------
Flags USM msgAuthoritativeEngineID
80 21 0d f6 2f ec d0 9c 40 02 02 01 03 02 02 08
--------------------------+ +---+ +-- msgAuthoritativeEngineTime
msgAuthoritativeBoots
e7 04 06 6d 79 6e 61 6d 65 04 0c e6 3d b9 72 39
+---------------+ +--------------
msgUserName message digest, 12 bytes
ad 1a fa 02 ad e9 16 04 08 00 00 01 03 6d 3b bd
--------------------+ +-------------------
msgPrivacyParameters
ad 04 70 0a 82 9b a3 7b 50 8a fb 64 df 3a 2b 18
-+
61 da a0 61 41 40 77 0f b4 e2 90 fc 31 8e 3b 5a
5c c5 28 b3 b4 3b 87 c5 f5 82 d1 f3 28 83 65 d2
53 3f 22 2f 50 d5 3c 5d d1 ef 5a 52 ac 68 78 b5
ca f1 ce f4 de 0c 88 17 2a 44 97 4d f8 79 da 24
ab e1 6a 0f 21 12 e9 a8 e6 8e ab c0 26 d4 70 5a
ab ec 04 d3 0f fc 16 19 d6 4d a0 fe a9 22 e2 9f
74 7d d0
Receive version : 3
Receive msgID : 4
Receive msgMaxSize : 65507
Receive msgFlags : 03
Receive msgSecurityModel : 3
Receive msgAuthoritativeEngineID : 0x800007e580210df62fecd09c40
Receive msgAuthoritativeBoots : 259
Receive msgAuthoritativeEngineTime : 2279
Receive msgUserName : myname
Receive contextEngineID : 0x800007e580210df62fecd09c40
Receive contextName :
Scoped PDU Receive Date : 12:47:02 :
a2 54 02 01 04 02 01 00 02 01 00 30 49 30 47 06
08 2b 06 01 02 01 01 01 00 04 3b 4c 69 6e 75 78
20 54 6f 73 68 69 62 61 20 32 2e 34 2e 32 30 2d
36 20 23 31 20 54 68 75 20 46 65 62 20 32 37 20
31 30 3a 30 36 3a 35 39 20 45 53 54 20 32 30 30
33 20 69 36 38 36
Command : a2 (GetResponse)
OID : 1.3.6.1.2.1.1.1.0
Value : Linux Toshiba 2.4.20-6 #1 Thu Feb 27 10:06:59 EST 2003 i686
Type : OCTETSTRING(04)
浙公网安备 33010602011771号