tokio.connectors.collectd_es module

Retrieve data generated by collectd and stored in Elasticsearch

class tokio.connectors.collectd_es.CollectdEs(*args, **kwargs)[source]

Bases: tokio.connectors.es.EsConnection

collectd-Elasticsearch connection handler

classmethod from_cache(*args, **kwargs)[source]

Initializes an EsConnection object from a cache file.

This path is designed to be used for testing.

Parameters:cache_file (str) – Path to the JSON formatted list of pages
query_cpu(start, end)[source]

Query Elasticsearch for collectd cpu plugin data.

Parameters:
query_disk(start, end)[source]

Query Elasticsearch for collectd disk plugin data.

Parameters:
query_memory(start, end)[source]

Query Elasticsearch for collectd memory plugin data.

Parameters:
query_timeseries(query_template, start, end, source_filter=None, filter_function=None, flush_every=None, flush_function=None)[source]

Map connection-wide attributes to super(self).query_timeseries arguments

Parameters:
  • query_template (dict) – a query object containing at least one @timestamp field
  • start (datetime.datetime) – lower bound for query (inclusive)
  • end (datetime.datetime) – upper bound for query (exclusive)
  • source_filter (bool or list) – Return all fields contained in each document’s _source field if True; otherwise, only return source fields contained in the provided list of str. If None, use the default for this connector.
  • filter_function (function, optional) – Function to call before each set of results is appended to the scroll_pages attribute; if specified, return value of this function is what is appended. If None, use the default for this connector.
  • flush_every (int or None) – trigger the flush function once the number of docs contained across all scroll_pages reaches this value. If None, do not apply flush_function. If None, use the default for this connector.
  • flush_function (function, optional) – function to call when flush_every docs are retrieved. If None, use the default for this connector.
to_dataframe()[source]

Converts self.scroll_pages to a DataFrame

Returns:Contents of the last query’s pages
Return type:pandas.DataFrame