Sloth::Snmp is yet another wrapper library for snmp.
Features
-
Handles SNMP asynchronously.
-
By referring to the YAML file generated from the MIB file, you can operate without describing raw OID.
Installation
Add this line to your application’s Gemfile:
gem 'sloth/snmp'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install sloth-snmp
or
$ gem install -l sloth-snmp-x.x.x.gem
Usage
New
Get
Set
Walk
Reference
Create a new Sloth::Snmp.
-
Result:
-
Sloth::Snmp object.
-
-
Parameter:
-
mibs: Additional MIB file path, or array of the paths. (default: nil)
-
bind: Bind host and port for trap. (default: "0.0.0.0:162")
-
rocommunity: Community string for Read Only. (default: "public")
-
rwcommunity: Community string for Read/Write. (default: "private")
-
SNMP Get.
-
Result:
-
Hash of key⇒oid, value⇒value.
-
Parameter:
-
peer: Target IP address and port. (default port: 162)
-
topics: Topic(s) for SNMP Get Request.
-
community: Community string. (default: nil)
-
bindto: Interface address. (default: nil)
-
device: Interface name. (default: nil)
-
SNMP Set.
-
Result:
-
Hash of key⇒oid, value⇒value.
-
Parameter:
-
peer: Target IP address and port. (default port: 162)
-
tuple: Hash of topic, type, value for SNMP Set Request.
-
community: Community string. (default: nil)
-
bindto: Interface address. (default: nil)
-
device: Interface name. (default: nil)
-
SNMP Walk.
-
Result:
-
Hash of key⇒oid, value⇒value.
-
-
Parameter:
-
peer: Target IP address and port. (default port: 162)
-
topic: Topic for SNMP Get Next.
-
community: Community string. (default: nil)
-
bindto: Interface address. (default: nil)
-
device: Interface name. (default: nil)
-
SNMP Trap.
-
Result:
-
nil.
-
-
Parameter:
-
topics: The topic(s) that enables trap monitoring.
-
block: Callback action.
-
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/arimay/sloth-snmp.
License
The gem is available as open source under the terms of the MIT License.
Copyright (c) ARIMA Yasuhiro <[email protected]>