今天简单写了个ruby下的trap发包,如下:
require \'snmp\'
include SNMP
varbind = VarBind.new("1.3.6.1.2.1.1.5.0", OctetString.new("System Name"))
SNMP::Manager.open(:Host => "192.168.203.166",:Version => :SNMPv1) do |snmp|
snmp.trap_v1(
"enterprises.9",
"192.168.203.25",
:enterpriseSpecific,
42,
12345,
varbind)
end