2009年9月12日土曜日

bsnmpd

bsnmpdツールのインストール。



net-mgmt/bsnmptoolsをインストールすることで、bsnmpwalkを使えるようになる。

/etc/snmpd.configの編集


方針としては、「trapやwriteを無効」「MIBは可能な限り有効」。

@@ -6,18 +6,18 @@
#
# Set some common variables
#
-location := "Room 200"
-contact := "sysmeister@example.com"
+location := "mobile"
+contact := "秘密"
system := 1 # FreeBSD
-traphost := localhost
-trapport := 162
+# traphost := localhost
+# trapport := 162

# Change this!
-read := "public"
+read := "秘密"
# Uncomment begemotSnmpdCommunityString.0.2 below that sets the community
# string to enable write access.
-write := "geheim"
-trap := "mytrap"
+# write := "geheim"
+# trap := "mytrap"

#
# Configuration
@@ -50,9 +50,9 @@
begemotSnmpdLocalPortType."/var/run/snmpd.sock" = 4

# send traps to the traphost
-begemotTrapSinkStatus.[$(traphost)].$(trapport) = 4
-begemotTrapSinkVersion.[$(traphost)].$(trapport) = 2
-begemotTrapSinkComm.[$(traphost)].$(trapport) = $(trap)
+# begemotTrapSinkStatus.[$(traphost)].$(trapport) = 4
+# begemotTrapSinkVersion.[$(traphost)].$(trapport) = 2
+# begemotTrapSinkComm.[$(traphost)].$(trapport) = $(trap)

sysContact = $(contact)
sysLocation = $(location)
@@ -74,10 +74,10 @@
#
# Netgraph module
#
-#begemotSnmpdModulePath."netgraph" = "/usr/lib/snmp_netgraph.so"
-#
-#%netgraph
-#begemotNgControlNodeName = "snmpd"
+begemotSnmpdModulePath."netgraph" = "/usr/lib/snmp_netgraph.so"
+
+%netgraph
+begemotNgControlNodeName = "snmpd"

#
# pf(4) module
@@ -88,10 +88,10 @@
# Host resources module
# This requires the mibII module.
#
-#begemotSnmpdModulePath."hostres" = "/usr/lib/snmp_hostres.so"
+begemotSnmpdModulePath."hostres" = "/usr/lib/snmp_hostres.so"

#
# Bridge module
# This requires the mibII module.
#
-#begemotSnmpdModulePath."bridge" = "/usr/lib/snmp_bridge.so"
+begemotSnmpdModulePath."bridge" = "/usr/lib/snmp_bridge.so"


bsnmpdの起動。


/etc/rc.confに「bsnmpd_enable="YES"」の行を追加して、

# sudo /etc/rc.d/bsnmpd start

を実行することにより、起動。

bsnmpwalkでの動作確認


OIDを文字列にする為に、「-i」オプションでdefファイルを設定。
絶対パスで指定するのが基本みたいだけど、デフォルトでは
「/usr/share/snmp/defs」を検索してくれるので、ファイル名のみを「-i」で
複数する。

bsnmpwalk -i atm_freebsd.def -i hostres_tree.def -i pf_tree.def -i atm_tree.def -i mibII_tree.def -i tree.def -i bridge_tree.def -i netgraph_tree.def -s ”秘密”@localhost


現在有効なOIDの行数を確認すると、9056行だった。

hrProcessorLoad(1.3.6.1.2.1.25.3.3.1.2)


どうもhrProcessorLoadは上手く取得出来ない様子。
(参考) http://www.mail-archive.com/freebsd-stable@freebsd.org/msg100522.html

ここから特に話は進んでない様子。

0 件のコメント: