Raspberry Pi Buster に SNMP 関係を導入
Raspbian Buster 環境へ Zabbix 5.4 をしたので次は SNMP 関係の検証のため snmp パッケージをインストールしてみます。
環境
- Raspberry Pi 3 model B+
- Raspbian Buster 版
snmp パッケージのインストール
SNMP を使用した監視の検証ができるように、必要なパッケージをインストールします。
まずは、 snmp パッケージをインストールしていきます。
pi@raspberrypi:~ $ sudo apt install snmp
Zabbix のドキュメントに snmp エージェントとやり取りで、「テキストベースを使いたいなら MIB ファイルをインストールしていね」とあるので、 snmp-mibs-downloader パッケージをインストールします。
pi@raspberrypi:~ $ sudo apt install snmp-mibs-downloader
「download-mibs」コマンドを実行し、 MIB ファイルをインストールします。
pi@raspberrypi:~ $ sudo download-mibs
snmp の設定
ダウンロードした MIB ファイルをロードして使用するように、「/etc/snmp/snmp.conf」ファイルを次のように編集します。
pi@raspberrypi:~ $ sudo vi /etc/snmp/snmp.conf
全ての MIB を読み込めるように次のよう編集します。
【変更前】
# As the snmp packages come without MIB files due to license reasons, loading
# of MIBs is disabled by default. If you added the MIBs you can reenable
# loading them by commenting out the following line.
mibs :
【変更後】
# As the snmp packages come without MIB files due to license reasons, loading
# of MIBs is disabled by default. If you added the MIBs you can reenable
# loading them by commenting out the following line.
# mibs :
mibs ALL
以上で設定は完了です。
動作確認
「snmpwalk」コマンドを実行して、 MIB 情報を取得できることを確認します。
pi@raspberrypi:~ $ snmpwalk -v 2c -c public 取得したい機器のIPアドレス
取得できたら設定は完了です。