Class: VSphereAutomation::Appliance::MonitoringApi

Inherits:
Object
  • Object
show all
Defined in:
lib/vsphere-automation-appliance/api/monitoring_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ MonitoringApi

Returns a new instance of MonitoringApi.



16
17
18
# File 'lib/vsphere-automation-appliance/api/monitoring_api.rb', line 16

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



14
15
16
# File 'lib/vsphere-automation-appliance/api/monitoring_api.rb', line 14

def api_client
  @api_client
end

Instance Method Details

#get(stat_id, opts = {}) ⇒ ApplianceMonitoringResult|VapiStdErrorsErrorError|

Get monitored item info

Parameters:

  • stat_id

    statistic item id

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

    the optional parameters

Returns:



23
24
25
26
# File 'lib/vsphere-automation-appliance/api/monitoring_api.rb', line 23

def get(stat_id, opts = {})
  data, _status_code, _headers = get_with_http_info(stat_id, opts)
  data
end

#get_with_http_info(stat_id, opts = {}) ⇒ Array<(ApplianceMonitoringResult|VapiStdErrorsErrorError|, Fixnum, Hash)>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Get monitored item info

Parameters:

  • stat_id

    statistic item id

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

    the optional parameters

Returns:



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/vsphere-automation-appliance/api/monitoring_api.rb', line 33

def get_with_http_info(stat_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MonitoringApi.get ...'
  end
  # verify the required parameter 'stat_id' is set
  if @api_client.config.client_side_validation && stat_id.nil?
    fail ArgumentError, "Missing the required parameter 'stat_id' when calling MonitoringApi.get"
  end
  # resource path
  local_var_path = '/appliance/monitoring/{stat_id}'.sub('{' + 'stat_id' + '}', stat_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['api_key']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
	:return_type => {
	  '200' => 'Appliance::ApplianceMonitoringResult',
	  '400' => 'Appliance::VapiStdErrorsErrorError',
	})
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MonitoringApi#get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list(opts = {}) ⇒ ApplianceMonitoringListResult|VapiStdErrorsErrorError|

Get monitored items list

Parameters:

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

    the optional parameters

Returns:



76
77
78
79
# File 'lib/vsphere-automation-appliance/api/monitoring_api.rb', line 76

def list(opts = {})
  data, _status_code, _headers = list_with_http_info(opts)
  data
end

#list_with_http_info(opts = {}) ⇒ Array<(ApplianceMonitoringListResult|VapiStdErrorsErrorError|, Fixnum, Hash)>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Get monitored items list

Parameters:

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

    the optional parameters

Returns:



85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/vsphere-automation-appliance/api/monitoring_api.rb', line 85

def list_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MonitoringApi.list ...'
  end
  # resource path
  local_var_path = '/appliance/monitoring'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['api_key']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
	:return_type => {
	  '200' => 'Appliance::ApplianceMonitoringListResult',
	  '400' => 'Appliance::VapiStdErrorsErrorError',
	})
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MonitoringApi#list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#query(item_names, item_interval, item_function, item_start_time, item_end_time, opts = {}) ⇒ ApplianceMonitoringQueryResult|VapiStdErrorsErrorError|

Get monitoring data.

Parameters:

  • item_names

    monitored item IDs Ex: CPU, MEMORY

  • item_interval (@name IntervalType)

    enumerated type Defines interval between the values in hours and mins, for which aggregation will apply

  • item_function (@name FunctionType)

    enumerated type Defines aggregation function

  • item_start_time

    Start time in UTC

  • item_end_time

    End time in UTC

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

    the optional parameters

Returns:



129
130
131
132
# File 'lib/vsphere-automation-appliance/api/monitoring_api.rb', line 129

def query(item_names, item_interval, item_function, item_start_time, item_end_time, opts = {})
  data, _status_code, _headers = query_with_http_info(item_names, item_interval, item_function, item_start_time, item_end_time, opts)
  data
end

#query_with_http_info(item_names, item_interval, item_function, item_start_time, item_end_time, opts = {}) ⇒ Array<(ApplianceMonitoringQueryResult|VapiStdErrorsErrorError|, Fixnum, Hash)>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Get monitoring data.

Parameters:

  • item_names

    monitored item IDs Ex: CPU, MEMORY

  • item_interval (@name IntervalType)

    enumerated type Defines interval between the values in hours and mins, for which aggregation will apply

  • item_function (@name FunctionType)

    enumerated type Defines aggregation function

  • item_start_time

    Start time in UTC

  • item_end_time

    End time in UTC

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

    the optional parameters

Returns:



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
# File 'lib/vsphere-automation-appliance/api/monitoring_api.rb', line 143

def query_with_http_info(item_names, item_interval, item_function, item_start_time, item_end_time, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MonitoringApi.query ...'
  end
  # verify the required parameter 'item_names' is set
  if @api_client.config.client_side_validation && item_names.nil?
    fail ArgumentError, "Missing the required parameter 'item_names' when calling MonitoringApi.query"
  end
  # verify the required parameter 'item_interval' is set
  if @api_client.config.client_side_validation && item_interval.nil?
    fail ArgumentError, "Missing the required parameter 'item_interval' when calling MonitoringApi.query"
  end
  # verify enum value
  if @api_client.config.client_side_validation && !['MINUTES30', 'HOURS2', 'MINUTES5', 'DAY1', 'HOURS6'].include?(item_interval)
    fail ArgumentError, "invalid value for 'item_interval', must be one of MINUTES30, HOURS2, MINUTES5, DAY1, HOURS6"
  end
  # verify the required parameter 'item_function' is set
  if @api_client.config.client_side_validation && item_function.nil?
    fail ArgumentError, "Missing the required parameter 'item_function' when calling MonitoringApi.query"
  end
  # verify enum value
  if @api_client.config.client_side_validation && !['COUNT', 'MAX', 'AVG', 'MIN'].include?(item_function)
    fail ArgumentError, "invalid value for 'item_function', must be one of COUNT, MAX, AVG, MIN"
  end
  # verify the required parameter 'item_start_time' is set
  if @api_client.config.client_side_validation && item_start_time.nil?
    fail ArgumentError, "Missing the required parameter 'item_start_time' when calling MonitoringApi.query"
  end
  # verify the required parameter 'item_end_time' is set
  if @api_client.config.client_side_validation && item_end_time.nil?
    fail ArgumentError, "Missing the required parameter 'item_end_time' when calling MonitoringApi.query"
  end
  # resource path
  local_var_path = '/appliance/monitoring/query'

  # query parameters
  query_params = {}
  query_params[:'item.names'] = @api_client.build_collection_param(item_names, :multi)
  query_params[:'item.interval'] = item_interval
  query_params[:'item.function'] = item_function
  query_params[:'item.start_time'] = item_start_time
  query_params[:'item.end_time'] = item_end_time

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['api_key']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
	:return_type => {
	  '200' => 'Appliance::ApplianceMonitoringQueryResult',
	  '400' => 'Appliance::VapiStdErrorsErrorError',
	})
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MonitoringApi#query\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end