Go to main content
Oracle® VM Server for SPARC 3.4 管理信息库用户指南

退出打印视图

更新时间: 2016 年 5 月
 
 

如何发送陷阱

  1. 配置陷阱。

    编辑 /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
示例 4  发送 SNMP v1v2c 陷阱

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

trapcommunity public
trapsink localhost
trap2sink localhost