snmp 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (295) hide show
  1. data/README.rdoc +179 -0
  2. data/Rakefile +34 -39
  3. data/data/ruby/snmp/mibs/ACCOUNTING-CONTROL-MIB.yaml +33 -32
  4. data/data/ruby/snmp/mibs/ADSL-LINE-EXT-MIB.yaml +57 -56
  5. data/data/ruby/snmp/mibs/ADSL-LINE-MIB.yaml +224 -223
  6. data/data/ruby/snmp/mibs/ADSL-TC-MIB.yaml +1 -0
  7. data/data/ruby/snmp/mibs/ADSL2-LINE-MIB.yaml +321 -0
  8. data/data/ruby/snmp/mibs/ADSL2-LINE-TC-MIB.yaml +3 -0
  9. data/data/ruby/snmp/mibs/AGENTX-MIB.yaml +25 -24
  10. data/data/ruby/snmp/mibs/AGGREGATE-MIB.yaml +28 -0
  11. data/data/ruby/snmp/mibs/ALARM-MIB.yaml +77 -0
  12. data/data/ruby/snmp/mibs/APM-MIB.yaml +75 -74
  13. data/data/ruby/snmp/mibs/APPC-MIB.yaml +261 -260
  14. data/data/ruby/snmp/mibs/APPLETALK-MIB.yaml +255 -254
  15. data/data/ruby/snmp/mibs/APPLICATION-MIB.yaml +138 -137
  16. data/data/ruby/snmp/mibs/APPN-DLUR-MIB.yaml +30 -29
  17. data/data/ruby/snmp/mibs/APPN-MIB.yaml +325 -324
  18. data/data/ruby/snmp/mibs/APPN-TRAP-MIB.yaml +10 -9
  19. data/data/ruby/snmp/mibs/APS-MIB.yaml +50 -49
  20. data/data/ruby/snmp/mibs/ARC-MIB.yaml +19 -0
  21. data/data/ruby/snmp/mibs/ATM-ACCOUNTING-INFORMATION-MIB.yaml +22 -21
  22. data/data/ruby/snmp/mibs/ATM-MIB.yaml +94 -93
  23. data/data/ruby/snmp/mibs/ATM-TC-MIB.yaml +12 -11
  24. data/data/ruby/snmp/mibs/ATM2-MIB.yaml +156 -155
  25. data/data/ruby/snmp/mibs/BGP4-MIB.yaml +48 -41
  26. data/data/ruby/snmp/mibs/BLDG-HVAC-MIB.yaml +25 -24
  27. data/data/ruby/snmp/mibs/BRIDGE-MIB.yaml +50 -44
  28. data/data/ruby/snmp/mibs/CHARACTER-MIB.yaml +35 -34
  29. data/data/ruby/snmp/mibs/CIRCUIT-IF-MIB.yaml +13 -12
  30. data/data/ruby/snmp/mibs/CLNS-MIB.yaml +98 -97
  31. data/data/ruby/snmp/mibs/COFFEE-POT-MIB.yaml +8 -7
  32. data/data/ruby/snmp/mibs/COPS-CLIENT-MIB.yaml +38 -37
  33. data/data/ruby/snmp/mibs/DECNET-PHIV-MIB.yaml +209 -208
  34. data/data/ruby/snmp/mibs/DIAL-CONTROL-MIB.yaml +72 -71
  35. data/data/ruby/snmp/mibs/DIFFSERV-CONFIG-MIB.yaml +11 -10
  36. data/data/ruby/snmp/mibs/DIFFSERV-DSCP-TC.yaml +1 -0
  37. data/data/ruby/snmp/mibs/DIFFSERV-MIB.yaml +151 -150
  38. data/data/ruby/snmp/mibs/DIRECTORY-SERVER-MIB.yaml +35 -34
  39. data/data/ruby/snmp/mibs/DISMAN-EVENT-MIB.yaml +95 -94
  40. data/data/ruby/snmp/mibs/DISMAN-EXPRESSION-MIB.yaml +37 -36
  41. data/data/ruby/snmp/mibs/DISMAN-NSLOOKUP-MIB.yaml +15 -14
  42. data/data/ruby/snmp/mibs/DISMAN-PING-MIB.yaml +43 -42
  43. data/data/ruby/snmp/mibs/DISMAN-SCHEDULE-MIB.yaml +22 -21
  44. data/data/ruby/snmp/mibs/DISMAN-SCRIPT-MIB.yaml +64 -63
  45. data/data/ruby/snmp/mibs/DISMAN-TRACEROUTE-MIB.yaml +59 -58
  46. data/data/ruby/snmp/mibs/DLSW-MIB.yaml +172 -171
  47. data/data/ruby/snmp/mibs/DNS-RESOLVER-MIB.yaml +70 -69
  48. data/data/ruby/snmp/mibs/DNS-SERVER-MIB.yaml +57 -56
  49. data/data/ruby/snmp/mibs/DOCS-BPI-MIB.yaml +81 -80
  50. data/data/ruby/snmp/mibs/DOCS-CABLE-DEVICE-MIB.yaml +114 -89
  51. data/data/ruby/snmp/mibs/DOCS-IETF-BPI2-MIB.yaml +187 -0
  52. data/data/ruby/snmp/mibs/DOCS-IETF-CABLE-DEVICE-NOTIFICATION-MIB.yaml +39 -0
  53. data/data/ruby/snmp/mibs/DOCS-IETF-QOS-MIB.yaml +166 -0
  54. data/data/ruby/snmp/mibs/DOCS-IETF-SUBMGT-MIB.yaml +32 -0
  55. data/data/ruby/snmp/mibs/DOCS-IF-MIB.yaml +208 -119
  56. data/data/ruby/snmp/mibs/DOT12-IF-MIB.yaml +21 -20
  57. data/data/ruby/snmp/mibs/DOT3-EPON-MIB.yaml +101 -0
  58. data/data/ruby/snmp/mibs/DOT3-OAM-MIB.yaml +82 -0
  59. data/data/ruby/snmp/mibs/DS0-MIB.yaml +11 -10
  60. data/data/ruby/snmp/mibs/DS0BUNDLE-MIB.yaml +9 -8
  61. data/data/ruby/snmp/mibs/DS1-MIB.yaml +102 -98
  62. data/data/ruby/snmp/mibs/DS3-MIB.yaml +84 -83
  63. data/data/ruby/snmp/mibs/DSA-MIB.yaml +31 -30
  64. data/data/ruby/snmp/mibs/DSMON-MIB.yaml +193 -192
  65. data/data/ruby/snmp/mibs/EBN-MIB.yaml +32 -31
  66. data/data/ruby/snmp/mibs/EFM-CU-MIB.yaml +113 -0
  67. data/data/ruby/snmp/mibs/ENTITY-MIB.yaml +41 -38
  68. data/data/ruby/snmp/mibs/ENTITY-SENSOR-MIB.yaml +8 -7
  69. data/data/ruby/snmp/mibs/ENTITY-STATE-MIB.yaml +18 -0
  70. data/data/ruby/snmp/mibs/ENTITY-STATE-TC-MIB.yaml +3 -0
  71. data/data/ruby/snmp/mibs/ETHER-CHIPSET-MIB.yaml +61 -60
  72. data/data/ruby/snmp/mibs/ETHER-WIS.yaml +16 -15
  73. data/data/ruby/snmp/mibs/EtherLike-MIB.yaml +43 -42
  74. data/data/ruby/snmp/mibs/FC-MGMT-MIB.yaml +154 -0
  75. data/data/ruby/snmp/mibs/FCIP-MGMT-MIB.yaml +68 -0
  76. data/data/ruby/snmp/mibs/FDDI-SMT73-MIB.yaml +107 -106
  77. data/data/ruby/snmp/mibs/FIBRE-CHANNEL-FE-MIB.yaml +100 -99
  78. data/data/ruby/snmp/mibs/FLOW-METER-MIB.yaml +92 -91
  79. data/data/ruby/snmp/mibs/FR-ATM-PVC-SERVICE-IWF-MIB.yaml +33 -32
  80. data/data/ruby/snmp/mibs/FR-MFR-MIB.yaml +38 -37
  81. data/data/ruby/snmp/mibs/FRAME-RELAY-DTE-MIB.yaml +41 -40
  82. data/data/ruby/snmp/mibs/FRNETSERV-MIB.yaml +92 -91
  83. data/data/ruby/snmp/mibs/FRSLD-MIB.yaml +66 -65
  84. data/data/ruby/snmp/mibs/Finisher-MIB.yaml +38 -37
  85. data/data/ruby/snmp/mibs/GMPLS-LABEL-STD-MIB.yaml +27 -0
  86. data/data/ruby/snmp/mibs/GMPLS-LSR-STD-MIB.yaml +20 -0
  87. data/data/ruby/snmp/mibs/GMPLS-TC-STD-MIB.yaml +3 -0
  88. data/data/ruby/snmp/mibs/GMPLS-TE-STD-MIB.yaml +72 -0
  89. data/data/ruby/snmp/mibs/GSMP-MIB.yaml +75 -74
  90. data/data/ruby/snmp/mibs/HC-ALARM-MIB.yaml +26 -25
  91. data/data/ruby/snmp/mibs/HC-PerfHist-TC-MIB.yaml +1 -0
  92. data/data/ruby/snmp/mibs/HC-RMON-MIB.yaml +164 -163
  93. data/data/ruby/snmp/mibs/HCNUM-TC.yaml +1 -0
  94. data/data/ruby/snmp/mibs/HDSL2-SHDSL-LINE-MIB.yaml +117 -112
  95. data/data/ruby/snmp/mibs/HOST-RESOURCES-MIB.yaml +82 -81
  96. data/data/ruby/snmp/mibs/HOST-RESOURCES-TYPES.yaml +40 -39
  97. data/data/ruby/snmp/mibs/HPR-IP-MIB.yaml +17 -16
  98. data/data/ruby/snmp/mibs/HPR-MIB.yaml +64 -63
  99. data/data/ruby/snmp/mibs/IANA-ITU-ALARM-TC-MIB.yaml +3 -0
  100. data/data/ruby/snmp/mibs/IF-CAP-STACK-MIB.yaml +13 -0
  101. data/data/ruby/snmp/mibs/IF-INVERTED-STACK-MIB.yaml +6 -5
  102. data/data/ruby/snmp/mibs/IF-MIB.yaml +57 -56
  103. data/data/ruby/snmp/mibs/IFCP-MGMT-MIB.yaml +65 -0
  104. data/data/ruby/snmp/mibs/IGMP-STD-MIB.yaml +24 -23
  105. data/data/ruby/snmp/mibs/INET-ADDRESS-MIB.yaml +1 -0
  106. data/data/ruby/snmp/mibs/INTEGRATED-SERVICES-GUARANTEED-MIB.yaml +6 -5
  107. data/data/ruby/snmp/mibs/INTEGRATED-SERVICES-MIB.yaml +29 -28
  108. data/data/ruby/snmp/mibs/INTERFACETOPN-MIB.yaml +21 -20
  109. data/data/ruby/snmp/mibs/IP-FORWARD-MIB.yaml +49 -27
  110. data/data/ruby/snmp/mibs/IP-MIB.yaml +243 -40
  111. data/data/ruby/snmp/mibs/IPATM-IPMC-MIB.yaml +179 -178
  112. data/data/ruby/snmp/mibs/IPMCAST-MIB.yaml +105 -0
  113. data/data/ruby/snmp/mibs/IPMROUTE-STD-MIB.yaml +49 -48
  114. data/data/ruby/snmp/mibs/IPOA-MIB.yaml +74 -73
  115. data/data/ruby/snmp/mibs/IPS-AUTH-MIB.yaml +68 -0
  116. data/data/ruby/snmp/mibs/IPSEC-SPD-MIB.yaml +121 -0
  117. data/data/ruby/snmp/mibs/IPV6-FLOW-LABEL-MIB.yaml +1 -0
  118. data/data/ruby/snmp/mibs/IPV6-ICMP-MIB.yaml +27 -26
  119. data/data/ruby/snmp/mibs/IPV6-MIB.yaml +70 -69
  120. data/data/ruby/snmp/mibs/IPV6-MLD-MIB.yaml +18 -17
  121. data/data/ruby/snmp/mibs/IPV6-TCP-MIB.yaml +7 -6
  122. data/data/ruby/snmp/mibs/IPV6-UDP-MIB.yaml +6 -5
  123. data/data/ruby/snmp/mibs/ISCSI-MIB.yaml +199 -0
  124. data/data/ruby/snmp/mibs/ISDN-MIB.yaml +57 -56
  125. data/data/ruby/snmp/mibs/ISIS-MIB.yaml +247 -0
  126. data/data/ruby/snmp/mibs/ISNS-MIB.yaml +179 -0
  127. data/data/ruby/snmp/mibs/ITU-ALARM-MIB.yaml +34 -0
  128. data/data/ruby/snmp/mibs/ITU-ALARM-TC-MIB.yaml +3 -0
  129. data/data/ruby/snmp/mibs/Job-Monitoring-MIB.yaml +26 -27
  130. data/data/ruby/snmp/mibs/L2TP-MIB.yaml +138 -137
  131. data/data/ruby/snmp/mibs/LANGTAG-TC-MIB.yaml +3 -0
  132. data/data/ruby/snmp/mibs/LMP-MIB.yaml +202 -0
  133. data/data/ruby/snmp/mibs/MALLOC-MIB.yaml +66 -65
  134. data/data/ruby/snmp/mibs/MAU-MIB.yaml +55 -95
  135. data/data/ruby/snmp/mibs/MIDCOM-MIB.yaml +83 -0
  136. data/data/ruby/snmp/mibs/MIOX25-MIB.yaml +28 -27
  137. data/data/ruby/snmp/mibs/MIP-MIB.yaml +157 -156
  138. data/data/ruby/snmp/mibs/MOBILEIPV6-MIB.yaml +189 -0
  139. data/data/ruby/snmp/mibs/MPLS-FTN-STD-MIB.yaml +29 -28
  140. data/data/ruby/snmp/mibs/MPLS-L3VPN-STD-MIB.yaml +88 -0
  141. data/data/ruby/snmp/mibs/MPLS-LC-ATM-STD-MIB.yaml +19 -0
  142. data/data/ruby/snmp/mibs/MPLS-LC-FR-STD-MIB.yaml +16 -0
  143. data/data/ruby/snmp/mibs/MPLS-LDP-ATM-STD-MIB.yaml +23 -22
  144. data/data/ruby/snmp/mibs/MPLS-LDP-FRAME-RELAY-STD-MIB.yaml +17 -16
  145. data/data/ruby/snmp/mibs/MPLS-LDP-GENERIC-STD-MIB.yaml +9 -8
  146. data/data/ruby/snmp/mibs/MPLS-LDP-STD-MIB.yaml +103 -102
  147. data/data/ruby/snmp/mibs/MPLS-LSR-STD-MIB.yaml +85 -84
  148. data/data/ruby/snmp/mibs/MPLS-TC-STD-MIB.yaml +1 -0
  149. data/data/ruby/snmp/mibs/MPLS-TE-STD-MIB.yaml +106 -105
  150. data/data/ruby/snmp/mibs/MSDP-MIB.yaml +71 -0
  151. data/data/ruby/snmp/mibs/MTA-MIB.yaml +42 -41
  152. data/data/ruby/snmp/mibs/Modem-MIB.yaml +87 -86
  153. data/data/ruby/snmp/mibs/NAT-MIB.yaml +116 -0
  154. data/data/ruby/snmp/mibs/NETWORK-SERVICES-MIB.yaml +18 -17
  155. data/data/ruby/snmp/mibs/NHRP-MIB.yaml +140 -139
  156. data/data/ruby/snmp/mibs/NOTIFICATION-LOG-MIB.yaml +37 -36
  157. data/data/ruby/snmp/mibs/OPT-IF-MIB.yaml +394 -393
  158. data/data/ruby/snmp/mibs/OSPF-MIB.yaml +192 -123
  159. data/data/ruby/snmp/mibs/OSPF-TRAP-MIB.yaml +24 -19
  160. data/data/ruby/snmp/mibs/P-BRIDGE-MIB.yaml +37 -35
  161. data/data/ruby/snmp/mibs/PARALLEL-MIB.yaml +16 -15
  162. data/data/ruby/snmp/mibs/PIM-MIB.yaml +47 -46
  163. data/data/ruby/snmp/mibs/PIM-STD-MIB.yaml +235 -0
  164. data/data/ruby/snmp/mibs/PINT-MIB.yaml +38 -37
  165. data/data/ruby/snmp/mibs/PKTC-IETF-MTA-MIB.yaml +81 -0
  166. data/data/ruby/snmp/mibs/PKTC-IETF-SIG-MIB.yaml +128 -0
  167. data/data/ruby/snmp/mibs/POLICY-BASED-MANAGEMENT-MIB.yaml +94 -0
  168. data/data/ruby/snmp/mibs/POWER-ETHERNET-MIB.yaml +27 -26
  169. data/data/ruby/snmp/mibs/PPP-BRIDGE-NCP-MIB.yaml +16 -15
  170. data/data/ruby/snmp/mibs/PPP-IP-NCP-MIB.yaml +7 -6
  171. data/data/ruby/snmp/mibs/PPP-LCP-MIB.yaml +33 -32
  172. data/data/ruby/snmp/mibs/PPP-SEC-MIB.yaml +13 -12
  173. data/data/ruby/snmp/mibs/PTOPO-MIB.yaml +29 -28
  174. data/data/ruby/snmp/mibs/PerfHist-TC-MIB.yaml +1 -0
  175. data/data/ruby/snmp/mibs/Printer-MIB.yaml +185 -184
  176. data/data/ruby/snmp/mibs/Q-BRIDGE-MIB.yaml +96 -82
  177. data/data/ruby/snmp/mibs/RADIUS-ACC-CLIENT-MIB.yaml +34 -16
  178. data/data/ruby/snmp/mibs/RADIUS-ACC-SERVER-MIB.yaml +40 -24
  179. data/data/ruby/snmp/mibs/RADIUS-AUTH-CLIENT-MIB.yaml +38 -18
  180. data/data/ruby/snmp/mibs/RADIUS-AUTH-SERVER-MIB.yaml +40 -23
  181. data/data/ruby/snmp/mibs/RADIUS-DYNAUTH-CLIENT-MIB.yaml +44 -0
  182. data/data/ruby/snmp/mibs/RADIUS-DYNAUTH-SERVER-MIB.yaml +40 -0
  183. data/data/ruby/snmp/mibs/RAQMON-MIB.yaml +90 -0
  184. data/data/ruby/snmp/mibs/RDBMS-MIB.yaml +69 -68
  185. data/data/ruby/snmp/mibs/RFC1065-SMI.yaml +4 -5
  186. data/data/ruby/snmp/mibs/RFC1155-SMI.yaml +4 -5
  187. data/data/ruby/snmp/mibs/RFC1158-MIB.yaml +174 -173
  188. data/data/ruby/snmp/mibs/RFC1213-MIB.yaml +173 -172
  189. data/data/ruby/snmp/mibs/RFC1269-MIB.yaml +20 -19
  190. data/data/ruby/snmp/mibs/RFC1271-MIB.yaml +185 -184
  191. data/data/ruby/snmp/mibs/RFC1285-MIB.yaml +85 -84
  192. data/data/ruby/snmp/mibs/RFC1316-MIB.yaml +30 -29
  193. data/data/ruby/snmp/mibs/RFC1381-MIB.yaml +40 -39
  194. data/data/ruby/snmp/mibs/RFC1382-MIB.yaml +149 -148
  195. data/data/ruby/snmp/mibs/RFC1414-MIB.yaml +4 -3
  196. data/data/ruby/snmp/mibs/RIPv2-MIB.yaml +25 -24
  197. data/data/ruby/snmp/mibs/RMON-MIB.yaml +192 -191
  198. data/data/ruby/snmp/mibs/RMON2-MIB.yaml +253 -252
  199. data/data/ruby/snmp/mibs/ROHC-MIB.yaml +49 -48
  200. data/data/ruby/snmp/mibs/ROHC-RTP-MIB.yaml +19 -18
  201. data/data/ruby/snmp/mibs/ROHC-UNCOMPRESSED-MIB.yaml +6 -5
  202. data/data/ruby/snmp/mibs/RS-232-MIB.yaml +36 -35
  203. data/data/ruby/snmp/mibs/RSTP-MIB.yaml +18 -0
  204. data/data/ruby/snmp/mibs/RSVP-MIB.yaml +137 -136
  205. data/data/ruby/snmp/mibs/RTP-MIB.yaml +42 -41
  206. data/data/ruby/snmp/mibs/SCSI-MIB.yaml +160 -0
  207. data/data/ruby/snmp/mibs/SCTP-MIB.yaml +83 -0
  208. data/data/ruby/snmp/mibs/SFLOW-MIB.yaml +15 -14
  209. data/data/ruby/snmp/mibs/SIP-COMMON-MIB.yaml +112 -0
  210. data/data/ruby/snmp/mibs/SIP-MIB.yaml +56 -55
  211. data/data/ruby/snmp/mibs/SIP-SERVER-MIB.yaml +52 -0
  212. data/data/ruby/snmp/mibs/SIP-TC-MIB.yaml +3 -0
  213. data/data/ruby/snmp/mibs/SIP-UA-MIB.yaml +14 -0
  214. data/data/ruby/snmp/mibs/SLAPM-MIB.yaml +134 -133
  215. data/data/ruby/snmp/mibs/SMON-MIB.yaml +47 -46
  216. data/data/ruby/snmp/mibs/SNA-NAU-MIB.yaml +117 -116
  217. data/data/ruby/snmp/mibs/SNA-SDLC-MIB.yaml +126 -125
  218. data/data/ruby/snmp/mibs/SNMP-COMMUNITY-MIB.yaml +12 -11
  219. data/data/ruby/snmp/mibs/SNMP-FRAMEWORK-MIB.yaml +8 -7
  220. data/data/ruby/snmp/mibs/SNMP-MPD-MIB.yaml +6 -5
  221. data/data/ruby/snmp/mibs/SNMP-NOTIFICATION-MIB.yaml +16 -15
  222. data/data/ruby/snmp/mibs/SNMP-PROXY-MIB.yaml +10 -9
  223. data/data/ruby/snmp/mibs/SNMP-REPEATER-MIB.yaml +120 -119
  224. data/data/ruby/snmp/mibs/SNMP-TARGET-MIB.yaml +19 -18
  225. data/data/ruby/snmp/mibs/SNMP-USER-BASED-SM-MIB.yaml +26 -25
  226. data/data/ruby/snmp/mibs/SNMP-USM-AES-MIB.yaml +4 -0
  227. data/data/ruby/snmp/mibs/SNMP-USM-DH-OBJECTS-MIB.yaml +10 -9
  228. data/data/ruby/snmp/mibs/SNMP-VIEW-BASED-ACM-MIB.yaml +26 -25
  229. data/data/ruby/snmp/mibs/SNMPv2-MIB.yaml +46 -45
  230. data/data/ruby/snmp/mibs/SNMPv2-SMI.yaml +12 -11
  231. data/data/ruby/snmp/mibs/SNMPv2-TM.yaml +5 -4
  232. data/data/ruby/snmp/mibs/SNMPv2-USEC-MIB.yaml +10 -9
  233. data/data/ruby/snmp/mibs/SONET-MIB.yaml +110 -109
  234. data/data/ruby/snmp/mibs/SOURCE-ROUTING-MIB.yaml +18 -17
  235. data/data/ruby/snmp/mibs/SSPM-MIB.yaml +67 -0
  236. data/data/ruby/snmp/mibs/SYSAPPL-MIB.yaml +65 -64
  237. data/data/ruby/snmp/mibs/T11-FC-FABRIC-ADDR-MGR-MIB.yaml +63 -0
  238. data/data/ruby/snmp/mibs/T11-FC-FABRIC-CONFIG-SERVER-MIB.yaml +100 -0
  239. data/data/ruby/snmp/mibs/T11-FC-FABRIC-LOCK-MIB.yaml +22 -0
  240. data/data/ruby/snmp/mibs/T11-FC-FSPF-MIB.yaml +70 -0
  241. data/data/ruby/snmp/mibs/T11-FC-NAME-SERVER-MIB.yaml +56 -0
  242. data/data/ruby/snmp/mibs/T11-FC-ROUTE-MIB.yaml +27 -0
  243. data/data/ruby/snmp/mibs/T11-FC-RSCN-MIB.yaml +47 -0
  244. data/data/ruby/snmp/mibs/T11-FC-VIRTUAL-FABRIC-MIB.yaml +31 -0
  245. data/data/ruby/snmp/mibs/T11-FC-ZONE-SERVER-MIB.yaml +124 -0
  246. data/data/ruby/snmp/mibs/T11-TC-MIB.yaml +3 -0
  247. data/data/ruby/snmp/mibs/TCP-ESTATS-MIB.yaml +167 -0
  248. data/data/ruby/snmp/mibs/TCP-MIB.yaml +37 -18
  249. data/data/ruby/snmp/mibs/TCPIPX-MIB.yaml +16 -15
  250. data/data/ruby/snmp/mibs/TE-LINK-STD-MIB.yaml +82 -0
  251. data/data/ruby/snmp/mibs/TE-MIB.yaml +81 -0
  252. data/data/ruby/snmp/mibs/TIME-AGGREGATE-MIB.yaml +22 -0
  253. data/data/ruby/snmp/mibs/TN3270E-MIB.yaml +85 -84
  254. data/data/ruby/snmp/mibs/TN3270E-RT-MIB.yaml +33 -32
  255. data/data/ruby/snmp/mibs/TOKEN-RING-RMON-MIB.yaml +159 -158
  256. data/data/ruby/snmp/mibs/TOKENRING-MIB.yaml +42 -41
  257. data/data/ruby/snmp/mibs/TOKENRING-STATION-SR-MIB.yaml +8 -7
  258. data/data/ruby/snmp/mibs/TRANSPORT-ADDRESS-MIB.yaml +13 -12
  259. data/data/ruby/snmp/mibs/TRIP-MIB.yaml +118 -0
  260. data/data/ruby/snmp/mibs/TRIP-TC-MIB.yaml +3 -0
  261. data/data/ruby/snmp/mibs/TUNNEL-MIB.yaml +29 -13
  262. data/data/ruby/snmp/mibs/UDP-MIB.yaml +19 -6
  263. data/data/ruby/snmp/mibs/UDPLITE-MIB.yaml +26 -0
  264. data/data/ruby/snmp/mibs/UPS-MIB.yaml +100 -99
  265. data/data/ruby/snmp/mibs/URI-TC-MIB.yaml +3 -0
  266. data/data/ruby/snmp/mibs/VDSL-LINE-EXT-MCM-MIB.yaml +42 -0
  267. data/data/ruby/snmp/mibs/VDSL-LINE-EXT-SCM-MIB.yaml +27 -0
  268. data/data/ruby/snmp/mibs/VDSL-LINE-MIB.yaml +162 -161
  269. data/data/ruby/snmp/mibs/VPN-TC-STD-MIB.yaml +3 -0
  270. data/data/ruby/snmp/mibs/VRRP-MIB.yaml +39 -38
  271. data/data/ruby/snmp/mibs/WWW-MIB.yaml +75 -74
  272. data/examples/dump.rb +5 -5
  273. data/examples/iftable.rb +4 -4
  274. data/examples/link_down.rb +18 -18
  275. data/examples/log_traps.rb +9 -9
  276. data/examples/walk.rb +4 -4
  277. data/lib/snmp/agent.rb +42 -43
  278. data/lib/snmp/ber.rb +155 -156
  279. data/lib/snmp/manager.rb +412 -372
  280. data/lib/snmp/mib.rb +172 -182
  281. data/lib/snmp/options.rb +64 -0
  282. data/lib/snmp/pdu.rb +245 -245
  283. data/lib/snmp/varbind.rb +346 -341
  284. data/lib/snmp/version.rb +3 -0
  285. data/test/test_ber.rb +232 -233
  286. data/test/test_manager.rb +277 -238
  287. data/test/test_mib.rb +57 -57
  288. data/test/test_pdu.rb +172 -172
  289. data/test/test_retry.rb +54 -54
  290. data/test/test_smi.rb +10 -10
  291. data/test/test_varbind.rb +342 -331
  292. data/test/test_walk.rb +150 -150
  293. metadata +103 -45
  294. data/README +0 -252
  295. data/setup.rb +0 -1360
@@ -1,91 +1,92 @@
1
1
  ---
2
- wwwDocBytesTopNLastResponseType: 1.3.6.1.2.1.65.1.3.5.1.5
2
+ wwwMIB: 1.3.6.1.2.1.65
3
+ wwwMIBObjects: 1.3.6.1.2.1.65.1
4
+ wwwService: 1.3.6.1.2.1.65.1.1
5
+ wwwServiceTable: 1.3.6.1.2.1.65.1.1.1
6
+ wwwServiceEntry: 1.3.6.1.2.1.65.1.1.1.1
7
+ wwwServiceIndex: 1.3.6.1.2.1.65.1.1.1.1.1
8
+ wwwServiceDescription: 1.3.6.1.2.1.65.1.1.1.1.2
9
+ wwwServiceContact: 1.3.6.1.2.1.65.1.1.1.1.3
10
+ wwwServiceProtocol: 1.3.6.1.2.1.65.1.1.1.1.4
11
+ wwwServiceName: 1.3.6.1.2.1.65.1.1.1.1.5
12
+ wwwServiceType: 1.3.6.1.2.1.65.1.1.1.1.6
13
+ wwwServiceStartTime: 1.3.6.1.2.1.65.1.1.1.1.7
3
14
  wwwServiceOperStatus: 1.3.6.1.2.1.65.1.1.1.1.8
4
- wwwMIBConformance: 1.3.6.1.2.1.65.2
5
- wwwDocAccessTopNEntry: 1.3.6.1.2.1.65.1.3.4.1
15
+ wwwServiceLastChange: 1.3.6.1.2.1.65.1.1.1.1.9
16
+ wwwProtocolStatistics: 1.3.6.1.2.1.65.1.2
17
+ wwwSummaryTable: 1.3.6.1.2.1.65.1.2.1
18
+ wwwSummaryEntry: 1.3.6.1.2.1.65.1.2.1.1
19
+ wwwSummaryInRequests: 1.3.6.1.2.1.65.1.2.1.1.1
20
+ wwwSummaryOutRequests: 1.3.6.1.2.1.65.1.2.1.1.2
21
+ wwwSummaryInResponses: 1.3.6.1.2.1.65.1.2.1.1.3
22
+ wwwSummaryOutResponses: 1.3.6.1.2.1.65.1.2.1.1.4
23
+ wwwSummaryInBytes: 1.3.6.1.2.1.65.1.2.1.1.5
24
+ wwwSummaryInLowBytes: 1.3.6.1.2.1.65.1.2.1.1.6
25
+ wwwSummaryOutBytes: 1.3.6.1.2.1.65.1.2.1.1.7
26
+ wwwSummaryOutLowBytes: 1.3.6.1.2.1.65.1.2.1.1.8
6
27
  wwwRequestInTable: 1.3.6.1.2.1.65.1.2.2
7
28
  wwwRequestInEntry: 1.3.6.1.2.1.65.1.2.2.1
8
- wwwServiceLastChange: 1.3.6.1.2.1.65.1.1.1.1.9
9
- wwwDocBytesTopNName: 1.3.6.1.2.1.65.1.3.5.1.2
10
- wwwDocLastNRequestType: 1.3.6.1.2.1.65.1.3.2.1.4
11
- wwwResponseOutIndex: 1.3.6.1.2.1.65.1.2.5.1.1
12
- wwwDocBucketTable: 1.3.6.1.2.1.65.1.3.3
29
+ wwwRequestInIndex: 1.3.6.1.2.1.65.1.2.2.1.1
30
+ wwwRequestInRequests: 1.3.6.1.2.1.65.1.2.2.1.2
31
+ wwwRequestInBytes: 1.3.6.1.2.1.65.1.2.2.1.3
13
32
  wwwRequestInLastTime: 1.3.6.1.2.1.65.1.2.2.1.4
14
- wwwSummaryInResponses: 1.3.6.1.2.1.65.1.2.1.1.3
15
- wwwDocAccessTopNBytes: 1.3.6.1.2.1.65.1.3.4.1.4
16
- wwwServiceContact: 1.3.6.1.2.1.65.1.1.1.1.3
17
- wwwServiceStartTime: 1.3.6.1.2.1.65.1.1.1.1.7
18
33
  wwwRequestOutTable: 1.3.6.1.2.1.65.1.2.3
19
34
  wwwRequestOutEntry: 1.3.6.1.2.1.65.1.2.3.1
20
- wwwSummaryInLowBytes: 1.3.6.1.2.1.65.1.2.1.1.6
21
- wwwDocBucketAccesses: 1.3.6.1.2.1.65.1.3.3.1.3
22
- wwwDocLastNEntry: 1.3.6.1.2.1.65.1.3.2.1
23
- wwwSummaryInBytes: 1.3.6.1.2.1.65.1.2.1.1.5
24
- wwwRequestInBytes: 1.3.6.1.2.1.65.1.2.2.1.3
35
+ wwwRequestOutIndex: 1.3.6.1.2.1.65.1.2.3.1.1
36
+ wwwRequestOutRequests: 1.3.6.1.2.1.65.1.2.3.1.2
25
37
  wwwRequestOutBytes: 1.3.6.1.2.1.65.1.2.3.1.3
26
- wwwSummaryOutRequests: 1.3.6.1.2.1.65.1.2.1.1.2
27
- wwwResponseOutResponses: 1.3.6.1.2.1.65.1.2.5.1.2
28
- wwwDocLastNName: 1.3.6.1.2.1.65.1.3.2.1.2
29
- wwwSummaryOutResponses: 1.3.6.1.2.1.65.1.2.1.1.4
30
- wwwDocCtrlBucketTimeInterval: 1.3.6.1.2.1.65.1.3.1.1.4
31
- wwwDocBucketDocuments: 1.3.6.1.2.1.65.1.3.3.1.4
32
- wwwSummaryOutBytes: 1.3.6.1.2.1.65.1.2.1.1.7
33
- wwwResponseInIndex: 1.3.6.1.2.1.65.1.2.4.1.1
34
- wwwDocLastNBytes: 1.3.6.1.2.1.65.1.3.2.1.7
35
- wwwDocCtrlEntry: 1.3.6.1.2.1.65.1.3.1.1
36
- wwwDocBytesTopNIndex: 1.3.6.1.2.1.65.1.3.5.1.1
37
- wwwService: 1.3.6.1.2.1.65.1.1
38
- wwwProtocolStatistics: 1.3.6.1.2.1.65.1.2
39
- wwwDocBucketTimeStamp: 1.3.6.1.2.1.65.1.3.3.1.2
40
- wwwMIBGroups: 1.3.6.1.2.1.65.2.2
41
- wwwSummaryTable: 1.3.6.1.2.1.65.1.2.1
38
+ wwwRequestOutLastTime: 1.3.6.1.2.1.65.1.2.3.1.4
42
39
  wwwResponseInTable: 1.3.6.1.2.1.65.1.2.4
43
- wwwServiceIndex: 1.3.6.1.2.1.65.1.1.1.1.1
44
- wwwDocAccessTopNLastResponseType: 1.3.6.1.2.1.65.1.3.4.1.5
45
- wwwSummaryInRequests: 1.3.6.1.2.1.65.1.2.1.1.1
46
- wwwDocCtrlTopNSize: 1.3.6.1.2.1.65.1.3.1.1.5
47
- wwwDocCtrlLastNLock: 1.3.6.1.2.1.65.1.3.1.1.2
48
- wwwMIBCompliances: 1.3.6.1.2.1.65.2.1
49
- wwwDocAccessTopNName: 1.3.6.1.2.1.65.1.3.4.1.2
50
- wwwDocBytesTopNTable: 1.3.6.1.2.1.65.1.3.5
51
- wwwDocBucketEntry: 1.3.6.1.2.1.65.1.3.3.1
52
- wwwDocCtrlBuckets: 1.3.6.1.2.1.65.1.3.1.1.3
53
- wwwServiceName: 1.3.6.1.2.1.65.1.1.1.1.5
54
- wwwServiceTable: 1.3.6.1.2.1.65.1.1.1
40
+ wwwResponseInEntry: 1.3.6.1.2.1.65.1.2.4.1
41
+ wwwResponseInIndex: 1.3.6.1.2.1.65.1.2.4.1.1
42
+ wwwResponseInResponses: 1.3.6.1.2.1.65.1.2.4.1.2
43
+ wwwResponseInBytes: 1.3.6.1.2.1.65.1.2.4.1.3
55
44
  wwwResponseInLastTime: 1.3.6.1.2.1.65.1.2.4.1.4
56
- wwwDocLastNTimeStamp: 1.3.6.1.2.1.65.1.3.2.1.3
57
- wwwDocAccessTopNAccesses: 1.3.6.1.2.1.65.1.3.4.1.3
58
45
  wwwResponseOutTable: 1.3.6.1.2.1.65.1.2.5
59
46
  wwwResponseOutEntry: 1.3.6.1.2.1.65.1.2.5.1
60
- wwwDocBucketBytes: 1.3.6.1.2.1.65.1.3.3.1.5
61
- wwwResponseInBytes: 1.3.6.1.2.1.65.1.2.4.1.3
62
- wwwDocAccessTopNIndex: 1.3.6.1.2.1.65.1.3.4.1.1
63
- wwwDocLastNStatusMsg: 1.3.6.1.2.1.65.1.3.2.1.6
64
- wwwRequestInIndex: 1.3.6.1.2.1.65.1.2.2.1.1
65
- wwwDocBytesTopNBytes: 1.3.6.1.2.1.65.1.3.5.1.4
66
- wwwDocCtrlLastNSize: 1.3.6.1.2.1.65.1.3.1.1.1
67
- wwwRequestOutIndex: 1.3.6.1.2.1.65.1.2.3.1.1
47
+ wwwResponseOutIndex: 1.3.6.1.2.1.65.1.2.5.1.1
48
+ wwwResponseOutResponses: 1.3.6.1.2.1.65.1.2.5.1.2
68
49
  wwwResponseOutBytes: 1.3.6.1.2.1.65.1.2.5.1.3
69
- wwwDocAccessTopNTable: 1.3.6.1.2.1.65.1.3.4
70
- wwwDocBytesTopNAccesses: 1.3.6.1.2.1.65.1.3.5.1.3
71
- wwwResponseInResponses: 1.3.6.1.2.1.65.1.2.4.1.2
72
- wwwRequestOutRequests: 1.3.6.1.2.1.65.1.2.3.1.2
73
- wwwDocLastNIndex: 1.3.6.1.2.1.65.1.3.2.1.1
74
- wwwResponseInEntry: 1.3.6.1.2.1.65.1.2.4.1
75
- wwwDocLastNTable: 1.3.6.1.2.1.65.1.3.2
76
- wwwServiceDescription: 1.3.6.1.2.1.65.1.1.1.1.2
77
- wwwServiceProtocol: 1.3.6.1.2.1.65.1.1.1.1.4
78
- wwwSummaryEntry: 1.3.6.1.2.1.65.1.2.1.1
79
- wwwMIBObjects: 1.3.6.1.2.1.65.1
80
- wwwDocBytesTopNEntry: 1.3.6.1.2.1.65.1.3.5.1
81
- wwwServiceEntry: 1.3.6.1.2.1.65.1.1.1.1
82
- wwwRequestOutLastTime: 1.3.6.1.2.1.65.1.2.3.1.4
83
- wwwSummaryOutLowBytes: 1.3.6.1.2.1.65.1.2.1.1.8
84
- wwwServiceType: 1.3.6.1.2.1.65.1.1.1.1.6
85
- wwwDocLastNResponseType: 1.3.6.1.2.1.65.1.3.2.1.5
86
- wwwMIB: 1.3.6.1.2.1.65
87
- wwwRequestInRequests: 1.3.6.1.2.1.65.1.2.2.1.2
88
50
  wwwResponseOutLastTime: 1.3.6.1.2.1.65.1.2.5.1.4
89
51
  wwwDocumentStatistics: 1.3.6.1.2.1.65.1.3
90
52
  wwwDocCtrlTable: 1.3.6.1.2.1.65.1.3.1
53
+ wwwDocCtrlEntry: 1.3.6.1.2.1.65.1.3.1.1
54
+ wwwDocCtrlLastNSize: 1.3.6.1.2.1.65.1.3.1.1.1
55
+ wwwDocCtrlLastNLock: 1.3.6.1.2.1.65.1.3.1.1.2
56
+ wwwDocCtrlBuckets: 1.3.6.1.2.1.65.1.3.1.1.3
57
+ wwwDocCtrlBucketTimeInterval: 1.3.6.1.2.1.65.1.3.1.1.4
58
+ wwwDocCtrlTopNSize: 1.3.6.1.2.1.65.1.3.1.1.5
59
+ wwwDocLastNTable: 1.3.6.1.2.1.65.1.3.2
60
+ wwwDocLastNEntry: 1.3.6.1.2.1.65.1.3.2.1
61
+ wwwDocLastNIndex: 1.3.6.1.2.1.65.1.3.2.1.1
62
+ wwwDocLastNName: 1.3.6.1.2.1.65.1.3.2.1.2
63
+ wwwDocLastNTimeStamp: 1.3.6.1.2.1.65.1.3.2.1.3
64
+ wwwDocLastNRequestType: 1.3.6.1.2.1.65.1.3.2.1.4
65
+ wwwDocLastNResponseType: 1.3.6.1.2.1.65.1.3.2.1.5
66
+ wwwDocLastNStatusMsg: 1.3.6.1.2.1.65.1.3.2.1.6
67
+ wwwDocLastNBytes: 1.3.6.1.2.1.65.1.3.2.1.7
68
+ wwwDocBucketTable: 1.3.6.1.2.1.65.1.3.3
69
+ wwwDocBucketEntry: 1.3.6.1.2.1.65.1.3.3.1
91
70
  wwwDocBucketIndex: 1.3.6.1.2.1.65.1.3.3.1.1
71
+ wwwDocBucketTimeStamp: 1.3.6.1.2.1.65.1.3.3.1.2
72
+ wwwDocBucketAccesses: 1.3.6.1.2.1.65.1.3.3.1.3
73
+ wwwDocBucketDocuments: 1.3.6.1.2.1.65.1.3.3.1.4
74
+ wwwDocBucketBytes: 1.3.6.1.2.1.65.1.3.3.1.5
75
+ wwwDocAccessTopNTable: 1.3.6.1.2.1.65.1.3.4
76
+ wwwDocAccessTopNEntry: 1.3.6.1.2.1.65.1.3.4.1
77
+ wwwDocAccessTopNIndex: 1.3.6.1.2.1.65.1.3.4.1.1
78
+ wwwDocAccessTopNName: 1.3.6.1.2.1.65.1.3.4.1.2
79
+ wwwDocAccessTopNAccesses: 1.3.6.1.2.1.65.1.3.4.1.3
80
+ wwwDocAccessTopNBytes: 1.3.6.1.2.1.65.1.3.4.1.4
81
+ wwwDocAccessTopNLastResponseType: 1.3.6.1.2.1.65.1.3.4.1.5
82
+ wwwDocBytesTopNTable: 1.3.6.1.2.1.65.1.3.5
83
+ wwwDocBytesTopNEntry: 1.3.6.1.2.1.65.1.3.5.1
84
+ wwwDocBytesTopNIndex: 1.3.6.1.2.1.65.1.3.5.1.1
85
+ wwwDocBytesTopNName: 1.3.6.1.2.1.65.1.3.5.1.2
86
+ wwwDocBytesTopNAccesses: 1.3.6.1.2.1.65.1.3.5.1.3
87
+ wwwDocBytesTopNBytes: 1.3.6.1.2.1.65.1.3.5.1.4
88
+ wwwDocBytesTopNLastResponseType: 1.3.6.1.2.1.65.1.3.5.1.5
89
+ wwwMIBConformance: 1.3.6.1.2.1.65.2
90
+ wwwMIBCompliances: 1.3.6.1.2.1.65.2.1
91
+ wwwMIBGroups: 1.3.6.1.2.1.65.2.2
92
+
@@ -7,9 +7,9 @@ manager = Manager.new(:Host => host, :Port => 161)
7
7
  start_oid = ObjectId.new("1.3.6.1.2")
8
8
  next_oid = start_oid
9
9
  while next_oid.subtree_of?(start_oid)
10
- response = manager.get_next(next_oid)
11
- varbind = response.varbind_list.first
12
- break if EndOfMibView == varbind.value
13
- next_oid = varbind.name
14
- puts "#{varbind.name.to_s} #{varbind.value.to_s} #{varbind.value.asn1_type}"
10
+ response = manager.get_next(next_oid)
11
+ varbind = response.varbind_list.first
12
+ break if EndOfMibView == varbind.value
13
+ next_oid = varbind.name
14
+ puts "#{varbind.name.to_s} #{varbind.value.to_s} #{varbind.value.asn1_type}"
15
15
  end
@@ -7,8 +7,8 @@ manager = Manager.new(:Host => host, :Port => 161)
7
7
  ifTable = ObjectId.new("1.3.6.1.2.1.2.2")
8
8
  next_oid = ifTable
9
9
  while next_oid.subtree_of?(ifTable)
10
- response = manager.get_next(next_oid)
11
- varbind = response.varbind_list.first
12
- next_oid = varbind.name
13
- puts "#{varbind.name.to_s} #{varbind.value.to_s} #{varbind.value.asn1_type}"
10
+ response = manager.get_next(next_oid)
11
+ varbind = response.varbind_list.first
12
+ next_oid = varbind.name
13
+ puts "#{varbind.name.to_s} #{varbind.value.to_s} #{varbind.value.asn1_type}"
14
14
  end
@@ -15,29 +15,29 @@ ADMIN_DOWN = 2
15
15
  listener = SNMP::TrapListener.new(:Port => 1062, :Community => 'public') do |listener|
16
16
  log.info "Listening for linkDown traps"
17
17
  listener.on_trap(linkDown_OID) do |trap|
18
- vb_list = trap.vb_list
19
- up_time = vb_list[0].value # standard varbind - always in v2c trap
20
- trap_oid = vb_list[1].value # standard varbind - always in v2c trap
21
-
22
- # extract trap info - order determined by IF-MIB
23
- ifIndex = vb_list[2].value
24
- adminStatus = vb_list[3].value
25
- operStatus = vb_list[4].value
26
-
27
- # log stuff based on interface status
28
- if adminStatus == ADMIN_DOWN
29
- log.info "Interface #{ifIndex} turned down"
30
- else
31
- log.error "Problem on interface #{ifIndex}! Link unintentionally down"
32
- end
18
+ vb_list = trap.vb_list
19
+ up_time = vb_list[0].value # standard varbind - always in v2c trap
20
+ trap_oid = vb_list[1].value # standard varbind - always in v2c trap
21
+
22
+ # extract trap info - order determined by IF-MIB
23
+ ifIndex = vb_list[2].value
24
+ adminStatus = vb_list[3].value
25
+ operStatus = vb_list[4].value
26
+
27
+ # log stuff based on interface status
28
+ if adminStatus == ADMIN_DOWN
29
+ log.info "Interface #{ifIndex} turned down"
30
+ else
31
+ log.error "Problem on interface #{ifIndex}! Link unintentionally down"
32
+ end
33
33
  end
34
-
34
+
35
35
  listener.on_trap_v1 do |trap|
36
- log.warn "Unexpected v1 trap: #{trap.generic_trap}"
36
+ log.warn "Unexpected v1 trap: #{trap.generic_trap}"
37
37
  end
38
38
 
39
39
  listener.on_trap_v2c do |trap|
40
- log.warn "Unexpected v2c trap: #{trap.trap_oid}"
40
+ log.warn "Unexpected v2c trap: #{trap.trap_oid}"
41
41
  end
42
42
  end
43
43
 
@@ -2,22 +2,22 @@ require 'snmp'
2
2
  require 'logger'
3
3
 
4
4
  def format_v1_trap(trap)
5
- "Trap #{trap.generic_trap} from #{trap.source_ip}"
5
+ "Trap #{trap.generic_trap} from #{trap.source_ip}"
6
6
  end
7
7
 
8
8
  def format_v2c_trap(trap)
9
- "Trap #{trap.trap_oid} from #{trap.source_ip}"
9
+ "Trap #{trap.trap_oid} from #{trap.source_ip}"
10
10
  end
11
11
 
12
12
  log = Logger.new(STDOUT)
13
13
  m = SNMP::TrapManager.new(:Port => 1062) do |manager|
14
- manager.on_trap_v1 do |trap|
15
- log.info format_v1_trap(trap)
16
- end
17
- manager.on_trap_v2c do |trap|
18
- log.info format_v2c_trap(trap)
19
- end
20
- log.info "Logging started"
14
+ manager.on_trap_v1 do |trap|
15
+ log.info format_v1_trap(trap)
16
+ end
17
+ manager.on_trap_v2c do |trap|
18
+ log.info format_v2c_trap(trap)
19
+ end
20
+ log.info "Logging started"
21
21
  end
22
22
  trap("INT") { log.info "Logging stopped"; m.exit }
23
23
  m.join
@@ -3,12 +3,12 @@ require 'snmp'
3
3
  host = ARGV[0] || 'localhost'
4
4
 
5
5
  SNMP::Manager.open(:Host => "localhost") do |manager|
6
- manager.walk("ifTable") { |vb| puts vb }
6
+ manager.walk("ifTable") { |vb| puts vb }
7
7
  end
8
8
 
9
9
 
10
10
  SNMP::Manager.open(:Host => host) do |manager|
11
- manager.walk(["ifIndex", "ifDescr"]) do |ifIndex, ifDescr|
12
- puts "#{ifIndex} #{ifDescr}"
13
- end
11
+ manager.walk(["ifIndex", "ifDescr"]) do |ifIndex, ifDescr|
12
+ puts "#{ifIndex} #{ifDescr}"
13
+ end
14
14
  end
@@ -13,62 +13,61 @@ require 'logger'
13
13
 
14
14
  module SNMP
15
15
 
16
- class Agent #:nodoc:all
16
+ class Agent #:nodoc:all
17
17
 
18
18
  def initialize(listen_port=161, max_packet=8000)
19
- @log = Logger.new(STDOUT)
20
- @log.level = Logger::DEBUG
21
- @max_packet = max_packet
22
- @socket = UDPSocket.open
23
- @socket.bind(nil, listen_port)
24
- @mib = MIB::SystemMIB.new
19
+ @log = Logger.new(STDOUT)
20
+ @log.level = Logger::DEBUG
21
+ @max_packet = max_packet
22
+ @socket = UDPSocket.open
23
+ @socket.bind(nil, listen_port)
24
+ @mib = MIB::SystemMIB.new
25
25
  end
26
-
26
+
27
27
  def start
28
- @log.info "SNMP agent running"
29
- loop do
30
- begin
31
- data, remote_info = @socket.recvfrom(@max_packet)
32
- puts "Received #{data.length} bytes"
33
- p data
34
- message = Message.decode(data)
35
- case message.pdu
36
- when GetRequest
37
- response = message.response
38
- response.pdu.varbind_list.each do |v|
39
- v.value = @mib.get(v.name)
40
- end
41
- when SetRequest
42
- response = message.response
43
- else
44
- raise "invalid message #{message.to_s}"
45
- end
46
- puts "Responding to #{remote_info[3]}:#{remote_info[1]}"
47
- encoded_message = response.encode
48
- n=@socket.send(encoded_message, 0, remote_info[3], remote_info[1])
49
- p encoded_message
50
- rescue => e
51
- @log.error e
52
- shutdown
28
+ @log.info "SNMP agent running"
29
+ loop do
30
+ begin
31
+ data, remote_info = @socket.recvfrom(@max_packet)
32
+ puts "Received #{data.length} bytes"
33
+ p data
34
+ message = Message.decode(data)
35
+ case message.pdu
36
+ when GetRequest
37
+ response = message.response
38
+ response.pdu.varbind_list.each do |v|
39
+ v.value = @mib.get(v.name)
53
40
  end
41
+ when SetRequest
42
+ response = message.response
43
+ else
44
+ raise "invalid message #{message.to_s}"
45
+ end
46
+ puts "Responding to #{remote_info[3]}:#{remote_info[1]}"
47
+ encoded_message = response.encode
48
+ n=@socket.send(encoded_message, 0, remote_info[3], remote_info[1])
49
+ p encoded_message
50
+ rescue => e
51
+ @log.error e
52
+ shutdown
54
53
  end
54
+ end
55
55
  end
56
-
56
+
57
57
  def shutdown
58
- @log.info "SNMP agent stopping"
59
- @socket.close
60
- exit
58
+ @log.info "SNMP agent stopping"
59
+ @socket.close
60
+ exit
61
61
  end
62
62
 
63
63
  alias stop :shutdown
64
-
65
- end
64
+
65
+ end
66
66
 
67
67
  end
68
68
 
69
69
  if $0 == __FILE__
70
- agent = SNMP::Agent.new(1061)
71
- trap("INT") { agent.shutdown }
72
- agent.start
70
+ agent = SNMP::Agent.new(1061)
71
+ trap("INT") { agent.shutdown }
72
+ agent.start
73
73
  end
74
-
@@ -11,11 +11,11 @@
11
11
  # Add ord method to Fixnum for forward compatibility with Ruby 1.9
12
12
  #
13
13
  if "a"[0].kind_of? Fixnum
14
- unless Fixnum.methods.include? :ord
15
- class Fixnum
16
- def ord; self; end
17
- end
14
+ unless Fixnum.methods.include? :ord
15
+ class Fixnum
16
+ def ord; self; end
18
17
  end
18
+ end
19
19
  end
20
20
 
21
21
  #
@@ -23,7 +23,7 @@ end
23
23
  # using the ASN.1 BER (Basic Encoding Rules).
24
24
  #
25
25
  module SNMP
26
- module BER #:nodoc:all
26
+ module BER #:nodoc:all
27
27
 
28
28
  # SNMP version codes
29
29
  SNMP_V1 = 0
@@ -41,17 +41,17 @@ module BER #:nodoc:all
41
41
  GetBulkRequest_PDU_TAG = 0xa5
42
42
  InformRequest_PDU_TAG = 0xa6
43
43
  SNMPv2_Trap_PDU_TAG = 0xa7
44
- Report_PDU_TAG = 0xa8 # Note: Usage not defined - not supported
44
+ Report_PDU_TAG = 0xa8 # Note: Usage not defined - not supported
45
45
 
46
46
  # Primitive ASN.1 data types
47
47
  INTEGER_TAG = 0x02
48
48
  OCTET_STRING_TAG = 0x04
49
49
  NULL_TAG = 0x05
50
50
  OBJECT_IDENTIFIER_TAG = 0x06
51
-
51
+
52
52
  # Constructed ASN.1 data type
53
53
  SEQUENCE_TAG = 0x30
54
-
54
+
55
55
  # SNMP application data types
56
56
  # See RFC 1155 for SNMPv1
57
57
  # See RFC 1902 for SNMPv2c
@@ -62,23 +62,23 @@ module BER #:nodoc:all
62
62
  TimeTicks_TAG = 0x43
63
63
  Opaque_TAG = 0x44
64
64
  Counter64_TAG = 0x46
65
-
65
+
66
66
  # VarBind response exceptions
67
67
  NoSuchObject_TAG = 0x80
68
68
  NoSuchInstance_TAG = 0x81
69
69
  EndOfMibView_TAG = 0x82
70
-
70
+
71
71
  # Exceptions thrown in this module
72
- class OutOfData < RuntimeError; end
72
+ class OutOfData < RuntimeError; end
73
73
  class InvalidLength < RuntimeError; end
74
74
  class InvalidTag < RuntimeError; end
75
75
  class InvalidObjectId < RuntimeError; end
76
76
  class InvalidLength < RuntimeError; end
77
77
 
78
78
  def assert_no_remainder(remainder)
79
- raise ParseError, remainder.inspect if remainder != ""
79
+ raise ParseError, remainder.inspect if remainder != ""
80
80
  end
81
-
81
+
82
82
  #
83
83
  # Decode tag-length-value data. The data is assumed to be a string of
84
84
  # bytes in network byte order. This format is returned by Socket#recv.
@@ -95,23 +95,23 @@ module BER #:nodoc:all
95
95
  # multi-byte).
96
96
  #
97
97
  def decode_tlv(data)
98
- raise OutOfData if (data.length == 2 && data[1].ord != 0) || data.length < 2
99
- tag = data[0].ord
100
- length = data[1].ord
101
- if length < 0x80
102
- value = data[2, length]
103
- remainder = data[length+2..-1]
104
- else
105
- # ASN.1 says this octet can't be 0xff
106
- raise InvalidLength, length.to_s if length == 0xff
107
- num_octets = length & 0x7f
108
- length = build_integer(data, 2, num_octets)
109
- value = data[num_octets+2, length]
110
- remainder = data[num_octets+2+length..-1]
111
- end
112
- return tag, value, remainder
98
+ raise OutOfData if (data.length == 2 && data[1].ord != 0) || data.length < 2
99
+ tag = data[0].ord
100
+ length = data[1].ord
101
+ if length < 0x80
102
+ value = data[2, length]
103
+ remainder = data[length+2..-1]
104
+ else
105
+ # ASN.1 says this octet can't be 0xff
106
+ raise InvalidLength, length.to_s if length == 0xff
107
+ num_octets = length & 0x7f
108
+ length = build_integer(data, 2, num_octets)
109
+ value = data[num_octets+2, length]
110
+ remainder = data[num_octets+2+length..-1]
111
+ end
112
+ return tag, value, remainder
113
113
  end
114
-
114
+
115
115
  #
116
116
  # Decode TLV data for an ASN.1 integer.
117
117
  #
@@ -120,38 +120,38 @@ module BER #:nodoc:all
120
120
  # Returns a tuple containing an integer and any remaining unprocessed data.
121
121
  #
122
122
  def decode_integer(data)
123
- tag, value, remainder = decode_tlv(data)
124
- raise InvalidTag, tag.to_s if tag != INTEGER_TAG
125
- return decode_integer_value(value), remainder
123
+ tag, value, remainder = decode_tlv(data)
124
+ raise InvalidTag, tag.to_s if tag != INTEGER_TAG
125
+ return decode_integer_value(value), remainder
126
126
  end
127
127
 
128
128
  def decode_timeticks(data)
129
- tag, value, remainder = decode_tlv(data)
130
- raise InvalidTag, tag.to_s if tag != TimeTicks_TAG
131
- return decode_uinteger_value(value), remainder
129
+ tag, value, remainder = decode_tlv(data)
130
+ raise InvalidTag, tag.to_s if tag != TimeTicks_TAG
131
+ return decode_uinteger_value(value), remainder
132
132
  end
133
-
133
+
134
134
  def decode_integer_value(value)
135
- result = build_integer(value, 0, value.length)
136
- if value[0].ord[7] == 1
137
- result -= (1 << (8 * value.length))
138
- end
139
- result
135
+ result = build_integer(value, 0, value.length)
136
+ if value[0].ord[7] == 1
137
+ result -= (1 << (8 * value.length))
138
+ end
139
+ result
140
140
  end
141
-
141
+
142
142
  ##
143
143
  # Decode an integer, ignoring the sign bit. Some agents insist on
144
144
  # encoding 32 bit unsigned integers with four bytes even though it
145
145
  # should be 5 bytes (at least the way I read it).
146
146
  #
147
147
  def decode_uinteger_value(value)
148
- build_integer(value, 0, value.length)
148
+ build_integer(value, 0, value.length)
149
149
  end
150
-
150
+
151
151
  def build_integer(data, start, num_octets)
152
- number = 0
153
- num_octets.times { |i| number = number<<8 | data[start+i].ord }
154
- return number
152
+ number = 0
153
+ num_octets.times { |i| number = number<<8 | data[start+i].ord }
154
+ return number
155
155
  end
156
156
 
157
157
  #
@@ -160,34 +160,34 @@ module BER #:nodoc:all
160
160
  # Throws an InvalidTag exception if the tag is incorrect.
161
161
  #
162
162
  # Returns a tuple containing a string and any remaining unprocessed data.
163
- #
163
+ #
164
164
  def decode_octet_string(data)
165
- tag, value, remainder = decode_tlv(data)
166
- raise InvalidTag, tag.to_s if tag != OCTET_STRING_TAG
167
- return value, remainder
165
+ tag, value, remainder = decode_tlv(data)
166
+ raise InvalidTag, tag.to_s if tag != OCTET_STRING_TAG
167
+ return value, remainder
168
168
  end
169
-
169
+
170
170
  def decode_ip_address(data)
171
- tag, value, remainder = decode_tlv(data)
172
- raise InvalidTag, tag.to_s if tag != IpAddress_TAG
173
- raise InvalidLength, tag.to_s if value.length != 4
174
- return value, remainder
171
+ tag, value, remainder = decode_tlv(data)
172
+ raise InvalidTag, tag.to_s if tag != IpAddress_TAG
173
+ raise InvalidLength, tag.to_s if value.length != 4
174
+ return value, remainder
175
175
  end
176
-
176
+
177
177
  #
178
178
  # Decode TLV data for an ASN.1 sequence.
179
179
  #
180
180
  # Throws an InvalidTag exception if the tag is incorrect.
181
181
  #
182
- # Returns a tuple containing the sequence data and any remaining
182
+ # Returns a tuple containing the sequence data and any remaining
183
183
  # unprocessed data that follows the sequence.
184
184
  #
185
185
  def decode_sequence(data)
186
- tag, value, remainder = decode_tlv(data)
187
- raise InvalidTag, tag.to_s if tag != SEQUENCE_TAG
188
- return value, remainder
186
+ tag, value, remainder = decode_tlv(data)
187
+ raise InvalidTag, tag.to_s if tag != SEQUENCE_TAG
188
+ return value, remainder
189
189
  end
190
-
190
+
191
191
  #
192
192
  # Unwrap TLV data for an ASN.1 object identifier. This method extracts
193
193
  # the OID value as a character string but does not decode it further.
@@ -199,155 +199,154 @@ module BER #:nodoc:all
199
199
  # of integers.
200
200
  #
201
201
  def decode_object_id(data)
202
- tag, value, remainder = decode_tlv(data)
203
- raise InvalidTag, tag.to_s if tag != OBJECT_IDENTIFIER_TAG
204
- return decode_object_id_value(value), remainder
202
+ tag, value, remainder = decode_tlv(data)
203
+ raise InvalidTag, tag.to_s if tag != OBJECT_IDENTIFIER_TAG
204
+ return decode_object_id_value(value), remainder
205
205
  end
206
-
206
+
207
207
  def decode_object_id_value(value)
208
- if value.length == 0
209
- object_id = []
208
+ if value.length == 0
209
+ object_id = []
210
+ else
211
+ value0 = value[0].ord
212
+ if value0 == 0x2b
213
+ object_id = [1,3]
210
214
  else
211
- value0 = value[0].ord
212
- if value0 == 0x2b
213
- object_id = [1,3]
214
- else
215
- second = value0 % 40
216
- first = (value0 - second) / 40
217
- raise InvalidObjectId, value.to_s if first > 2
218
- object_id = [first, second]
219
- end
215
+ second = value0 % 40
216
+ first = (value0 - second) / 40
217
+ raise InvalidObjectId, value.to_s if first > 2
218
+ object_id = [first, second]
219
+ end
220
+ n = 0
221
+ for i in 1...value.length
222
+ n = (n<<7) + (value[i].ord & 0x7f)
223
+ if value[i].ord < 0x80
224
+ object_id << n
220
225
  n = 0
221
- for i in 1...value.length
222
- n = (n<<7) + (value[i].ord & 0x7f)
223
- if value[i].ord < 0x80
224
- object_id << n
225
- n = 0
226
- end
227
- end
226
+ end
228
227
  end
229
- return object_id
228
+ end
229
+ return object_id
230
230
  end
231
-
231
+
232
232
  #
233
233
  # Encode the length field for TLV data. Returns the length octets
234
234
  # as a string.
235
235
  #
236
236
  def encode_length(length)
237
- raise InvalidLength, length.to_s if length < 0
238
- if length < 0x80
239
- length.chr
240
- else
241
- data = integer_to_octets(length)
242
- (data.size | 0x80).chr << data
243
- end
237
+ raise InvalidLength, length.to_s if length < 0
238
+ if length < 0x80
239
+ length.chr
240
+ else
241
+ data = integer_to_octets(length)
242
+ (data.size | 0x80).chr << data
243
+ end
244
244
  end
245
245
 
246
246
  #
247
247
  # Encode integer
248
248
  #
249
249
  def encode_integer(value)
250
- encode_tagged_integer(INTEGER_TAG, value)
250
+ encode_tagged_integer(INTEGER_TAG, value)
251
251
  end
252
-
252
+
253
253
  def encode_tagged_integer(tag, value)
254
- if value > 0 && value < 0x80
255
- data = value.chr
256
- else
257
- data = integer_to_octets(value)
258
- if value > 0 && data[0].ord > 0x7f
259
- data = "\000" << data
260
- elsif value < 0 && data[0].ord < 0x80
261
- data = "\377" << data
262
- end
254
+ if value > 0 && value < 0x80
255
+ data = value.chr
256
+ else
257
+ data = integer_to_octets(value)
258
+ if value > 0 && data[0].ord > 0x7f
259
+ data = "\000" << data
260
+ elsif value < 0 && data[0].ord < 0x80
261
+ data = "\377" << data
263
262
  end
264
- encode_tlv(tag, data)
263
+ end
264
+ encode_tlv(tag, data)
265
265
  end
266
-
266
+
267
267
  #
268
268
  # Helper method for encoding integer-like things.
269
269
  #
270
270
  def integer_to_octets(i)
271
- if i >= 0
272
- done = 0
273
- else
274
- done = -1
275
- end
276
- octets = ""
277
- begin
278
- octets = (i & 0xff).chr << octets
279
- i = i >> 8
280
- end until i == done
281
- octets
271
+ if i >= 0
272
+ done = 0
273
+ else
274
+ done = -1
275
+ end
276
+ octets = ""
277
+ begin
278
+ octets = (i & 0xff).chr << octets
279
+ i = i >> 8
280
+ end until i == done
281
+ octets
282
282
  end
283
-
283
+
284
284
  def encode_null
285
- NULL_TAG.chr << "\000"
285
+ NULL_TAG.chr << "\000"
286
286
  end
287
-
287
+
288
288
  #
289
289
  # Encode an exception. The encoding is simply the exception tag with
290
290
  # no data, similar to NULL.
291
291
  #
292
292
  def encode_exception(tag)
293
- tag.chr << "\000"
293
+ tag.chr << "\000"
294
294
  end
295
-
295
+
296
296
  #
297
297
  # Wraps value in a tag and length. This method expects an
298
298
  # integer tag and a string value.
299
299
  #
300
300
  def encode_tlv(tag, value)
301
- data = tag.chr << encode_length(value.length)
302
- data = data << value if value.length > 0
303
- data
301
+ data = tag.chr << encode_length(value.length)
302
+ data = data << value if value.length > 0
303
+ data
304
304
  end
305
-
305
+
306
306
  #
307
307
  # Wrap string in a octet string tag and length.
308
308
  #
309
309
  def encode_octet_string(value)
310
- encode_tlv(OCTET_STRING_TAG, value)
310
+ encode_tlv(OCTET_STRING_TAG, value)
311
311
  end
312
-
312
+
313
313
  #
314
314
  # Wrap value in a sequence tag and length.
315
315
  #
316
316
  def encode_sequence(value)
317
- encode_tlv(SEQUENCE_TAG, value)
317
+ encode_tlv(SEQUENCE_TAG, value)
318
318
  end
319
-
319
+
320
320
  #
321
321
  # Encode an object id. The input is assumed to be an array of integers
322
322
  # representing the object id.
323
323
  #
324
324
  def encode_object_id(value)
325
- raise InvalidObjectId, value.to_s if value.length < 1
326
- raise InvalidObjectId, value.to_s if value[0] > 2
327
- data = ""
328
- if (value.length > 1)
329
- raise InvalidObjectId if value[0] < 2 && value[1] > 40
330
- data << (40 * value[0] + value[1]).chr
331
- for i in 2...value.length
332
- if value[i] < 0x80
333
- data << value[i].chr
334
- else
335
- octets = ""
336
- n = value[i]
337
- begin
338
- octets = (n & 0x7f | 0x80).chr << octets
339
- n = n >> 7
340
- end until n == 0
341
- octets[-1] = (octets[-1].ord & 0x7f).chr
342
- data << octets
343
- end
344
- end
345
- elsif (value.length == 1)
346
- data << (40 * value[0]).chr
325
+ raise InvalidObjectId, value.to_s if value.length < 1
326
+ raise InvalidObjectId, value.to_s if value[0] > 2
327
+ data = ""
328
+ if (value.length > 1)
329
+ raise InvalidObjectId if value[0] < 2 && value[1] > 40
330
+ data << (40 * value[0] + value[1]).chr
331
+ for i in 2...value.length
332
+ if value[i] < 0x80
333
+ data << value[i].chr
334
+ else
335
+ octets = ""
336
+ n = value[i]
337
+ begin
338
+ octets = (n & 0x7f | 0x80).chr << octets
339
+ n = n >> 7
340
+ end until n == 0
341
+ octets[-1] = (octets[-1].ord & 0x7f).chr
342
+ data << octets
343
+ end
347
344
  end
348
- encode_tlv(OBJECT_IDENTIFIER_TAG, data)
345
+ elsif (value.length == 1)
346
+ data << (40 * value[0]).chr
347
+ end
348
+ encode_tlv(OBJECT_IDENTIFIER_TAG, data)
349
349
  end
350
-
351
- end
352
- end
353
350
 
351
+ end
352
+ end