| 217 | === SNMP (8/13) === |
| 218 | For a explanation of SNMP: http://en.wikipedia.org/wiki/Simple_Network_Management_Protocol [[BR]] |
| 219 | In the IP8800 guide: http://www.nec.co.jp/ip88n/s36_sw/html/cfguide2/index.html [[BR]] |
| 220 | MIB references: http://www.alvestrand.no/objectid/ |
| 221 | ==== Configuring the IP8800 ==== |
| 222 | Use of SNMP (Simple Network Management Protocol) is not set by default; you must create access lists with IP addresses allowed to request information as a manager device. In this case, an ACL is created for all the interfaces of SB9, eth1: |
| 223 | {{{ |
| 224 | !sw-sb09(config)# access-list 1 permit 10.19.0.10 0.0.0.0 |
| 225 | !sw-sb09(config)# access-list 1 permit 192.168.100.28 0.0.0.0 |
| 226 | !sw-sb09(config)# access-list 1 permit 192.168.1.28 0.0.0.0 |
| 227 | !sw-sb09(config)# access-list 1 permit 172.16.100.1 0.0.0.0 |
| 228 | !sw-sb09(config)# sh access-list |
| 229 | access-list 1 10 permit host 10.19.0.10 |
| 230 | access-list 1 20 permit host 192.168.100.28 |
| 231 | access-list 1 30 permit host 192.168.1.28 |
| 232 | access-list 1 40 permit host 172.16.100.1 |
| 233 | }}} |
| 234 | |
| 235 | to include it in the snmp access list, use the following command: |
| 236 | {{{ |
| 237 | sw-sb09(config)# snmp-server community "NET" ro 1 |
| 238 | }}} |
| 239 | where "NET" is the group name, "ro" is read-only, and "1" is the access list allowed. |
| 240 | |
| 241 | ==== Accessing MIBs on the IP8800 ==== |
| 242 | accessing it through the switch itsself is easy enough: |
| 243 | {{{ |
| 244 | sw-sb09# snmp walk 1.3.6.1.2.1.1 |
| 245 | |
| 246 | Name: sysDescr.0 |
| 247 | Value: ALAXALA AX3640S AX-3640-48T2XW-L [AX3640S-48T2XW] Switching software Ver. |
| 248 | 10.7 [OS-L3L] |
| 249 | |
| 250 | Name: sysObjectID.0 |
| 251 | Value: ax3640s |
| 252 | |
| 253 | Name: sysUpTime.0 |
| 254 | Value: 25724205 |
| 255 | |
| 256 | Name: sysContact.0 |
| 257 | Value: |
| 258 | |
| 259 | Name: sysName.0 |
| 260 | Value: sw-sb09 |
| 261 | |
| 262 | Name: sysLocation.0 |
| 263 | Value: |
| 264 | |
| 265 | Name: sysServices.0 |
| 266 | Value: 78 |
| 267 | }}} |
| 268 | |
| 269 | ==== From a manager device - snmpwalk ==== |
| 270 | with snmpwalk from SB9: |
| 271 | {{{ |
| 272 | root@sb9:~# snmpwalk -v 2c -c NET 172.16.100.10 1.3.6.1.2.1.1 |
| 273 | }}} |
| 274 | {{{ |
| 275 | SNMPv2-MIB::sysDescr.0 = STRING: ALAXALA AX3640S AX-3640-48T2XW-L [AX3640S-48T2XW] Switching software Ver. 10.7 [OS-L3L] |
| 276 | SNMPv2-MIB::sysObjectID.0 = OID: SNMPv2-SMI::enterprises.21839.1.2.11 |
| 277 | DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (26201570) 3 days, 0:46:55.70 |
| 278 | SNMPv2-MIB::sysContact.0 = STRING: |
| 279 | SNMPv2-MIB::sysName.0 = STRING: sw-sb09 |
| 280 | SNMPv2-MIB::sysLocation.0 = STRING: |
| 281 | SNMPv2-MIB::sysServices.0 = INTEGER: 78 |
| 282 | }}} |
| 283 | ==== Using Ruby scripts ==== |
| 284 | libsnmp reference: http://snmplib.rubyforge.org/doc/index.html |
| 285 | |
| 286 | Ruby has libsnmp-ruby, a library for SNMP, available. SB9 didn't come with it, so it was installed: |
| 287 | {{{ |
| 288 | apt-get install libsnmp-ruby |
| 289 | }}} |
| 290 | A messy irb test of the library: |
| 291 | {{{ |
| 292 | irb(main):002:0> require 'snmp' |
| 293 | irb(main):004:0> agent_hostname = "172.16.100.10" |
| 294 | => "172.16.100.10" |
| 295 | irb(main):005:0> agent_comm = "NET" |
| 296 | => "NET" |
| 297 | irb(main):007:0> s = SNMP::Manager.new(:Host => agent_hostname, :Community =>agent_comm, :Port => 161) |
| 298 | => #<SNMP::Manager:0xb79d5d98 @snmp_version=:SNMPv2c, @port=161, @transport=#<SNMP::UDPTransport:0xb79d5d5c @socket=#<UDPSocket:0xb79d5d34>>, @write_community="NET", @host="172.16.100.10", @retries=5, @community="NET", @mib=#<SNMP ... #this goes on for a while |
| 299 | irb(main):009:0> response = s.get(["1.3.6.1.2.1.1.1.0"]) |
| 300 | => #<SNMP::Response:0xb79c2d10 @error_index=0, @error_status=0, @request_id=856260869, @varbind_list=[#<SNMP::VarBind:0xb79c2900 @value="ALAXALA AX3640S AX-3640-48T2XW-L [AX3640S-48T2XW] Switching software Ver. 10.7 [OS-L3L]", @name=[1.3.6.1.2.1.1.1.0]>]> |
| 301 | irb(main):035:0> rstring = "#{response.varbind_list.to_s}" |
| 302 | => "[name=1.3.6.1.2.1.1.1.0, value=ALAXALA AX3640S AX-3640-48T2XW-L [AX3640S-48T2XW] Switching software Ver. 10.7 [OS-L3L] (OCTET STRING)]" |
| 303 | }}} |
| 304 | |