Linux Install Memo

サーバー管理者によるLinux関連ソフトのインストールメモ

Home » □snmpd

□snmpd

参考URL:
http://net-snmp.sourceforge.net/

snmpd はいままで ucd-snmp を使っていたが、どうも変わりに net-snmp と
いうのができたらしい。ucd の方は 4.2.6 で止ってます。

tar xvzf package/net-snmp-5.4.2.1.tar.gz
cd net-snmp-5.4.2.1/
./configure –prefix=/usr
make
umask 022
make install

./configure すると色々と聞いてきますが、前に ucd-snmp がインストール
されていると、設定をコピーしてくれるみたいです。

ちなみに perl 用の SNMP モジュールもあるようです。(INSTALL 参照)

で、細かい設定は snmpconf というコマンドでできるようになってるらしい。
-i オプションをつけて設定をすると、終了時に自動的にファイルをそのディ
レクトリに生成してくれるらしい。つけないと、snmpconf を実行したときに
いたディレクトリにそのファイルができる

例:

/usr/bin/snmpconf -i

とすると、snmpd.conf をつくった場合には、

/usr/share/snmp/snmpd.conf

ができる。

とりあえずよく判らないので、適当に設定してみる

> # /usr/bin/snmpconf -i
>
> I can create the following types of configuration files for you.
> Select the file type you wish to create:
> (you can create more than one as you run this program)
>
> 1: snmpd.conf
> 2: snmptrapd.conf
> 3: snmp.conf
>
> Other options: quit
>
> Select File: 1
>
> The configuration information which can be put into snmpd.conf is divided
> into sections. Select a configuration section for snmpd.conf
> that you wish to create:
>
> 1: System Information Setup
> 2: Access Control Setup
> 3: Trap Destinations
> 4: Monitor Various Aspects of the Running Host
> 5: Extending the Agent
> 6: Agent Operating Mode
>
> Other options: finished
>
> Select section: 1
>
> Section: System Information Setup
> Description:
> This section defines some of the information reported in
> the “system” mib group in the mibII tree.
>
> Select from:
>
> 1: The [typically physical] location of the system.
> 2: The contact information for the administrator
> 3: The proper value for the sysServices object.
>
> Other options: finished, list
>
> Select section: 1
>
> Configuring: syslocation
> Description:
> The [typically physical] location of the system.
> Note that setting this value here means that when trying to
> perform an snmp SET operation to the sysLocation.0 variable will make
> the agent return the “notWritable” error code. IE, including
> this token in the snmpd.conf file will disable write access to
> the variable.
> arguments: location_string
>
> The location of the system: FWNET TOKYO JAPAN
>
> Finished Output: syslocation “FWNET TOKYO JAPAN”
>
> Section: System Information Setup
> Description:
> This section defines some of the information reported in
> the “system” mib group in the mibII tree.
>
> Select from:
>
> 1: The [typically physical] location of the system.
> 2: The contact information for the administrator
> 3: The proper value for the sysServices object.
>
> Other options: finished, list
>
> Select section: 2
>
> Configuring: syscontact
> Description:
> The contact information for the administrator
> Note that setting this value here means that when trying to
> perform an snmp SET operation to the sysContact.0 variable will make
> the agent return the “notWritable” error code. IE, including
> this token in the snmpd.conf file will disable write access to
> the variable.
> arguments: contact_string
>
> The contact information: root@fwnet.jp
>
> Finished Output: syscontact root@fwnet.jp
>
> Section: System Information Setup
> Description:
> This section defines some of the information reported in
> the “system” mib group in the mibII tree.
>
> Select from:
>
> 1: The [typically physical] location of the system.
> 2: The contact information for the administrator
> 3: The proper value for the sysServices object.
>
> Other options: finished, list
>
> Select section: finished
>
> The configuration information which can be put into snmpd.conf is divided
> into sections. Select a configuration section for snmpd.conf
> that you wish to create:
>
> 1: System Information Setup
> 2: Access Control Setup
> 3: Trap Destinations
> 4: Monitor Various Aspects of the Running Host
> 5: Extending the Agent
> 6: Agent Operating Mode
>
> Other options: finished
>
> Select section: 2
>
> Section: Access Control Setup
> Description:
> This section defines who is allowed to talk to your running
> snmp agent.
>
> Select from:
>
> 1: a SNMPv3 read-write user
> 2: a SNMPv3 read-only user
> 3: a SNMPv1/SNMPv2c read-only access community name
> 4: a SNMPv1/SNMPv2c read-write access community name
>
> Other options: finished, list
>
> Select section: 3
>
> Configuring: rocommunity
> Description:
>?? a SNMPv1/SNMPv2c read-only access community name
>???? arguments: community [default|hostname|network/bits] [oid]
>
> The community name to add read-only access for: public
> The hostname or network address to accept this community name from [RETURN for all]:
> The OID that this community should be restricted to [RETURN for no-restriction]:
>
> Finished Output: rocommunity public
>
> Section: Access Control Setup
> Description:
> This section defines who is allowed to talk to your running
> snmp agent.
>
> Select from:
>
> 1: a SNMPv3 read-write user
> 2: a SNMPv3 read-only user
> 3: a SNMPv1/SNMPv2c read-only access community name
> 4: a SNMPv1/SNMPv2c read-write access community name
>
> Other options: finished, list
>
> Select section: finished
>
> The configuration information which can be put into snmpd.conf is divided
> into sections. Select a configuration section for snmpd.conf
> that you wish to create:
>
> 1: System Information Setup
> 2: Access Control Setup
> 3: Trap Destinations
> 4: Monitor Various Aspects of the Running Host
> 5: Extending the Agent
> 6: Agent Operating Mode
>
> Other options: finished
>
> Select section: finished
>
> I can create the following types of configuration files for you.
> Select the file type you wish to create:
> (you can create more than one as you run this program)
>
> 1: snmpd.conf
> 2: snmptrapd.conf
> 3: snmp.conf
>
> Other options: quit
>
> Select File: quit
>
>
> The following files were created:
>
> snmpd.conf installed in /usr/local/share/snmp
> #

という感じでやっていくらしい。
結局読むだけをどこからでも全員に許可した(つもり)

で、できたファイルの中身を見てみると(要点だけ抜き出す)、

> # syslocation: The [typically physical] location of the system.
> # Note that setting this value here means that when trying to
> # perform an snmp SET operation to the sysLocation.0 variable will make
> # the agent return the “notWritable” error code. IE, including
> # this token in the snmpd.conf file will disable write access to
> # the variable.
> # arguments: location_string
>
> syslocation “FWNET TOKYO JAPAN”

> # syscontact: The contact information for the administrator
> # Note that setting this value here means that when trying to
> # perform an snmp SET operation to the sysContact.0 variable will make
> # the agent return the “notWritable” error code. IE, including
> # this token in the snmpd.conf file will disable write access to
> # the variable.
> # arguments: contact_string
>
> syscontact root@fwnet.jp

> # rocommunity: a SNMPv1/SNMPv2c read-only access community name
> # arguments: community [default|hostname|network/bits] [oid]
>
> rocommunity public

となってますね。

で、/etc/rc.d/rc.inet2 に下記のように追加して起動時に読み込ませるようにする。

> # SNMP server
> SERV=”$SERV snmpd”

とりあえず動作なら「/usr/sbin/snmpd」だけでいいので実行させて
実際に確認してみます。確認は snmpwalk ですが、ucd-snmp のときと変わ
ってて、SNMP-Ver3まで対応していますので、ちょっとオプションが
増えます。

/usr/bin/snmpwalk -c public -v1 localhost

とすると動作していれば情報を見る事ができるはず。試してみましょう。
出来なかったらちゃんと起動していない可能性が高いので、確認すること。

SNMPはよくわかりませんので、SNMPの専門家に任せます。(^^;

Name of author

Name: admin

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です