MENU

【Zabbix 5.0】YAMAHA 製品のトラップ監視をできる環境構築

お疲れ様です。satimoです

今回はヤマハ製品のトラップ監視をZabbixで行う方法についてつらつらと書いていきます。

Zabbixの環境構築やトラップ監視する為の環境構築が済んでいない方はこちらをご参考ください。

あわせて読みたい
【Zabbix】Zabbix Server 5.0のインストール(CentOS 7/MariaDB/NGINX) 【はじめに】 CentOS 7をminimalインストールした環境にZabbix 5.0 をインストールからコンソール画面が表示されるまでの手順を書きました。 利用するパッケージとして...
あわせて読みたい
【Zabbix】Zabbix でSNMPトラップ監視できる環境を構築 【はじめに】 Zabbixサーバでトラップ受信できる環境の構築を行っていきます。 Zabbix5.0がインストールことを前提に話を進めていますのでインストールが終わっていない...

ZabbixでSNMP監視を行う為の大まかな流れはこちらになります。

  • snmptt.confの作成
  • トラップ監視用のテンプレート作成
目次

snmptt.confの作成

Zabbixでベンダー(今回はヤマハ)が提供しているトラップを受信して監視を行う為には、提供されているMIBファイルをZabbixが理解できるように変換してあげる必要があります。

初めにヤマハの更新ページからMIBファイルのダウンロードを行います。

ヤマハ製品のプライベートMIBダウンロード先

http://www.rtpro.yamaha.co.jp/RT/docs/mib/index.php

『yamaha-private-mib.tar.gz』をクリックしファイルのダウンロードを行います。

ダウンロードしたファイルををトラップ受信させるサーバへ保存します。

今回は「/usr/share/snmp/mibs/」の下に『yamaha』ディレクトリを作成しその中に保存しています。

保存後、ダウンロードしたファイルを展開しテキストファイルが保存されることを確認します。

# cd /usr/share/snmp/mibs
# mkdir yamaha
# cd yamaha
# tar xzvf yamaha-private-mib.tar.gz
# ls
yamaha-private-mib.tar.gz     yamaha-sw-errdisable.mib.txt
yamaha-product.mib.txt        yamaha-sw-firmware.mib.txt
yamaha-rt-firmware.mib.txt    yamaha-sw-hardware.mib.txt
yamaha-rt-hardware.mib.txt    yamaha-sw-l2ms.mib.txt
yamaha-rt-interfaces.mib.txt  yamaha-sw-loop-detect.mib.txt
yamaha-rt-ip.mib.txt          yamaha-sw-power-ethernet.mib.txt
yamaha-rt-switch.mib.txt      yamaha-sw-rmon.mib.txt
yamaha-rt.mib.txt             yamaha-sw-termmon.mib.txt
yamaha-smi.mib.txt            yamaha-sw.mib.txt
yamaha-sw-bridge.mib.txt

保存したディレクトリのファイルを読み込んであげるおまじないを行います。

# vi /etc/snmp/snmp.conf
mibdirs /usr/share/snmp/mibs:/usr/share/snmp/mibs/yamaha
mibs all

snmpttconvertmibコマンドでダウンロードしたテキストファイルを変換します。

# snmpttconvertmib --in /usr/share/snmp/vendors-mibs/yamaha-product.mib.txt --out snmptt_yamaha-product.conf
# snmpttconvertmib --in /usr/share/snmp/vendors-mibs/yamaha-rt.mib.txt --out snmptt_yamaha-rt.conf
# snmpttconvertmib --in /usr/share/snmp/vendors-mibs/yamaha-rt-firmware.mib.txt --out snmptt_yamaha-rt-firmware.conf
# snmpttconvertmib --in /usr/share/snmp/vendors-mibs/yamaha-rt-hardware.mib.txt --out yamaha-rt-hardware.conf
# snmpttconvertmib --in /usr/share/snmp/vendors-mibs/yamaha-rt-interfaces.mib.txt --out snmptt_yamaha-rt-interfaces.conf
# snmpttconvertmib --in /usr/share/snmp/vendors-mibs/yamaha-rt-ip.mib.txt --out snmptt_yamaha-rt-ip.conf
# snmpttconvertmib --in /usr/share/snmp/vendors-mibs/yamaha-rt-switch.mib.txt --out snmptt_yamaha-rt-switch.conf
# snmpttconvertmib --in /usr/share/snmp/vendors-mibs/yamaha-smi.mib.txt --out snmptt_yamaha-smi.conf
# snmpttconvertmib --in /usr/share/snmp/vendors-mibs/yamaha-sw.mib.txt --out snmptt_yamaha-sw.conf
# snmpttconvertmib --in /usr/share/snmp/vendors-mibs/yamaha-sw-bridge.mib.txt --out snmptt_yamaha-sw-bridge.conf
# snmpttconvertmib --in /usr/share/snmp/vendors-mibs/yamaha-sw-errdisable.mib.txt --out snmptt_yamaha-sw-errdisable.conf
# snmpttconvertmib --in /usr/share/snmp/vendors-mibs/yamaha-sw-firmware.mib.txt --out snmptt_yamaha-sw-firmware.conf
# snmpttconvertmib --in /usr/share/snmp/vendors-mibs/yamaha-sw-hardware.mib.txt --out snmptt_yamaha-sw-hardware.conf
# snmpttconvertmib --in /usr/share/snmp/vendors-mibs/yamaha-sw-l2ms.mib.txt --out snmptt_yamaha-sw-l2ms.conf
# snmpttconvertmib --in /usr/share/snmp/vendors-mibs/yamaha-sw-loop-detect.mib.txt --out snmptt_yamaha-sw-loop-detect.conf
# snmpttconvertmib --in /usr/share/snmp/vendors-mibs/yamaha-sw-power-ethernet.mib.txt --out snmptt_yamaha-sw-power-ethernet.conf
# snmpttconvertmib --in /usr/share/snmp/vendors-mibs/yamaha-sw-rmon.mib.txt --out snmptt_yamaha-sw-rmon.conf
# snmpttconvertmib --in /usr/share/snmp/vendors-mibs/yamaha-sw-termmon.mib.txt --out snmptt_yamaha-sw-termmon.conf

変換したconfファイルを1つのファイルにまとめてあげます。

# cat *.conf >snmptt_yamaha.conf.org

最後の仕上げで、zabbixがわかるおまじないを行います。

# sed -e "s/^FORMAT\s/FORMAT ZBXTRAP \$aA /g" snmptt_yamaha.conf.org > snmptt_yamaha.conf

EVENT~

FORMAT~

で1つになります。中身を見ていくと重複しているものが結構あるようなので重複分を削除したものがこちらになります。

(エクセルで加工しました💦)

EVENT yrfLoginTrap .1.3.6.1.4.1.1182.2.2.0.1 "Status Events" Normal
FORMAT ZBXTRAP $aA This trap indicates that the login status is changed. $*
EVENT yrIfIsdnStatusChange .1.3.6.1.4.1.1182.2.3.0.1 "Status Events" Normal
FORMAT ZBXTRAP $aA This trap signifies that an ISDN status of index/bch is changed. $*
EVENT yrIfPpLinkDown .1.3.6.1.4.1.1182.2.3.0.2 "Status Events" Normal
FORMAT ZBXTRAP $aA This trap signifies that a PP interface is down. $*
EVENT yrIfPpLinkUp .1.3.6.1.4.1.1182.2.3.0.3 "Status Events" Normal
FORMAT ZBXTRAP $aA This trap signifies that a PP interface is up. $*
EVENT yrIfPpUtilTrap .1.3.6.1.4.1.1182.2.3.0.4 "Status Events" Normal
FORMAT ZBXTRAP $aA This trap signifies that the change of the $*
EVENT yrIfTunnelLinkDown .1.3.6.1.4.1.1182.2.3.0.5 "Status Events" Normal
FORMAT ZBXTRAP $aA This trap signifies that a TUNNEL interface is down. $*
EVENT yrIfTunnelLinkUp .1.3.6.1.4.1.1182.2.3.0.6 "Status Events" Normal
FORMAT ZBXTRAP $aA This trap signifies that a TUNNEL interface is up. $*
EVENT yrIfPpAnonymousLinkDownWithUsername .1.3.6.1.4.1.1182.2.3.0.7 "Status Events" Normal
FORMAT ZBXTRAP $aA This trap signifies that a PP Anonymous interface is down with connected username. $*
EVENT yrIfPpAnonymousLinkUpWithUsername .1.3.6.1.4.1.1182.2.3.0.8 "Status Events" Normal
FORMAT ZBXTRAP $aA This trap signifies that a PP Anonymous interface is up with connected username. $*
EVENT yrIfMobileStatusTrap .1.3.6.1.4.1.1182.2.3.0.9 "Status Events" Normal
FORMAT ZBXTRAP $aA This trap signifies that a number of antenna of signal strength $*
EVENT yrIfWwanModStatTrp .1.3.6.1.4.1.1182.2.3.0.10 "Status Events" Normal
FORMAT ZBXTRAP $aA This trap signifies that a number of antenna of signal strength $*
EVENT yrIpKeepaliveDown .1.3.6.1.4.1.1182.2.4.0.1 "Status Events" Normal
FORMAT ZBXTRAP $aA This trap signifies that a IP keepalive status is down. $*
EVENT yrIpKeepaliveUp .1.3.6.1.4.1.1182.2.4.0.2 "Status Events" Normal
FORMAT ZBXTRAP $aA This trap signifies that a IP keepalive status is up. $*
EVENT yrIpHeartBeat .1.3.6.1.4.1.1182.2.4.0.3 "Status Events" Normal
FORMAT ZBXTRAP $aA This trap signifies that heartbeat packet has not received for a given period. $*
EVENT yrIpHeartbeat2 .1.3.6.1.4.1.1182.2.4.0.4 "Status Events" Normal
FORMAT ZBXTRAP $aA This trap signifies that heartbeat2 packet has not received for a given period. $*
EVENT yrSwFindSwitch .1.3.6.1.4.1.1182.2.5.0.1 "Status Events" Normal
FORMAT ZBXTRAP $aA This trap signifies that a controlled switch is detected. $*
EVENT yrSwDetectDown .1.3.6.1.4.1.1182.2.5.0.2 "Status Events" Normal
FORMAT ZBXTRAP $aA This trap signifies that a controlled switch is lost. $*
EVENT yrSwFanLock .1.3.6.1.4.1.1182.2.5.0.3 "Status Events" Normal
FORMAT ZBXTRAP $aA This trap signifies that a controlled switch's fan lock. $*
EVENT yrSwOverSupply .1.3.6.1.4.1.1182.2.5.0.4 "Status Events" Normal
FORMAT ZBXTRAP $aA This trap signifies that a controlled switch's PoE over supply. $*
EVENT yrSwOverTemp .1.3.6.1.4.1.1182.2.5.0.5 "Status Events" Normal
FORMAT ZBXTRAP $aA This trap signifies that a controlled switch's over temperature. $*
EVENT yrSwPowerUnitFailure .1.3.6.1.4.1.1182.2.5.0.6 "Status Events" Normal
FORMAT ZBXTRAP $aA This trap signifies that a controlled switch's Power unit failure. $*
EVENT yrSwLoopDetectPort .1.3.6.1.4.1.1182.2.5.3.0.1 "Status Events" Normal
FORMAT ZBXTRAP $aA This trap signifies that a controlled switch's port is loop-detect. $*
EVENT yrSwPoESupplyPort .1.3.6.1.4.1.1182.2.5.4.0.1 "Status Events" Normal
FORMAT ZBXTRAP $aA This trap signifies that a controlled switch's port is PoE supply. $*
EVENT yrSwPoETerminatePort .1.3.6.1.4.1.1182.2.5.4.0.2 "Status Events" Normal
FORMAT ZBXTRAP $aA This trap signifies that a controlled switch's port is PoE terminate. $*
EVENT ysedTrap .1.3.6.1.4.1.1182.3.6.0.1 "Status Events" Normal
FORMAT ZBXTRAP $aA This trap signifies that the status of each port  $*
EVENT yshMemoryUtilTrap .1.3.6.1.4.1.1182.3.1.0.1 "Status Events" Normal
FORMAT ZBXTRAP $aA This trap indicates that the value of the variable $*
EVENT yshCpuUtilTrap .1.3.6.1.4.1.1182.3.1.0.2 "Status Events" Normal
FORMAT ZBXTRAP $aA This trap indicates that the CPU utilization is over $*
EVENT yshSystemAlarmTrap .1.3.6.1.4.1.1182.3.1.0.3 "Status Events" Normal
FORMAT ZBXTRAP $aA This trap indicates that the system ALARM LED is on. $*
EVENT yshMultiCpuUtilTrap .1.3.6.1.4.1.1182.3.1.0.4 "Status Events" Normal
FORMAT ZBXTRAP $aA This trap indicates that the multi CPU utilization is over $*
EVENT yshTemperatureStatusNormalTrap .1.3.6.1.4.1.1182.3.1.0.5 "Status Events" Normal
FORMAT ZBXTRAP $aA This trap indicates that the temperature value has changed to Normal status. $*
EVENT yshTemperatureStatusWarningTrap .1.3.6.1.4.1.1182.3.1.0.6 "Status Events" Normal
FORMAT ZBXTRAP $aA This trap indicates that the temperature value has changed to Warning status. $*
EVENT yshTemperatureStatusErrorTrap .1.3.6.1.4.1.1182.3.1.0.7 "Status Events" Normal
FORMAT ZBXTRAP $aA This trap indicates that the temperature value has changed to Error status. $*
EVENT yshFanStoppedTrap .1.3.6.1.4.1.1182.3.1.0.8 "Status Events" Normal
FORMAT ZBXTRAP $aA This trap indicates that the fan is stopped. $*
EVENT yshFanSpeedUpTrap .1.3.6.1.4.1.1182.3.1.0.9 "Status Events" Normal
FORMAT ZBXTRAP $aA This trap indicates that the fan speed has increased. $*
EVENT yshFanSpeedDownTrap .1.3.6.1.4.1.1182.3.1.0.10 "Status Events" Normal
FORMAT ZBXTRAP $aA This trap indicates that the fan speed has decreased. $*
EVENT yshVIVoltageErrorTrap .1.3.6.1.4.1.1182.3.1.0.11 "Status Events" Normal
FORMAT ZBXTRAP $aA This trap indicates that the voltage value became error. $*
EVENT yshVICurrentErrorTrap .1.3.6.1.4.1.1182.3.1.0.12 "Status Events" Normal
FORMAT ZBXTRAP $aA This trap indicates that the electric current value became error. $*
EVENT ysl2msFindSlave .1.3.6.1.4.1.1182.3.5.0.1 "Status Events" Normal
FORMAT ZBXTRAP $aA This trap signifies that a controlled switch is detected. $*
EVENT ysl2msDetectDown .1.3.6.1.4.1.1182.3.5.0.2 "Status Events" Normal
FORMAT ZBXTRAP $aA This trap signifies that a controlled switch is lost. $*
EVENT ysl2msFanLock .1.3.6.1.4.1.1182.3.5.0.3 "Status Events" Normal
FORMAT ZBXTRAP $aA This trap signifies that a controlled switch's fan lock. $*
EVENT ysl2msOverSupply .1.3.6.1.4.1.1182.3.5.0.4 "Status Events" Normal
FORMAT ZBXTRAP $aA This trap signifies that a controlled switch's PoE over supply. $*
EVENT ysl2msOverTemp .1.3.6.1.4.1.1182.3.5.0.5 "Status Events" Normal
FORMAT ZBXTRAP $aA This trap signifies that a controlled switch's over temperature. $*
EVENT ysl2msPowerUnitFailure .1.3.6.1.4.1.1182.3.5.0.6 "Status Events" Normal
FORMAT ZBXTRAP $aA This trap signifies that a controlled switch's Power unit failure. $*
EVENT ysl2msLoopDetectPort .1.3.6.1.4.1.1182.3.5.4.0.1 "Status Events" Normal
FORMAT ZBXTRAP $aA This trap signifies that a controlled switch's port is loop-detect. $*
EVENT ysl2msPoESupplyPort .1.3.6.1.4.1.1182.3.5.5.0.1 "Status Events" Normal
FORMAT ZBXTRAP $aA This trap signifies that a controlled switch's port is PoE supply. $*
EVENT ysl2msPoETerminatePort .1.3.6.1.4.1.1182.3.5.5.0.2 "Status Events" Normal
FORMAT ZBXTRAP $aA This trap signifies that a controlled switch's port is PoE terminate. $*
EVENT ysldPortDetectLoopTrap .1.3.6.1.4.1.1182.3.11.0.1 "Status Events" Normal
FORMAT ZBXTRAP $aA This trap signifies that loop detected. $*
EVENT ysldPortResolveLoopTrap .1.3.6.1.4.1.1182.3.11.0.2 "Status Events" Normal
FORMAT ZBXTRAP $aA This trap signifies that loop resolved. $*
EVENT yspeSupplyPortTrap .1.3.6.1.4.1.1182.3.10.0.1 "Status Events" Normal
FORMAT ZBXTRAP $aA This trap signifies that PoE power supply start to the PD. $*
EVENT yspeTerminatePortTrap .1.3.6.1.4.1.1182.3.10.0.2 "Status Events" Normal
FORMAT ZBXTRAP $aA This trap signifies that PoE power supply stop to the PD. $*
EVENT yspeGuardBandStateTrap .1.3.6.1.4.1.1182.3.10.0.3 "Status Events" Normal
FORMAT ZBXTRAP $aA This trap signifies that guard band status change. $*
EVENT yspePortErrorTrap .1.3.6.1.4.1.1182.3.10.0.4 "Status Events" Normal
FORMAT ZBXTRAP $aA This trap signifies that PoE port error. $*
EVENT yspeUnitFailureTrap .1.3.6.1.4.1.1182.3.10.0.5 "Status Events" Normal
FORMAT ZBXTRAP $aA This trap signifies that PoE unit power failure. $*
EVENT yrhMemoryUtilTrap .1.3.6.1.4.1.1182.2.1.0.1 "Status Events" Normal
FORMAT ZBXTRAP $aA This trap indicates that the value of the variable $*
EVENT yrhCpuUtilTrap .1.3.6.1.4.1.1182.2.1.0.2 "Status Events" Normal
FORMAT ZBXTRAP $aA This trap indicates that the CPU utilization is over $*
EVENT yrhSystemAlarmTrap .1.3.6.1.4.1.1182.2.1.0.3 "Status Events" Normal
FORMAT ZBXTRAP $aA This trap indicates that the system ALARM LED is on. $*
EVENT yrhMultiCpuUtilTrap .1.3.6.1.4.1.1182.2.1.0.4 "Status Events" Normal
FORMAT ZBXTRAP $aA This trap indicates that the multi CPU utilization is over $*
EVENT yrhCpuThresholdOver .1.3.6.1.4.1.1182.2.1.0.5 "Status Events" Normal
FORMAT ZBXTRAP $aA This trap indicates that the CPU utilization was over $*
EVENT yrhCpuThresholdUnder .1.3.6.1.4.1.1182.2.1.0.6 "Status Events" Normal
FORMAT ZBXTRAP $aA This trap indicates that the CPU utilization was under $*
EVENT yrhMemoryThresholdOver .1.3.6.1.4.1.1182.2.1.0.7 "Status Events" Normal
FORMAT ZBXTRAP $aA This trap indicates that the MEMORY utilization was over $*
EVENT yrhMemoryThresholdUnder .1.3.6.1.4.1.1182.2.1.0.8 "Status Events" Normal
FORMAT ZBXTRAP $aA This trap indicates that the MEMORY utilization was under $*

作成したsnmptt_yamaha.confファイルを移動してあげます。

# mv snmptt_yamaha.conf /etc/snmp/
# cd /etc/snmp/

# ls
snmpd.conf      snmptt.conf.bak  snmptt_base.conf
snmptrapd.conf  snmptt.ini       snmptt_yamaha.conf

snmptt.iniファイルの編集を行います。

ファイルの一番下に[TrapFiles]の項目があるのでそちらに今回作成したファイルを記載してあげます。

# vi snmptt.ini

・・・

[TrapFiles]
# A list of snmptt.conf files (this is NOT the snmptrapd.conf file).  The COMPLE
TE path
# and filename.  Ex: '/etc/snmp/snmptt.conf'
snmptt_conf_files = <<END
/etc/snmp/snmptt_base.conf
/etc/snmp/snmptt_yamaha.conf
END

ファイルの編集後snmpttサービスの再起動を行います。

# systemctl restart snmptt
EVENT general .1.3.6.1.6.3.1.1.5.1 "coldStart" Normal
FORMAT ZBXTRAP $aA $ar $*
EVENT general .1.3.6.1.6.3.1.1.5.2 "warmStart" Normal
FORMAT ZBXTRAP $aA $ar $*
EVENT general .1.3.6.1.6.3.1.1.5.3 "linkDown" Critical
FORMAT ZBXTRAP $aA $ar $*
EVENT general .1.3.6.1.6.3.1.1.5.4 "linkUp" Normal
FORMAT ZBXTRAP $aA $ar $*

これでZabbixサーバでの作業はおわりです。

動作確認も含めてトラップ受信させてみます。

# snmptrap -v 2c -c public 127.0.0.1  '' .1.3.6.1.4.1.1182.2.4.0.2
# tail /var/log/snmptt/snmptt.log

2020/08/21 00:09:21 .1.3.6.1.4.1.1182.2.4.0.2 Normal "Status Events" 127.0.0.1 - ZBXTRAP 127.0.0.1 This trap signifies that a IP keepalive status is up.

正常にトラップ受信できた場合は/var/log/snmptt/snmptt.logファイルにログが記載されています。

上のように記載されていればOKです

次回はZabbixのコンソールでテンプレートの作成を行っていきます。

よかったらシェアしてね!
  • URLをコピーしました!
  • URLをコピーしました!

コメント

コメントする

CAPTCHA


目次