LoginSignup
7
7

More than 5 years have passed since last update.

snmpd の設定方法

Last updated at Posted at 2015-05-25

CentOS 6.x でSNMPによる監視を有効にするため、SNMPデーモンを設定するやり方。
ぜったい忘れるのでメモ。

snmpdのインストール

[root@localhost~]# yum install net-snmp

snmpdの設定

詳しくはサンプル設定ファイルまたはマニュアル参照で。

/etc/snmpd/snmpd.conf
com2sec notConfigUser  default       public
group   notConfigGroup v1           notConfigUser
group   notConfigGroup v2c           notConfigUser
view    systemview    included   .1.3.6.1.2.1.1
view    systemview    included   .1.3.6.1.2.1.25.1.1
access  notConfigGroup ""      any       noauth    exact  systemview none none

# サーバの設置場所
syslocation somewhere
# 管理者の連絡先
syscontact Jun SAITO <jun.saito@example.com>
dontLogTCPWrappersConnects yes
# Hinemos 使うときは以下を追加
view    systemview    included   .1.3.6.1

161/udp を開ける

開いてなければ設定する。
以下はプライベートネットワークからの通信を全許可する場合。

[root@localhost~]# iptables -I INPUT 3 -s 192.168.0.0/24 -j ACCEPT

ちなみにコマンドで設定すると再起動時に揮発するので、iptables-saveコマンドでダンプとっとくべき。

TCP Wrapper の設定

/etc/hosts.allow を忘れずに設定しておく。

/etc/hosts.allow
snmpd: 192.168.0.0/255.255.255.0

確認

プライベートネットワーク 192.168.0.0/24 の別のホストから以下のコマンドで確認。
IPアドレスは適宜変更。

[unicast@hinemos ~]$ snmpwalk -v 2c -c public 192.168.0.123
7
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
7