Oracle® VM Server for SPARC 3.2 管理指南

退出打印视图

更新时间: 2015 年 5 月
 
 

使用 Oracle VM Server for SPARC MIB 模块陷阱

Oracle Solaris 11 MIB 与 Oracle Solaris 10 MIB 提供相同的 SNMP 陷阱。但是,net-snmp 版本不同,必须以不同方式对其进行配置。在 Oracle Solaris 10 MIB 中,snmptrapd 接受所有传入通知并自动记录它们。在 Oracle Solaris 11 MIB 中,会对传入通知应用访问控制检查。如果在运行 snmptrapd 时未使用合适的配置文件或等效的访问控制设置,则不会处理此类陷阱。请参见 snmptrapd.conf(4) 和 snmptrapd.conf(5) 手册页。

如何发送陷阱

  1. 配置陷阱。
    • Oracle Solaris 10:

      编辑 /etc/sma/snmp/snmpd.conf 文件,以添加用来定义陷阱、信息版本和目标的指令。

      trapcommunity string --> define community string to be used when sending traps
      trapsink host[community [port]] --> to send v1 traps
      trap2sink host[community [port]] --> to send v2c traps
      informsink host[community [port]] --> to send informs

      有关更多信息,请参见 snmpd.conf(4) 和 snmpd.conf(5) 手册页。

    • Oracle Solaris 11:

      编辑 /etc/net-snmp/snmp/snmpd.conf SNMP 配置文件,以添加用来定义陷阱、信息版本和目标的指令。

      必须使用 pfedit 命令编辑 /etc/net-snmp/snmp/snmpd.conf 文件。

      trapcommunity string --> define community string to be used when sending traps
      trapsink host[community [port]] --> to send v1 traps
      trap2sink host[community [port]] --> to send v2c traps
      informsink host[community [port]] --> to send informs

      有关更多信息,请参见 snmpd.conf(4) 和 snmpd.conf(5) 手册页。

      例如,以下指令将在发送陷阱时使用 public 字符串作为团体字符串,并指示将 v1 陷阱发送到 localhost 目标:

      trapcommunity public
      trapsink localhost
  2. 通过创建或编辑 /usr/etc/snmp/snmptrapd.conf SNMP trapd 配置文件配置访问控制设置。

    必须使用 pfedit 命令编辑 /etc/net-snmp/snmp/snmpd.conf 文件。

    以下示例显示授权发送陷阱的用户 (public) 以及应如何处理传入陷阱 (log,execute,net)。请参见 snmptrapd.conf(4) 和 snmptrapd.conf(5) 手册页。

    authCommunity log,execute,net public
  3. 要接收 SNMP 陷阱消息,请启动 SNMP 陷阱守护进程实用程序 snmptrapd
示例 20-4  发送 SNMP v1v2c 陷阱

此示例向同一主机上运行的 SNMP 陷阱守护进程发送 v1v2c 陷阱。使用以下指令更新 Oracle Solaris 10 /etc/sma/snmp/snmpd.conf 文件或 Oracle Solaris 11 /etc/net-snmp/snmp/snmpd.conf 文件:

trapcommunity public
trapsink localhost
trap2sink localhost

如何接收陷阱

  • 启动 SNMP 陷阱守护进程实用程序。
    • Oracle Solaris 10:

      有关输出格式选项的信息,请参见 snmptrapd(1M) 手册页。

      snmptrapd 实用程序是一种 SNMP 应用程序,可用来接收和记录 SNMP TRAP 消息。例如,下面的 snmptrapd 命令显示创建了一个名为 ldg2 (ldomName = ldg2) 的新域 (ldomTrapDesc = Ldom Created)。

      # /usr/sfw/sbin/snmptrapd -P -F \
      "TRAP from %B on %m/%l/%y at %h:%j:%k Enterprise=%N Type=%w SubType=%q\n
      with Varbinds: %v\nSecurity info:%P\n\n" localhost:162
      TRAP from localhost on 5/18/2007 at 16:30:10 Enterprise=. Type=0 SubType=0
      with Varbinds: DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (47105)
      0:07:51.05 SNMPv2-MIB::snmpTrapOID.0 = OID: SUN-LDOM-MIB::ldomCreate
      SUN-LDOM-MIB::ldomIndexNotif = INTEGER: 3 SUN-LDOM-MIB::ldomName = STRING: ldg2
      SUN-LDOM-MIB::ldomTrapDesc = STRING: Ldom Created
      Security info:TRAP2, SNMP v2c, community public

      请注意,为方便阅读,已将 –F 选项参数字符串分为两行。

    • Oracle Solaris 11:

      有关输出格式选项的信息,请参见 snmptrapd(1M) 手册页。

      snmptrapd 实用程序是一种 SNMP 应用程序,可用来接收和记录 SNMP TRAP 消息。例如,下面的 snmptrapd 命令显示创建了一个名为 ldg2 (ldomName = ldg2) 的新域 (ldomTrapDesc = Ldom Created)。

      # /usr/sbin/snmptrapd -f -Le -F \
      "TRAP from %B on %m/%l/%y at %h:%j:%k Enterprise=%N Type=%w SubType=%q\n
      with Varbinds: %v\nSecurity info:%P\n\n" localhost:162
      NET-SNMP version 5.4.1
      TRAP from localhost on 6/27/2012 at 12:13:48
      Enterprise=SUN-LDOM-MIB::ldomMIBTraps Type=6 SubType=SUN-LDOM-MIB::ldomCreate
      with Varbinds: SUN-LDOM-MIB::ldomIndexNotif = INTEGER: 3
      SUN-LDOM-MIB::ldomName = STRING: ldg2   SUN-LDOM-MIB::ldomTrapDesc = STRING:
      Ldom Created
      Security info:TRAP, SNMP v1, community public

      请注意,为方便阅读,已将 –F 选项参数字符串分为两行。