编辑 /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
必须使用 pfedit 命令编辑 /etc/net-snmp/snmp/snmpd.conf 文件。
以下示例显示授权发送陷阱的用户 (public) 以及应如何处理传入陷阱 (log,execute,net)。请参见 snmptrapd.conf(4) 和 snmptrapd.conf(5) 手册页。
authCommunity log,execute,net public
此示例向同一主机上运行的 SNMP 陷阱守护进程发送 v1 和 v2c 陷阱。使用以下指令更新 /etc/net-snmp/snmp/snmpd.conf 文件:
trapcommunity public trapsink localhost trap2sink localhost