Class: OCI::Opsi::Models::HostMemoryUsage

Inherits:
HostPerformanceMetricGroup show all
Defined in:
lib/oci/opsi/models/host_memory_usage.rb

Overview

Memory usage metric for the host

Constant Summary

Constants inherited from HostPerformanceMetricGroup

OCI::Opsi::Models::HostPerformanceMetricGroup::METRIC_NAME_ENUM

Instance Attribute Summary collapse

Attributes inherited from HostPerformanceMetricGroup

#metric_name, #time_collected

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from HostPerformanceMetricGroup

get_subtype

Constructor Details

#initialize(attributes = {}) ⇒ HostMemoryUsage

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash

Options Hash (attributes):



138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
# File 'lib/oci/opsi/models/host_memory_usage.rb', line 138

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  attributes['metricName'] = 'HOST_MEMORY_USAGE'

  super(attributes)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  self.memory_used_in_gb = attributes[:'memoryUsedInGB'] if attributes[:'memoryUsedInGB']

  raise 'You cannot provide both :memoryUsedInGB and :memory_used_in_gb' if attributes.key?(:'memoryUsedInGB') && attributes.key?(:'memory_used_in_gb')

  self.memory_used_in_gb = attributes[:'memory_used_in_gb'] if attributes[:'memory_used_in_gb']

  self.memory_utilization_in_percent = attributes[:'memoryUtilizationInPercent'] if attributes[:'memoryUtilizationInPercent']

  raise 'You cannot provide both :memoryUtilizationInPercent and :memory_utilization_in_percent' if attributes.key?(:'memoryUtilizationInPercent') && attributes.key?(:'memory_utilization_in_percent')

  self.memory_utilization_in_percent = attributes[:'memory_utilization_in_percent'] if attributes[:'memory_utilization_in_percent']

  self.memory_load_in_gb = attributes[:'memoryLoadInGB'] if attributes[:'memoryLoadInGB']

  raise 'You cannot provide both :memoryLoadInGB and :memory_load_in_gb' if attributes.key?(:'memoryLoadInGB') && attributes.key?(:'memory_load_in_gb')

  self.memory_load_in_gb = attributes[:'memory_load_in_gb'] if attributes[:'memory_load_in_gb']

  self.real_memory_in_kb = attributes[:'realMemoryInKB'] if attributes[:'realMemoryInKB']

  raise 'You cannot provide both :realMemoryInKB and :real_memory_in_kb' if attributes.key?(:'realMemoryInKB') && attributes.key?(:'real_memory_in_kb')

  self.real_memory_in_kb = attributes[:'real_memory_in_kb'] if attributes[:'real_memory_in_kb']

  self.free_memory_in_kb = attributes[:'freeMemoryInKB'] if attributes[:'freeMemoryInKB']

  raise 'You cannot provide both :freeMemoryInKB and :free_memory_in_kb' if attributes.key?(:'freeMemoryInKB') && attributes.key?(:'free_memory_in_kb')

  self.free_memory_in_kb = attributes[:'free_memory_in_kb'] if attributes[:'free_memory_in_kb']

  self.logical_memory_used_in_gb = attributes[:'logicalMemoryUsedInGB'] if attributes[:'logicalMemoryUsedInGB']

  raise 'You cannot provide both :logicalMemoryUsedInGB and :logical_memory_used_in_gb' if attributes.key?(:'logicalMemoryUsedInGB') && attributes.key?(:'logical_memory_used_in_gb')

  self.logical_memory_used_in_gb = attributes[:'logical_memory_used_in_gb'] if attributes[:'logical_memory_used_in_gb']

  self.logical_memory_utilization_in_percent = attributes[:'logicalMemoryUtilizationInPercent'] if attributes[:'logicalMemoryUtilizationInPercent']

  raise 'You cannot provide both :logicalMemoryUtilizationInPercent and :logical_memory_utilization_in_percent' if attributes.key?(:'logicalMemoryUtilizationInPercent') && attributes.key?(:'logical_memory_utilization_in_percent')

  self.logical_memory_utilization_in_percent = attributes[:'logical_memory_utilization_in_percent'] if attributes[:'logical_memory_utilization_in_percent']

  self.free_logical_memory_in_kb = attributes[:'freeLogicalMemoryInKB'] if attributes[:'freeLogicalMemoryInKB']

  raise 'You cannot provide both :freeLogicalMemoryInKB and :free_logical_memory_in_kb' if attributes.key?(:'freeLogicalMemoryInKB') && attributes.key?(:'free_logical_memory_in_kb')

  self.free_logical_memory_in_kb = attributes[:'free_logical_memory_in_kb'] if attributes[:'free_logical_memory_in_kb']

  self.major_page_faults = attributes[:'majorPageFaults'] if attributes[:'majorPageFaults']

  raise 'You cannot provide both :majorPageFaults and :major_page_faults' if attributes.key?(:'majorPageFaults') && attributes.key?(:'major_page_faults')

  self.major_page_faults = attributes[:'major_page_faults'] if attributes[:'major_page_faults']

  self.swap_free_in_kb = attributes[:'swapFreeInKB'] if attributes[:'swapFreeInKB']

  raise 'You cannot provide both :swapFreeInKB and :swap_free_in_kb' if attributes.key?(:'swapFreeInKB') && attributes.key?(:'swap_free_in_kb')

  self.swap_free_in_kb = attributes[:'swap_free_in_kb'] if attributes[:'swap_free_in_kb']

  self.anon_huge_pages_in_kb = attributes[:'anonHugePagesInKB'] if attributes[:'anonHugePagesInKB']

  raise 'You cannot provide both :anonHugePagesInKB and :anon_huge_pages_in_kb' if attributes.key?(:'anonHugePagesInKB') && attributes.key?(:'anon_huge_pages_in_kb')

  self.anon_huge_pages_in_kb = attributes[:'anon_huge_pages_in_kb'] if attributes[:'anon_huge_pages_in_kb']

  self.huge_pages_free = attributes[:'hugePagesFree'] if attributes[:'hugePagesFree']

  raise 'You cannot provide both :hugePagesFree and :huge_pages_free' if attributes.key?(:'hugePagesFree') && attributes.key?(:'huge_pages_free')

  self.huge_pages_free = attributes[:'huge_pages_free'] if attributes[:'huge_pages_free']

  self.huge_pages_reserved = attributes[:'hugePagesReserved'] if attributes[:'hugePagesReserved']

  raise 'You cannot provide both :hugePagesReserved and :huge_pages_reserved' if attributes.key?(:'hugePagesReserved') && attributes.key?(:'huge_pages_reserved')

  self.huge_pages_reserved = attributes[:'huge_pages_reserved'] if attributes[:'huge_pages_reserved']

  self.huge_pages_surplus = attributes[:'hugePagesSurplus'] if attributes[:'hugePagesSurplus']

  raise 'You cannot provide both :hugePagesSurplus and :huge_pages_surplus' if attributes.key?(:'hugePagesSurplus') && attributes.key?(:'huge_pages_surplus')

  self.huge_pages_surplus = attributes[:'huge_pages_surplus'] if attributes[:'huge_pages_surplus']
end

Instance Attribute Details

#anon_huge_pages_in_kbFloat

Amount of memory used for anon huge pages in kilobytes

Returns:

  • (Float)


55
56
57
# File 'lib/oci/opsi/models/host_memory_usage.rb', line 55

def anon_huge_pages_in_kb
  @anon_huge_pages_in_kb
end

#free_logical_memory_in_kbFloat

Amount of avaiable virtual memory in kilobytes

Returns:

  • (Float)


43
44
45
# File 'lib/oci/opsi/models/host_memory_usage.rb', line 43

def free_logical_memory_in_kb
  @free_logical_memory_in_kb
end

#free_memory_in_kbFloat

Amount of available physical memory in kilobytes

Returns:

  • (Float)


31
32
33
# File 'lib/oci/opsi/models/host_memory_usage.rb', line 31

def free_memory_in_kb
  @free_memory_in_kb
end

#huge_pages_freeInteger

Number of available huge pages

Returns:

  • (Integer)


59
60
61
# File 'lib/oci/opsi/models/host_memory_usage.rb', line 59

def huge_pages_free
  @huge_pages_free
end

#huge_pages_reservedInteger

Number of reserved huge pages

Returns:

  • (Integer)


63
64
65
# File 'lib/oci/opsi/models/host_memory_usage.rb', line 63

def huge_pages_reserved
  @huge_pages_reserved
end

#huge_pages_surplusInteger

Number of surplus huge pages

Returns:

  • (Integer)


67
68
69
# File 'lib/oci/opsi/models/host_memory_usage.rb', line 67

def huge_pages_surplus
  @huge_pages_surplus
end

#logical_memory_used_in_gbFloat

Memory used excluding buffers and cache in gigabytes

Returns:

  • (Float)


35
36
37
# File 'lib/oci/opsi/models/host_memory_usage.rb', line 35

def logical_memory_used_in_gb
  @logical_memory_used_in_gb
end

#logical_memory_utilization_in_percentFloat

Amount of logical memory used in percentage

Returns:

  • (Float)


39
40
41
# File 'lib/oci/opsi/models/host_memory_usage.rb', line 39

def logical_memory_utilization_in_percent
  @logical_memory_utilization_in_percent
end

#major_page_faultsInteger

Number of major page faults

Returns:

  • (Integer)


47
48
49
# File 'lib/oci/opsi/models/host_memory_usage.rb', line 47

def major_page_faults
  @major_page_faults
end

#memory_load_in_gbFloat

Load on memory in gigabytes

Returns:

  • (Float)


23
24
25
# File 'lib/oci/opsi/models/host_memory_usage.rb', line 23

def memory_load_in_gb
  @memory_load_in_gb
end

#memory_used_in_gbFloat

Amount of physical memory used in gigabytes

Returns:

  • (Float)


15
16
17
# File 'lib/oci/opsi/models/host_memory_usage.rb', line 15

def memory_used_in_gb
  @memory_used_in_gb
end

#memory_utilization_in_percentFloat

Amount of physical memory used in percentage

Returns:

  • (Float)


19
20
21
# File 'lib/oci/opsi/models/host_memory_usage.rb', line 19

def memory_utilization_in_percent
  @memory_utilization_in_percent
end

#real_memory_in_kbFloat

Amount of usable physical memory in kilobytes

Returns:

  • (Float)


27
28
29
# File 'lib/oci/opsi/models/host_memory_usage.rb', line 27

def real_memory_in_kb
  @real_memory_in_kb
end

#swap_free_in_kbFloat

Amount of available swap space in kilobytes

Returns:

  • (Float)


51
52
53
# File 'lib/oci/opsi/models/host_memory_usage.rb', line 51

def swap_free_in_kb
  @swap_free_in_kb
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/oci/opsi/models/host_memory_usage.rb', line 70

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'metric_name': :'metricName',
    'time_collected': :'timeCollected',
    'memory_used_in_gb': :'memoryUsedInGB',
    'memory_utilization_in_percent': :'memoryUtilizationInPercent',
    'memory_load_in_gb': :'memoryLoadInGB',
    'real_memory_in_kb': :'realMemoryInKB',
    'free_memory_in_kb': :'freeMemoryInKB',
    'logical_memory_used_in_gb': :'logicalMemoryUsedInGB',
    'logical_memory_utilization_in_percent': :'logicalMemoryUtilizationInPercent',
    'free_logical_memory_in_kb': :'freeLogicalMemoryInKB',
    'major_page_faults': :'majorPageFaults',
    'swap_free_in_kb': :'swapFreeInKB',
    'anon_huge_pages_in_kb': :'anonHugePagesInKB',
    'huge_pages_free': :'hugePagesFree',
    'huge_pages_reserved': :'hugePagesReserved',
    'huge_pages_surplus': :'hugePagesSurplus'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/oci/opsi/models/host_memory_usage.rb', line 94

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'metric_name': :'String',
    'time_collected': :'DateTime',
    'memory_used_in_gb': :'Float',
    'memory_utilization_in_percent': :'Float',
    'memory_load_in_gb': :'Float',
    'real_memory_in_kb': :'Float',
    'free_memory_in_kb': :'Float',
    'logical_memory_used_in_gb': :'Float',
    'logical_memory_utilization_in_percent': :'Float',
    'free_logical_memory_in_kb': :'Float',
    'major_page_faults': :'Integer',
    'swap_free_in_kb': :'Float',
    'anon_huge_pages_in_kb': :'Float',
    'huge_pages_free': :'Integer',
    'huge_pages_reserved': :'Integer',
    'huge_pages_surplus': :'Integer'
    # rubocop:enable Style/SymbolLiteral
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • other (Object)

    the other object to be compared



240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
# File 'lib/oci/opsi/models/host_memory_usage.rb', line 240

def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    metric_name == other.metric_name &&
    time_collected == other.time_collected &&
    memory_used_in_gb == other.memory_used_in_gb &&
    memory_utilization_in_percent == other.memory_utilization_in_percent &&
    memory_load_in_gb == other.memory_load_in_gb &&
    real_memory_in_kb == other.real_memory_in_kb &&
    free_memory_in_kb == other.free_memory_in_kb &&
    logical_memory_used_in_gb == other.logical_memory_used_in_gb &&
    logical_memory_utilization_in_percent == other.logical_memory_utilization_in_percent &&
    free_logical_memory_in_kb == other.free_logical_memory_in_kb &&
    major_page_faults == other.major_page_faults &&
    swap_free_in_kb == other.swap_free_in_kb &&
    anon_huge_pages_in_kb == other.anon_huge_pages_in_kb &&
    huge_pages_free == other.huge_pages_free &&
    huge_pages_reserved == other.huge_pages_reserved &&
    huge_pages_surplus == other.huge_pages_surplus
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
# File 'lib/oci/opsi/models/host_memory_usage.rb', line 285

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)

  self.class.swagger_types.each_pair do |key, type|
    if type =~ /^Array<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        public_method("#{key}=").call(
          attributes[self.class.attribute_map[key]]
            .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
        )
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      public_method("#{key}=").call(
        OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
      )
    end
    # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(other) ⇒ Boolean

Parameters:

  • other (Object)

    the other object to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


265
266
267
# File 'lib/oci/opsi/models/host_memory_usage.rb', line 265

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



274
275
276
# File 'lib/oci/opsi/models/host_memory_usage.rb', line 274

def hash
  [metric_name, time_collected, memory_used_in_gb, memory_utilization_in_percent, memory_load_in_gb, real_memory_in_kb, free_memory_in_kb, logical_memory_used_in_gb, logical_memory_utilization_in_percent, free_logical_memory_in_kb, major_page_faults, swap_free_in_kb, anon_huge_pages_in_kb, huge_pages_free, huge_pages_reserved, huge_pages_surplus].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



318
319
320
321
322
323
324
325
326
327
# File 'lib/oci/opsi/models/host_memory_usage.rb', line 318

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = public_method(attr).call
    next if value.nil? && !instance_variable_defined?("@#{attr}")

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



312
313
314
# File 'lib/oci/opsi/models/host_memory_usage.rb', line 312

def to_s
  to_hash.to_s
end