论坛首页 入门技术论坛

关于ԚƤɏς΄֐???Ç뇳?ĵؖ?ΞЧ?? - sendto(2)的问题,ruby snmp

浏览 1609 次
该帖已经被评为新手帖
作者 正文
   发表时间:2007-12-05  
运行程序出错结果如下:
Errno::EADDRNOTAVAIL in AdminController#index4 
ԚƤɏς΄֐???Ç뇳?ĵؖ?ΞЧ?? - sendto(2)
RAILS_ROOT: ./script/../config/..

Application Trace | Framework Trace | Full Trace 
D:/InstantRails/ruby/lib/ruby/site_ruby/1.8/snmp/manager.rb:34:in `send'
D:/InstantRails/ruby/lib/ruby/site_ruby/1.8/snmp/manager.rb:34:in `send'
D:/InstantRails/ruby/lib/ruby/site_ruby/1.8/snmp/manager.rb:478:in `send_request'
D:/InstantRails/ruby/lib/ruby/site_ruby/1.8/snmp/manager.rb:462:in `try_request'
D:/InstantRails/ruby/lib/ruby/site_ruby/1.8/snmp/manager.rb:461:in `times'
D:/InstantRails/ruby/lib/ruby/site_ruby/1.8/snmp/manager.rb:461:in `try_request'
D:/InstantRails/ruby/lib/ruby/site_ruby/1.8/snmp/manager.rb:205:in `get'
D:/InstantRails/ruby/lib/ruby/site_ruby/1.8/snmp/manager.rb:226:in `get_value'
C:/Documents and Settings/Administrator/My Documents/NetBeansProjects/RubyGoOn/RubyGoOn/app/models/modem.rb:63:in `getmac'
C:/Documents and Settings/Administrator/My Documents/NetBeansProjects/RubyGoOn/RubyGoOn/app/models/modem.rb:62:in `getmac'
C:/Documents and Settings/Administrator/My Documents/NetBeansProjects/RubyGoOn/RubyGoOn/app/controllers/admin_controller.rb:20:in `index4'
C:/Documents and Settings/Administrator/My Documents/NetBeansProjects/RubyGoOn/RubyGoOn/app/controllers/admin_controller.rb:20:in `collect!'
C:/Documents and Settings/Administrator/My Documents/NetBeansProjects/RubyGoOn/RubyGoOn/app/controllers/admin_controller.rb:20:in `index4'


其实是因为snmp的manager在执行对modem的snmpget的时候出错了。
因为在读取modem信息的时候,应该注意有三种情况:
    1,cmts头端里面根本没有这个Modem的注册信息,就是说Modem可能从来没注册过,或者已经给注销了。只要注册过的modem都会留有一个ID。
    2,modem注册过,也就是合法的,但是不在线。
    3,modem在线。


对于以上三种情况,第一种会导致返回错误信息,也许是noinstarnt啊之类的,需要进行判定,否则会出错。
D:/InstantRails/ruby/lib/ruby/site_ruby/1.8/snmp/manager.rb:34:in `send'

针对第一第二种,可以采用直接给记录赋值(全部都是‘0’)然后return,跳出方法,进行下一个modem的snmpget。
论坛首页 入门技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics