Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1693942
  • 博文数量: 163
  • 博客积分: 10591
  • 博客等级: 上将
  • 技术积分: 1980
  • 用 户 组: 普通用户
  • 注册时间: 2006-08-08 18:17
文章分类

全部博文(163)

文章存档

2018年(1)

2012年(1)

2011年(47)

2010年(58)

2009年(21)

2008年(35)

分类: LINUX

2011-05-31 09:33:17


           SNMP 服务启用方法
1 服务器启动SNMP服务方法
1.1 HPUX 启用 SNMP
HPUX 默认是开启 snmp 服务的,但是出于安全考虑,我们需要修改 snmp服务的社区(community)名称,步骤如下:
打开 /etc/snmpd.conf 文件,将 get-community-name 的值修改成 hrwang,如下所示:
vi /etc/snmpd.conf
get-community-name:     hrwang    
#set-community-name:    # enter community name
#contact:               # enter contact person for agent
#location:              # enter location of agent
#max-trap-dest:         # enter max no. of trap-dest entries to be maintained.
#trap-dest:             # enter trap destination
保存对此文件修改。
然后重起 snmp 服务,使用如下命令,停止服务
/sbin/init.d/SnmpMaster stop
/sbin/init.d/ SnmpHpunix stop
然后使用如下命令启动服务:
/sbin/init.d/SnmpMaster start
/sbin/init.d/SnmpHpunix start
检查 snmp 服务重启是否成功,使用如下命令:
ps –ef|grep snmp
root  1833     1  0  Dec 17  ?         0:00 /usr/lbin/cmsnmpd
root 11320     1  0 10:28:08 ?         0:00 /usr/sbin/snmpdm
使用以上命令查到有 cmsnmpd 和snmpdm进程表示 snmp进程重启成功。
1.2 SUSE启用SNMP
注:在 SUSE Linux Enterprise Server(版本 9)中,SNMP 代理配置文件位于 /etc/snmpd.conf。在 SUSE Linux Enterprise Server(版本 10)中,SNMP 代理配置文件位于 /etc/snmp/snmpd.conf。以下以 SUSE Linux 10 为例:
vi /etc/snmp/snmpd.conf
查找以下行:
 rocommunity public 127.0.0.1
编辑修改上行中 IP 地址,使用192.168.1.33替换上面的 127.0.0.1。并且将public 替换成 hrwang。 编辑后,新行应为:
rocommunity hrwang 192.168.1.33
其余不做改动,保存设置,退出 vi.
以上配置文件修改后均需重启snmpd守护进程方能生效。
/etc/init.d/snmpd restart
将 snmpd 服务写到系统自动重启列表中:
chkconfig snmpd on
 
1.3 AIX启用SNMP
1) 修改/etc/snmpd.conf
修改public 为 hrwang (为自定义 Community) ,如下行所示:
community       hrwang
2) 修改 snmp 服务版本
aix默认使用的是v3,现将其降到v1,可以获得更多的信息。使用如下命令修改 snmp 版本:
/usr/sbin/snmpv3_ssw -1 
 通过这个命令可以改变SNMP的版本(参数为数字1)
3) 再按如下信息刷新snmp
 # stopsrc -s snmpmibd
 # stopsrc -s aixmibd
 # stopsrc -s hostmibd
 # stopsrc -s snmpd
 # startsrc -s snmpd
 # startsrc -s hostmibd
 # startsrc -s aixmibd
 # startsrc -s snmpmibd
配置好后就可以监控AIX系统的CPU使用率, 分区空间, 内存空间等系统性能.
ps -ef|grep snmp
root 1073174   86206   0 16:48:45      -  0:00 /usr/sbin/snmpd
4)如果上步完成后,无法获取相应的oid信息,可以如下做一次:
#stopsrc -s dpid2
# stopsrc -s snmpmibd
 # stopsrc -s aixmibd
 # stopsrc -s hostmibd
 # stopsrc -s snmpd
 # startsrc -s snmpd
 # startsrc -s hostmibd
 # startsrc -s aixmibd
 # startsrc -s snmpmibd
#startsrc -s dpid2
 
1.4 sco unix 重启snmp
默认SCO 7是启动snmp服务的,这个可以从/etc/rc2.d/下有S73snmp文件可以得知。
如果要重启snmp服务,可以这样
#/etc/rc2.d/S73snmp stop
#/etc/rc2.d/S73snmp start
 
1.5 Centos5.4 开启 snmp
1)vi /etc/snmp/snmpd
第一步,更改入下位置的cebpublic,如下:
# First, map the community name "public" into a "security name"
#       sec.name  source          community
com2sec notConfigUser  default       cebpublic
第二步,将如下位置的systemview改为all,如下:
####
# 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
access  notConfigGroup ""      any       noauth    exact  all  none none

第三步,将如两行下行前面的注释去掉,如下:
##           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

第四步,将下面这行前的注释去掉,如下
#access  notConfigGroup ""      any       noauth    exact  roview rwview none
access notConfigGroup   ""    any     noauth     exact   mib2   none   none
2)启动snmpd,并设置开机自动启
#service snmpd restart
#chkconfig --level 345 snmpd on

3)更改防火强,vi /etc/sysconfig/iptables ,添加如下两行:
###############################################################################
# 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]
#
[root@HP-BL685-126 ~]# cat /etc/sysconfig/iptables
# Firewall configuration written by system-config-securitylevel
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:RH-Firewall-1-INPUT - [0:0]
-A INPUT -j RH-Firewall-1-INPUT
-A FORWARD -j RH-Firewall-1-INPUT
-A RH-Firewall-1-INPUT -i lo -j ACCEPT
-A RH-Firewall-1-INPUT -p icmp --icmp-type any -j ACCEPT
-A RH-Firewall-1-INPUT -p 50 -j ACCEPT
-A RH-Firewall-1-INPUT -p 51 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp --dport 5353 -d 224.0.0.251 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp -m udp --dport 631 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m tcp --dport 631 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 20 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 21 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp -m udp --dport 161 -j ACCEPT                              #这行用于开通snmp
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 5666 -j ACCEPT        #这行用于开通nagios客户端nrpe
-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited
COMMIT
保存好,重启防火墙。#service iptables restart。 这样就打开了监控的端口
 
2 WEBLOGIC启用SNMP服务方法
根据我行系统安装配置规范,WEBLOGIC 启用SNMP 服务时,设定的 SNMP UDP服务端口为:16188; SNMP 社区(密码)名为: hrwang;并把 SNMP 的版本改成 V2.
2.1 WEGLOGIC 8.1 启用 SNMP
WEBLOGIC8.1 启用 SNMP服务时,步骤与 WEBLOGIC 10 启用SNMP 的步骤基本一样,只是 WEBLOGIC8.1 启用SNMP服务时,不需要增加目标服务器的内容(下节中的7-9步内容),并且配置完 SNMP服务后需要重启 WEBLOGIC,这样更改才能生效。其余可参见下一节的 “WEBLOGIC10 启用SNMP 服务”内容。主要的配置界面如下图所示:
SNMP Port: 16188
Community Prefix: hrwang
Trap Version: 2
 
2.2 WEBLOGIC 9.2启用SNMP
WEBLOGIC9.2 启用 SNMP服务时,在配置完 SNMP服务后需要重启 WEBLOGIC,这样更改才能生效,具体步骤如下:
1.在管理控制台的"域结构"中,展开"诊断",然后选择"SNMP Agent"。
2. 按照如下配置信息,配置 snmp 参数值,配置图如下所示:
SNMP Port: 16188
Community Prefix: hrwang
Trap Version: 2

3.单击“保存”。
4.激活这些更改。
5. 重起 weblogic 服务生效。
6.检查Weblogic 的 snmp 是否已经成功启用,主要可以在 weblogic 安装机上,使用“netstat –an|grep 16188 ”命令检查 16188 端口是否已经打开。
2.3 WEBLOGIC 10启用SNMP
Weblogic要启用 SNMP 服务,请执行下列操作:
1.在管理控制台的"域结构"中,展开"诊断",然后选择"SNMP"。
2.在"SNMP 代理概要"页中,选择"域作用域 SNMP 代理"表中默认已经创建的 SNMP 代理,此代理名称跟 weblogic 的域名一致。
3.在"SNMP 代理概要"页的"域 SNMP 代理"表中,单击 SNMP 代理的名称。
4.在"SNMP 代理: 配置: 常规"页上,对默认值做如下更改:
   a.选中"已启用"框。
   b.在"SNMP UDP 端口"字段中,输入希望 SNMP 代理监听来自 SNMP 管理器的请求的端口号。按照本行规定,Weblogic SNMP UDP端口应配置为:16188;主要AgentX 端口应该配置为:11705
   c.选中“已启用基于社区的访问”框。 在“社区前缀”字段中,输入 SNMP 管理器在将请求发送到 WebLogic SNMP 代理时必须指定的 SNMP 社区(密码)。根据本行规定,社区名为:hrwang,陷阱版本为:V2,如下图所示:
 
5.单击“保存”。
6.要激活这些更改,请在管理控制台的更改中心中单击“激活更改”SNMP 代理服务就启用。
7.检查Weblogic 的 snmp 是否已经成功启用,主要可以在 weblogic 安装机上,使用“netstat –an|grep 16188 ”命令检查 16188 端口是否已经打开。
 
3 TEXUDO 启用SNMP 服务方法
3.1 HP Openview与Tuxedo集成监控
目前xx使用了HP Openview8通过SNMP协议监控Tuxedo应用的状态。同时,HP Openview使用它自身的Openview SNMP agent for Tuxedo。因此,在Tuxedo应用端,我们只需要启动TMSYSEVT服务即可。
启动TMSYSEVT的方法为:
1, 修改ubb配置文件,增加Tuxedo自己的Server,名称为 TMSYSEVT;
示范代码为:
*GROUPS
"SNMPGRP1" LMID="doccs" GRPNO=30
"SNMPGRP2" LMID="doccs" GRPNO=40
*SERVERS
TMSYSEVT SRVGRP= SNMPGRP1 SRVID=100 RESTART=Y GRACE=900 MAXGEN=5   CLOPT="-A --"
TMSYSEVT SRVGRP= SNMPGRP2 SRVID=100 RESTART=Y GRACE=900 MAXGEN=5   CLOPT="-A -- -S -p 90"

2, 修改环境变量,增加下面的内容
FLDTBLDIR32=$TUXDIR/udataobj; export FLDTBLDIR32
FIELDTBLS32=evt_mib; export FIELDTBLS32
3, Tmloadcf重新编译配置文件;
4, Tmboot重新启动Tuxedo应用程序。

下面是TMSYSEVT的说明:
TMSYSEVT(5)
Name
TMSYSEVT—System event reporting process
Synopsis
TMSYSEVT SRVGRP="identifier" SRVID="number"   [CLOPT="[-A] [servopts options]   [-- [-S] [-p poll-seconds] [-f control-file]]"]
Description
TMSYSEVT is a BEA Tuxedo system provided server that processes event reports related to system failure or potential failure conditions. The event reports are filtered, and may trigger one or more notification actions.
Filtering and notification rules are stored in control-file, which defaults to ${APPDIR}/tmsysevt.dat. Control file syntax is defined in EVENT_MIB(5); specifically, the attributes of the classes in EVENT_MIB can be set to activate subscriptions under the full range of notification rules.
It is possible to boot one or more secondary TMSYSEVT processes for increased availability. Additional servers must be booted with the -S command-line option, which indicates a "secondary" server.
When the EVENT_MIB(5) configuration is updated, the primary TMSYSEVT server writes to its control file. Secondary servers poll the primary server for changes and update their local control file if necessary. The polling interval is controlled by the -p option, and is 30 seconds by default.
Interoperability
TMSYSEVT must run on a BEA Tuxedo release 6.0 or later machine.
Notices
To migrate the primary TMSYSEVT server to another machine, the system administrator must provide a current copy of control-file. Each secondary TMSYSEVT server automatically maintains a recent copy.
TMSYSEVT needs access to the system's FML32 field table definitions for system events. FLDTBLDIR32 should include $TUXDIR/udataobj, and FIELDTBLS32 should include evt_mib. These environment variables may be set in the machine's or server's environment file.
Example
*SERVERS TMSYSEVT SRVGRP=ADMIN1 SRVID=100 RESTART=Y GRACE=900 MAXGEN=5   CLOPT="-A --" TMSYSEVT SRVGRP=ADMIN2 SRVID=100 RESTART=Y GRACE=900 MAXGEN=5   CLOPT="-A -- -S -p 90"

3.2 Guardian的安装和使用
1, Guardian安装在10.1.88.117的F:\bea\ BEAGuardian目录中。注意:Guardian与被管理的WebLogic Domain之间需要保持t3协议互通。
位于该目录下的license.bea文件,目前有效期到2007年8月15日,到期后,可以继续申请。
另外,Guardian运行需要jdk1.5的环境,安装好JDK1.5后,在guardian.ini文件的开始,增加下面两行:
-vm
F:\bea\Java\jdk1.5.0_04\bin\java.exe
即文件类似于:
-vm
F:\bea\Java\jdk1.5.0_04\bin\java.exe
-vmargs
-Xms64m
-Xmx1024m
-XX:MaxPermSize=128m
-Dcom.sun.xml.namespace.QName.useCompatibleSerialVersionUID=1.0
-Dsun.lang.ClassLoader.allowArraySyntax=true
2, 启动文件为: f:\bea\Guardian.exe(快捷方式)或f:\bea\BEAGuardian\Guardian.exe
3, 在Guardian中增加需要管理的WebLogic Domain。加入方法是点击菜单“文件->新建->域”,系统给出下面的对话框,输入weblogic Domain Admin Server的关键参数。可以反复执行加入多个WebLogic域进行管理。注意:当WebLogic Domain中有很多的Server时,域加入的时间会比较长。

3.3 几个常用网址

 

4, 点击Toolbar中的“评估”,系统将自动进行评估,并生成评估报告,位于该域目录树的“评估历史记录”中。每评估一次,生成一个评估报告,报告内容大概如下图。报告将发现的问题根据严重级别划分为“严重”,“警告”和“一般”等。
 
阅读(28198) | 评论(0) | 转发(1) |
1

上一篇:SNMPTT介绍

下一篇:check_logfiles使用手册

给主人留下些什么吧!~~