右鍵選單
溢泰的旅遊休閒相簿⊙ - ⊙WaterGoGoGo旅遊趣⊙ - ⊙FB:WaterGoGoGoTravel
 T J C T Mobile
 Water Blog - 天空部落- 痞客邦- 札西德樂假期
 E-Mail:留言給我
   
  【 氣象局一週天氣預報 】
★★ CentOS 安裝 SNMP Service ★★ 回教學首頁
◎.CentOS 5.x 安裝 NET-SNMP ◎.

NET-SNMP 是一種開放原始碼的簡單網路管理協議(Simple Network Management Protocol)軟體。
NET-SNMP支持SNMP v1, SNMP v2c 與 SNMP v3,並可以使用 IPV4 及 IPV6 。
基於(BSD及BSD like)許可。

【CentOS 5.x 安裝】

步驟一:

防火牆請打開
161:udp, 162:udp

檢查 SNMP 套件是否安裝
[root@localhost ~]# -qa | grep net-snmp

利用 yum 安裝 SNMP 套件
[root@localhost ~]# yum -y install net-snmp net-snmp-utils

調整 snmp 設定檔
[root@localhost ~]# vi /etc/snmp/snmpd.conf 

#   sec.name source  community
com2sec local localhost private
com2sec local 127.0.0.1 public
com2sec notConfigUser 10.2.2.0/24 public

####
# Second, map the security names into group names:

#          sec.model sec.name

group notConfigGroup  v1               notConfigUser
group notConfigGroup  v2c             notConfigUser

####
# Third, create a view for us to let the groups have rights to:

#   incl/excl    subtree   mask
view   all included   .1   80

#.iso.org.dod.internet.mgmt.mib-2
view systemview included .1.3.6.1.2.1

#System Uptime
view systemview included .1.3.6.1.2.1.1.3.0

#number of passive TCP connections
view systemview included .1.3.6.1.2.1.6.6.0

#Open TCP connections failures
#view systemview included .1.3.6.1.2.1.6.7.0

#Open TCP connections
view systemview included .1.3.6.1.2.1.6.9.0

#----------- Memory Statistics:
#Total Swap Size
#view systemview included .1.3.6.1.4.1.2021.4.3.0
#Available Swap Space
#view systemview included .1.3.6.1.4.1.2021.4.4.0
#Total RAM in machine
#view systemview included .1.3.6.1.4.1.2021.4.5.0
#Total RAM used
view systemview included .1.3.6.1.4.1.2021.4.6.0
#Total RAM Free
view systemview included .1.3.6.1.4.1.2021.4.11.0
#Total RAM Shared: .1.3.6.1.4.1.2021.4.13.0
#Total RAM Buffered: .1.3.6.1.4.1.2021.4.14.0
#Total Cached Memory: .1.3.6.1.4.1.2021.4.15.0

#----------- Disk Statistics
#Path where the disk is mounted
#view systemview included .1.3.6.1.4.1.2021.9.1.2.1
#Path of the device for the partition
#view systemview included .1.3.6.1.4.1.2021.9.1.3.1
#Total size of the disk/partion (kBytes)
#view systemview included .1.3.6.1.4.1.2021.9.1.6.1
#Available space on the disk
#view systemview included .1.3.6.1.4.1.2021.9.1.7.1
#Used space on the disk
#view systemview included .1.3.6.1.4.1.2021.9.1.8.1
#Percentage of space used on disk
#view systemview included .1.3.6.1.4.1.2021.9.1.9.1
#Percentage of inodes used on disk
#view systemview included .1.3.6.1.4.1.2021.9.1.10.1

#----------- CPU Statistics
#1 minute Load
view systemview included .1.3.6.1.4.1.2021.10.1.3.1
#5 minute Load
#view systemview included .1.3.6.1.4.1.2021.10.1.3.2
#15 minute Load
#view systemview included .1.3.6.1.4.1.2021.10.1.3.3
#percentage of user CPU time:
view systemview included .1.3.6.1.4.1.2021.11.9.0
#percentages of system CPU time
#view systemview included .1.3.6.1.4.1.2021.11.10.0
#percentages of idle CPU time
#view systemview included .1.3.6.1.4.1.2021.11.11.0
#raw user CPU time
#view systemview included .1.3.6.1.4.1.2021.11.50.0
#raw nice cpu time
#view systemview included .1.3.6.1.4.1.2021.11.51.0
#raw system CPU time
#view systemview included .1.3.6.1.4.1.2021.11.52.0
#raw idle cpu time
#view systemview included .1.3.6.1.4.1.2021.11.53.0


####
# Finally, grant the 2 groups access to the 1 view with different
# write permissions:

#   context sec.model sec.level match read write notif
access notConfigGroup "" any noauth exact systemview none none
access local "" any noauth exact all none none

#access MyROGroup "" any noauth 0 all none none
#access MyRWGroup "" any noauth 0 all all all

syslocation CentOS 5.5 at S21 Taipei
syscontact Root <root@localhost>

disk / 10000

啟用 SNMP Service
[root@localhost ~]# service snmpd start

使用 snmpwalk 工具檢查 SNMP Service 是否安裝完成
[root@localhost ~]# snmpwalk -c public -v 1 localhost system

使用 snmptranslate 工具取得 OID 資料
snmptranslate -Tp 1.3.6.1.2.1

SNMP 常用 OID
http://wangchengtai.blog.hexun.com.tw/37652599_d.html

SNMP 常用 Linux OID
http://hi.baidu.com/qu6zhi/blog/item/e2f11ac809391d1a7e3e6f6d.html 

OID 1.3.6.1.2.1 內容表
http://www.alvestrand.no/objectid/1.3.6.1.2.1.html 

SCALAR Objects for linux(OID List)
http://www.mibdepot.com/engine/linux_SCALAR.html 


【CentOS 4.x 安裝】

 

參考來源網址:
http://ihipop.info/wap/index-wap2.php?p=722
http://www.ichiayi.com/wiki/tech/centosinstall
http://www.360doc.com/content/07/0502/20/25127_478593.shtml
 
最後更新: 2011年05月06日