没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
国内最专业的网络分析论坛----http://www.netexpert.cn icefired@netexpert.cn
如何使用 SNPM 来监控 Linux 服务器
作 者: icefired (icefired@netexpert.cn)
2005-9-16
[Keywords] SNMP, Linux, Orion NPM, MRTG, Net-SNMP
[Ojects] Using SNMP to monitor a Linux server
[准 备]
1. Net-SNMP 5.1.2 或 UCD-SNMP 4.2.3
下载:
http://www.net-snmp.org/download.html
2. A Linux Server: Redhat Linux 7/8/9,RHEL 3/4 或其他 Linux 发行版。
3. SNMP Tool: Solarwinds toolset V8.2 或 Orion Network Performance Monitor V7.8,
其他支持 SNMP 监控的工具如 HP OpenView, IBM NetView, SNMPC V7 均可以。
[步 骤]
1. 安装 Net-SNMP 或 UCD-SNMP. (三种方法)
1.1 安装 Linux 系统时自动安装
安装 Linux 系统的时候选择 UCD-SNMP 和 SNMP-Utility 两个安装包就
可以了。
1.2 使用 RPM 包来安装,这里以 Redhat 9 为例来说明。
先检查有无安装旧的版本: rpm –q ucd-snmp
全新安装:
#rpm –ivh net-snmp-5.1.2-1.rh9.i386.rpm
#rpm –ivh net-snmp-devel-5.1.2-1.rh9.i386.rpm
1.3 使用原代码来安装
#wget
http://mesh.dl.sourceforge.net/sourceforge/net-snmp/net-snmp-5.1.3.1.tar.gz
#tar –xzvf net-snmp-5.1.3.1.tar.gz
#cd net-snmp-5.1.3.1
#./configure
# make & make install
如果没什么问题则顺利完成安装,Linux 的安装和命令使用不在本文讨
论范围,请大家查询相关手册。
2. 配置 SNMP
2.1 设置 SNMPD 服务自动启动
# setup
然后勾选上 services -> snmpd
启动 snmpd 进程
1
国内最专业的网络分析论坛----http://www.netexpert.cn icefired@netexpert.cn
#service snmpd start
2.2 检查一下 snmpd 进程是否运行正常
# ps –ef | grep snmpd
2.3 配置/etc/snmp/snmpd.conf
好了,按照前面的步骤我们已经顺利的安装好 SNMP 服务了,如果使
用默认的 snmpd.conf 文件,我们将只能够看到系统信息,而不能对系统
资源进行监测。
下面是一份 net-snmp 自带的 snmpd.conf 文件:
##################---Begin---################################
####################
# snmpd.conf:
# An example configuration file for configuring the ucd-snmp snmpd agent.
#
#########################################################
#
# This file is intended to only be as a starting point. Many more
# configuration directives exist than are mentioned in this file. For
# full details, see the snmpd.conf(5) manual page.
#
# All lines beginning with a '#' are comments and are intended for you
# to read. All other lines are configuration commands for the agent.
2
国内最专业的网络分析论坛----http://www.netexpert.cn icefired@netexpert.cn
#########################################################
# Access Control
#########################################################
# As shipped, the snmpd demon will only respond to queries on the
# system mib group until this file is replaced or modified for
# security purposes. Examples are shown below about how to increase the
# level of access.
# By far, the most common question I get about the agent is "why won't
# it work?", when really it should be "how do I configure the agent to
# allow me to access it?"
#
# By default, the agent responds to the "public" community for read
# only access, if run out of the box without any configuration file in
# place. The following examples show you other ways of configuring
# the agent so that you can change the community names, and give
# yourself write access to the mib tree as well.
#
# For more information, read the FAQ as well as the snmpd.conf(5)
# manual page.
####
# First, map the community name "public" into a "security name"
# sec.name source community
com2sec notConfigUser default public
####
# Second, map the security name into a group name:
# groupName securityModel securityName
group notConfigGroup v1 notConfigUser
group notConfigGroup v2c notConfigUser
####
# Third, create a view for us to let the group have rights to:
# Make at least snmpwalk -v 1 localhost -c public system fast again.
# name incl/excl subtree mask(optional)
view systemview included .1.3.6.1.2.1.1
view systemview included .1.3.6.1.2.1.25.1.1
####
3
国内最专业的网络分析论坛----http://www.netexpert.cn icefired@netexpert.cn
# Finally, grant the group read-only access to the systemview view.
# group context sec.model sec.level prefix read write notif
access notConfigGroup "" any noauth exact systemview none none
# -----------------------------------------------------------------------------
# Here is a commented out example configuration that allows less
# restrictive access.
# YOU SHOULD CHANGE THE "COMMUNITY" TOKEN BELOW TO A NEW KEYWORD ONLY
# KNOWN AT YOUR SITE. YOU *MUST* CHANGE THE NETWORK TOKEN BELOW TO
# SOMETHING REFLECTING YOUR LOCAL NETWORK ADDRESS SPACE.
## sec.name source community
#com2sec local localhost COMMUNITY
#com2sec mynetwork NETWORK/24 COMMUNITY
## group.name sec.model sec.name
#group MyRWGroup any local
#group MyROGroup any mynetwork
#
#group MyRWGroup any otherv3user
#...
## incl/excl subtree mask
#view all included .1 80
## -or just the mib2 tree-
#view mib2 included .iso.org.dod.internet.mgmt.mib-2 fc
## context sec.model sec.level prefix read write notif
#access MyROGroup "" any noauth 0 all none none
#access MyRWGroup "" any noauth 0 all all all
#########################################################
# System contact information
#
# It is also possible to set the sysContact and sysLocation system
# variables through the snmpd.conf file:
4
国内最专业的网络分析论坛----http://www.netexpert.cn icefired@netexpert.cn
syslocation Unknown (edit /etc/snmp/snmpd.conf)
syscontact Root <root@localhost> (configure /etc/snmp/snmp.local.conf)
# Example output of snmpwalk:
# % snmpwalk -v 1 localhost -c public system
# system.sysDescr.0 = "SunOS name sun4c"
# system.sysObjectID.0 = OID: enterprises.ucdavis.ucdSnmpAgent.sunos4
# system.sysUpTime.0 = Timeticks: (595637548) 68 days, 22:32:55
# system.sysContact.0 = "Me <me@somewhere.org>"
# system.sysName.0 = "name"
# system.sysLocation.0 = "Right here, right now."
# system.sysServices.0 = 72
# -----------------------------------------------------------------------------
#########################################################
# Process checks.
#
# The following are examples of how to use the agent to check for
# processes running on the host. The syntax looks something like:
#
# proc NAME [MAX=0] [MIN=0]
#
# NAME: the name of the process to check for. It must match
# exactly (ie, http will not find httpd processes).
# MAX: the maximum number allowed to be running. Defaults to 0.
# MIN: the minimum number to be running. Defaults to 0.
#
# Examples (commented out by default):
#
# Make sure mountd is running
#proc mountd
# Make sure there are no more than 4 ntalkds running, but 0 is ok too.
#proc ntalkd 4
# Make sure at least one sendmail, but less than or equal to 10 are running.
#proc sendmail 10 1
# A snmpwalk of the process mib tree would look something like this:
5
剩余30页未读,继续阅读
资源评论
- tianfei12013-08-30资料很好,希望能有帮助
- mxwang42013-07-31很有用的资料,很好。
hugoddjing
- 粉丝: 0
- 资源: 4
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功