Module: NetApp::Query
- Included in:
- NetApp
- Defined in:
- lib/netapp/query.rb
Constant Summary collapse
- BASE_VOL_OID =
"1.3.6.1.4.1.789.1.5.4.1"
Instance Method Summary collapse
Instance Method Details
#fetch(oids) ⇒ Object
40 41 42 43 44 45 |
# File 'lib/netapp/query.rb', line 40 def fetch(oids) reply = Array.new SNMP::Manager.open(:host => self.host) do |manager| reply = manager.get(oids).each_varbind.map { |vb| vb.value.to_s } end end |
#fetch_vol(name) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/netapp/query.rb', line 8 def fetch_vol(name) results = Hash.new self.fetch_vols.each do |vol_num, vol_name| if vol_name.include? name results.merge!({ :name => name }) details = [ BASE_VOL_OID + ".30" +".#{vol_num}", BASE_VOL_OID + ".31" +".#{vol_num}", BASE_VOL_OID + ".29" +".#{vol_num}" ] results.merge!({ :used => self.fetch(details)[0].to_i }) results.merge!({ :free => self.fetch(details)[1].to_i }) results.merge!({ :total => self.fetch(details)[2].to_i }) break end end results end |
#fetch_vols ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/netapp/query.rb', line 28 def fetch_vols vols = Hash.new i = 1 SNMP::Manager.open(:host => self.host) do |manager| manager.walk(BASE_VOL_OID + ".2") do |name| vols.merge!({ i => name.value}) i += 1 end end vols end |