免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 7942 | 回复: 4
打印 上一主题 下一主题

求教如何使用snmptrap命令将告警信息发给其他主机? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2011-02-11 06:41 |只看该作者 |倒序浏览
cmd1a:/ ROOT # uname -a
SunOS cmd1a 5.9 Generic_118558-08 sun4u sparc SUNW,Netra-4

cmd1a:/ ROOT # /usr/local/bin/snmptrap -V
UCD-snmp version: 4.2.5

本机IP是: 172.26.164.4  远程主机IP是:172.26.164.71

从本机只能通过ssh 172.26.164.71 来登陆远程Solairs主机.

想通过如下命令将一段告警信息发给远程主机如何发送?  我尝试用如下命令,但是不对, 请教高人.

cmd1a:/ ROOT # /usr/local/bin/snmptrap -v 2c -c public -h 172.26.164.71 -m "warning information"
Usage: snmptrap [options...] <hostname> {<community>} [<trap parameters> ...]

UCD-snmp version: 4.2.5
  -h            this help message.
  -H            Display configuration file directives understood.
  -V            display version number.
  -v 1|2c|3     specifies snmp version to use.
SNMP Version 1 or 2c specific
  -c <c>        set the community name (v1 or v2c)
SNMP Version 3 specific
  -Z <B,T>      set the destination engine boots/time for v3 requests.
  -e <E>        security engine ID (e.g., 800000020109840301).
  -E <E>        context engine ID (e.g., 800000020109840301).
  -n <N>        context name (e.g., bridge1).
  -u <U>        security name (e.g., bert).
  -l <L>        security level (noAuthNoPriv|authNoPriv|authPriv).
  -a <A>        authentication protocol (MD5|SHA)
  -A <P>        authentication protocol pass phrase.
  -x <X>        privacy protocol (DES).
  -X <P>        privacy protocol pass phrase
General communication options
  -p <P>        use port P instead of the default port.
  -T <LAYER>    use LAYER for the network layer.
                        (UDP or TCP).
  -t <T>        set the request timeout to T.
  -r <R>        set the number of retries to R.
Debugging
  -d            dump input/output packets.
  -D all | <TOKEN[,TOKEN,...]>  turn on debugging output for the specified TOKENs.
General options
  -m all | <MIBS>       use MIBS list instead of the default mib list.
  -M <MIBDIRS>  use MIBDIRS as the location to look for mibs.
  -P <MIBOPTS>  Toggle various defaults controlling mib parsing:
                  MIBOPTS values:
                      u: allow the usage of underlines in mib symbols.
                      c: disallow the usage of "--" to terminate comments.
                      d: save the descriptions of the mib objects.
                      e: Disable mib errors of MIB symbols conflicts
                      w: Enable mib warnings of MIB symbols conflicts
                      W: Enable detailed warnings of MIB symbols conflicts
                      R: Replace MIB symbols from latest module
  -O <OUTOPTS>  Toggle various defaults controlling output display:
                  OUTOPTS values:
                      n: Print oids numerically.
                      e: Print enums numerically.
                      E: Escape quotes in string indices.
                      X: Extended index format
                      b: Dont break oid indexes down.
                      q: Quick print for easier parsing.
                      f: Print full oids on output.
                      s: Print only last symbolic element of oid.
                      S: Print MIB module-id plus last element.
                      t: Print timeticks unparsed as numeric integers.
                      v: Print Print values only (not OID = value).
                      T: Print human-readable text along with hex strings.
  -I <INOPTS>   Toggle various defaults controlling input parsing:
                  INOPTS values:
                      R: Do random access to oid labels.
                      r: Don't check values for range/type legality.
                      b: Do best/regex matching to find a MIB node.
  -C <APPOPTS>  Toggle various application specific behaviour:
                  APPOPTS values:
                      i: Send an snmp INFORM instead of an snmp TRAP.
  -v 1 trap parameters:
         enterprise-oid agent trap-type specific-type uptime [ var ]...
  or
  -v 2 trap parameters:
         uptime trapoid [ var ] ...

论坛徽章:
0
2 [报告]
发表于 2011-02-15 09:31 |只看该作者
有高手能帮忙看看这个问题吗? 解决不了啊

论坛徽章:
10
处女座
日期:2015-01-22 16:08:50技术图书徽章
日期:2018-09-13 11:25:52技术图书徽章
日期:2018-09-13 11:25:45技术图书徽章
日期:2018-09-13 11:25:37技术图书徽章
日期:2018-09-13 11:25:29黑曼巴
日期:2018-06-04 09:03:192017金鸡报晓
日期:2017-01-10 15:19:56极客徽章
日期:2016-12-07 14:03:402015年迎新春徽章
日期:2015-03-04 09:50:28技术图书徽章
日期:2018-09-13 11:26:01
3 [报告]
发表于 2011-02-15 20:11 |只看该作者
远程主机不需要配置吗?

论坛徽章:
0
4 [报告]
发表于 2011-02-16 11:26 |只看该作者
不需要,本机这么多年来,每天都有大量的snmp 消息发送到那台远程主机上,然后远程主机通过HP-OV显示出来.

论坛徽章:
0
5 [报告]
发表于 2011-08-16 16:39 |只看该作者
您参考下这个命令格式
sudo snmptrap -IR -v 2c -c public ubuntu-laptop.local '' netSnmp.99999 netSnmp.99999.1 s "Hello, World"
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP