目的
- 新規テンプレートを作成した際のメモ
- ArubaInstantOn 1830 のI/Fステータスやトラフィック情報をSNMPにて取得
- テンプレートやディスカバリルールを作ってみる
- ディスカバリにて依存アイテムを使ってみる
実践
テンプレートの新規作成
項目名 | 値 |
---|---|
テンプレート名 | InstantOn1830 |
表示名 | InstantOn1830 |
テンプレート | 空欄 |
グループ | Network |
説明 | 空欄 |
値のマッピング
SNMPのインタフェースステータス用に設定
参考情報
https://datatracker.ietf.org/doc/html/rfc2863
ifOperStatus定義抜粋
ifOperStatus OBJECT-TYPE
SYNTAX INTEGER {
up(1), -- ready to pass packets
down(2),
testing(3), -- in some test mode
unknown(4), -- status can not be determined
-- for some reason.
dormant(5),
notPresent(6), -- some component is missing
lowerLayerDown(7) -- down due to state of
-- lower-layer interface(s)
}
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"The current operational state of the interface. The
testing(3) state indicates that no operational packets can
be passed. If ifAdminStatus is down(2) then ifOperStatus
should be down(2). If ifAdminStatus is changed to up(1)
then ifOperStatus should change to up(1) if the interface is
ready to transmit and receive network traffic; it should
change to dormant(5) if the interface is waiting for
external actions (such as a serial line waiting for an
incoming connection); it should remain in the down(2) state
if and only if there is a fault that prevents it from going
to the up(1) state; it should remain in the notPresent(6)
state if the interface has missing (typically, hardware)
components."
::= { ifEntry 8 }
</details>
<table>
<caption>Interface Status</caption>
<thead>
<tr><th>タイプ</th><th>値</th><th>マッピング文字列</th></tr>
</thead>
<tr><td>等しい</td><td>1</td><td>up</td></tr>
<tr><td>等しい</td><td>2</td><td>down</td></tr>
<tr><td>等しい</td><td>3</td><td>testing</td></tr>
<tr><td>等しい</td><td>4</td><td>unknown</td></tr>
<tr><td>等しい</td><td>5</td><td>dormant</td></tr>
<tr><td>等しい</td><td>6</td><td>notPresent</td></tr>
<tr><td>等しい</td><td>7</td><td>lowerLayerDown</td></tr>
</table>
- - -
### テンプレートアイテム の作成
実際に監視を行う際のマスターアイテムを登録
:::note warn
ディスカバリのアイテムプロトタイプではなく、テンプレートのアイテムとして登録します。本アイテムをマスターアイテムとして依存アイテムの作成を行います。
項目名 | 値 |
---|---|
名前 | master.if |
タイプ | SNMPエージェント |
キー | master.if |
データ型 | テキスト |
SNMP OID | discovery[{#STATUS},ifOperStatus,{#IFIN},ifHCInOctets,{#IFOUT},ifHCOutOctets,{#IFNAME},ifName] |
監視間隔 | 3m |
Zabbixでは、SNMP結果をマスターアイテムとする場合、結果をJSON形式のテキストとして処理されるっぽい。
{#STATUS}などのラベルはJSONファイル内の項目名としても用いられます。
名前 | パラメータ | |
---|---|---|
置換 | {#STATUS} | status |
置換 | {#IFIN} | in |
置換 | {#IFOUT} | out |
置換 | {#IFNAME} | name |
{#STATUS}などの項目名では、文字列とマクロの混同を防止すること。及び、JSON Path指定時にシンプルな記載とするため「置換」を行っています。
ディスカバリルール の作成
やりたいことを整理する
- 設定されているI/Fに対し、以下の情報を取得する
- インタフェースのステータス(Up/Downなど)
- Inboundのトラフィック(Mbps)取得
- Outboundのトラフィック(Mbps)取得
- 取得対象のインタフェースは?
- ハードウェアとして実装されているインタフェース
- TRKポートとして有効化されているインタフェース
- 取得対象外のインタフェースとは?
- 設定していないTRKポート
- VLANなどの仮想インタフェース
ディスカバリの計画
- ifTypeにて、Ethernet又はTRK(LAG)インタフェースを対象とする
- 上記タイプのうち、ifOperStatusにて「notPresent」は除外する
参考情報
https://www.iana.org/assignments/ianaiftype-mib/ianaiftype-mib
ifType(IANAifType)定義抜粋
ethernetCsmacd(6), -- for all ethernet-like interfaces,
-- regardless of speed, as per RFC3635
ieee8023adLag (161), -- IEEE 802.3ad Link Aggregate
実際に作成してみる
項目名 | 値 |
---|---|
名前 | net.if.discovery |
タイプ | SNMPエージェント |
キー | net.if.discovery |
SNMP OID | discovery[{#ALIAS},ifAlias,{#NAME},ifName,{#STATUS},ifOperStatus,{#TYPE},ifType] |
監視間隔 | 6h |
本項目は、ディスカバリ及び各種プロトタイプで使用したい値を収集します。
実際の監視で用いるSNMP OIDは、前述のマスターアイテムとなります。
ラベルマクロ | 条件 | 正規表現 |
---|---|---|
{#STATUS} | 一致する | ^[^6]$ |
{#TYPE} | 一致する | ^(6|161)$ |
アイテムのプロトタイプの作成
項目名 | 値 |
---|---|
名前 | Interface {#NAME}({#ALIAS}):in |
タイプ | 依存アイテム |
キー | net.if.in[{#SNMPINDEX}] |
データ型 | 数値(浮動小数) |
マスターアイテム | InstantOn1830: master.if |
単位 | Mbps |
{#NAME}や{#ALIAS}は、ディスカバリルールのSNMP OIDで定義したマクロとなり、各種プロトタイプでの利用可能です。
{#SNMPINDEX} は、暗黙で定義されるマクロとなり、キーではユーザ定義したマクロは利用不可のようです。
以上。