14.2.4. Monitoring

14.2.4.1. Base class

class edumfa.lib.monitoringmodules.base.Monitoring(config=None)[source]
add_value(stats_key, stats_value, timestamp, reset_values=False)[source]

This method adds a measurement point to the statistics key “stats_key”. If reset_values is set to True, all old values of this stats_key are deleted.

Parameters:
  • stats_key – Identifier of the stats

  • stats_value – measured value

  • timestamp (timezone aware datetime) – the timestamp of the measurement

  • reset_values – boolean to indicate the reset

Returns:

None

delete(stats_key, start_timestamp, end_timestamp)[source]

Delete all entries of the stats_key for the given time frame. The start_timestamp and end_timestamp are also deleted.

Parameters:
  • stats_key – Identifier of the stats

  • start_timestamp (timezone aware datetime) – beginning of the time frame

  • end_timestamp (timezone aware datetime) – end of the time frame

Returns:

number of deleted entries

get_keys()[source]

Return a list of the available statistic keys.

Returns:

list of identifiers

get_last_value(stats_key)[source]

returns the last value of the given stats_key in time. :param stats_key: The identifier of the stats :return: a string value.

get_values(stats_key, start_timestamp=None, end_timestamp=None)[source]

Return a list of tuples of (timestamp, value) for the requested stats_key.

Parameters:
  • stats_key – Identifier of the stats

  • start_timestamp (timezone aware datetime) – start of the time frame

  • end_timestamp (timezone aware datetime) – end of the time frame

Returns:

14.2.4.2. SQL Statistics module

class edumfa.lib.monitoringmodules.sqlstats.Monitoring(config=None)[source]
add_value(stats_key, stats_value, timestamp, reset_values=False)[source]

This method adds a measurement point to the statistics key “stats_key”. If reset_values is set to True, all old values of this stats_key are deleted.

Parameters:
  • stats_key – Identifier of the stats

  • stats_value – measured value

  • timestamp (timezone aware datetime) – the timestamp of the measurement

  • reset_values – boolean to indicate the reset

Returns:

None

delete(stats_key, start_timestamp, end_timestamp)[source]

Delete all entries of the stats_key for the given time frame. The start_timestamp and end_timestamp are also deleted.

Parameters:
  • stats_key – Identifier of the stats

  • start_timestamp (timezone aware datetime) – beginning of the time frame

  • end_timestamp (timezone aware datetime) – end of the time frame

Returns:

number of deleted entries

get_keys()[source]

Return a list of all stored keys. :return:

get_last_value(stats_key)[source]

returns the last value of the given stats_key in time. :param stats_key: The identifier of the stats :return: a string value.

get_values(stats_key, start_timestamp=None, end_timestamp=None, date_strings=False)[source]

Return a list of tuples of (timestamp, value) for the requested stats_key.

Parameters:
  • stats_key – Identifier of the stats

  • start_timestamp (timezone aware datetime) – start of the time frame

  • end_timestamp (timezone aware datetime) – end of the time frame

Returns: