Class: NetApp

Inherits:
Object
  • Object
show all
Includes:
Query
Defined in:
lib/netapp.rb,
lib/netapp/query.rb,
lib/netapp/volume.rb

Defined Under Namespace

Modules: Query Classes: Volume

Constant Summary

Constants included from Query

Query::BASE_VOL_OID

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Query

#fetch, #fetch_vol, #fetch_vols

Constructor Details

#initialize(host, community = "public", options = {}) ⇒ NetApp

Returns a new instance of NetApp.



10
11
12
13
14
# File 'lib/netapp.rb', line 10

def initialize(host, community = "public", options = {})
  @host = host
  @community = community
  @options = options 
end

Instance Attribute Details

#communityObject

Returns the value of attribute community.



9
10
11
# File 'lib/netapp.rb', line 9

def community
  @community
end

#hostObject

Returns the value of attribute host.



9
10
11
# File 'lib/netapp.rb', line 9

def host
  @host
end

#optionsObject

Returns the value of attribute options.



9
10
11
# File 'lib/netapp.rb', line 9

def options
  @options
end

Instance Method Details

#cache_ageObject



49
50
51
# File 'lib/netapp.rb', line 49

def cache_age
  fetch(["1.3.6.1.4.1.789.1.2.2.23.0"]).pop.to_i
end

#failed_disksObject



33
34
35
# File 'lib/netapp.rb', line 33

def failed_disks
  fetch(["1.3.6.1.4.1.789.1.6.4.7.0"]).pop.to_i
end

#failed_disks?Boolean

Returns:

  • (Boolean)


25
26
27
28
29
30
31
# File 'lib/netapp.rb', line 25

def failed_disks?
  if failed_disks == 0
    false 
  else
    true 
  end
end

#failed_power_suppliesObject



37
38
39
# File 'lib/netapp.rb', line 37

def failed_power_supplies
  fetch(["1.3.6.1.4.1.789.1.2.4.4.0"]).pop.to_i
end

#failed_power_supply?Boolean

Returns:

  • (Boolean)


41
42
43
44
45
46
47
# File 'lib/netapp.rb', line 41

def failed_power_supply?
  if failed_power_supplies == 0
    false
  else
    true
  end
end

#nvram_battery_statusObject



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/netapp.rb', line 65

def nvram_battery_status
  case fetch(["1.3.6.1.4.1.789.1.2.5.1.0"]).pop.to_i
  when 1 
    "ok"
  when 2 
    "partially discharged"
  when 3 
    "fully discharged"
  when 4 
    "not present"
  when 5
    "near end of life"
  when 6
    "at end of life"
  else
    "unknown"
  end
end

#over_temperature?Boolean

Returns:

  • (Boolean)


57
58
59
60
61
62
63
# File 'lib/netapp.rb', line 57

def over_temperature?
  if fetch(["1.3.6.1.4.1.789.1.2.4.1.0"]).pop.to_i == 1
    false
  else
    true
  end 
end

#uptimeObject



53
54
55
# File 'lib/netapp.rb', line 53

def uptime
  fetch(["1.3.6.1.2.1.1.3.0"]).pop[/[0-9]+ days/]
end

#volume(vol) ⇒ Object



16
17
18
19
# File 'lib/netapp.rb', line 16

def volume(vol)
  recieved = fetch_vol(vol)
  NetApp::Volume.new(recieved[:name], recieved[:used], recieved[:free], recieved[:total])
end

#volumesObject



21
22
23
# File 'lib/netapp.rb', line 21

def volumes
  fetch_vols.values
end