temelio_monitoring.utils package

Submodules

temelio_monitoring.utils.context_utils module

Manage utils methods to use in context classes

class temelio_monitoring.utils.context_utils.ContextUtils[source]

Bases: object

Utils methods to use in context classes

static check_size(data, min_size, max_size)[source]

Check if data contains only one element

Useful for xxxValueFromJSON context classes

Parameters:
  • data (list|str|dict|tuple) – Data to validate
  • min_size (int) – Min size of tested element
  • max_size (int) – Max size of tested element
Returns:

Empty string if check is OK, else error message

Return type:

str

static manage_value_from_json(metric_value)[source]

Manage single value expectation in metric from JSON data

Parameters:metric_value (list) – Metric value
Returns:Extracted value from JSON path result
Return type:string|int
static manage_values_from_json(metric_values)[source]

Manage multiple values in metric from JSON data

Parameters:metric_values (list) – Metric values
Returns:Extracted values from JSON path result
Return type:list
static replace_metric_value(metric, new_value)[source]

Create new metric with value parameter

Parameters:metric (nagiosplugin.Metric) – Metric value
Returns:New metric with extracted values from JSON path result
Return type:nagiosplugin.Metric

temelio_monitoring.utils.operator_utils module

This module manage utils functions for operator module

class temelio_monitoring.utils.operator_utils.OperatorUtils[source]

Bases: object

This is the utils class for operator module

static get_operator(operator_str)[source]

Return needed operator if managed

Parameters:operator_str (str) – Operator string representation
Returns:Operator function
Return type:function

temelio_monitoring.utils.requests_utils module

This module manage utils functions for requests module

class temelio_monitoring.utils.requests_utils.RequestsUtils[source]

Bases: object

This is the utils class for request module

static get(url='', username='', password='', certificate_file='', key_file='')[source]

Do a get request, with error management

Parameters:
  • url (string) – target URL
  • username (string) – Username authorized to view stats
  • password (string) – Password of username authorized to view stats
Returns:

Response object

Return type:

requests.Response

Module contents

Manage utils class import