Read data from netdata rest api into a pandas dataframe.

get_chart_list[source]

get_chart_list(host:str='127.0.0.1:19999', starts_with:str=None, protocol:str='http')

Get list of all available charts on a host.

Parameters:
  • host str The host we want to get a list of available charts from.
  • starts_with str A string to filter the list of charts returns to just those that start with starts_with.
  • protocol str 'http' or 'https'.
Returns:
  • chart_list list A list of availalbe charts.

get_chart[source]

get_chart(api_call:str, data:list, col_sep:str='|', numeric_only:bool=True, float_size:str='float64', host_prefix:bool=False, host_sep:str=':')

Get data for an individual chart.

Parameters:
  • api_call tuple A tuple of (url,chart) for the url to pull data from and chart it represents.
  • data list A list for dataframes for each chart to be appended to.
  • col_sep str A character for separating chart and dimension in column names of dataframe.
  • numeric_only bool Set to true if you want to filter out any non numeric data.
  • float_size str float size to use if would like to save some memory, eg can use 'float32' or 'float16'.
  • host_prefix bool True to prefix each colname with the corresponding host.
  • host_sep str A character for separating host and chart and dimensions in column names of dataframe.

get_charts[source]

get_charts(api_calls:list, col_sep:str='|', timeout:int=60, numeric_only:bool=True, float_size:str='float64', host_prefix:bool=False, host_sep:str=':')

Create a nursey to make seperate async calls to get each chart.

Parameters:
  • api_calls list A list of tuple's of [(url,chart),...] of api calls that need to be made.
  • col_sep str A character for separating chart and dimension in column names of dataframe.
  • timeout int The number of seconds for trio to move_on_after.
  • numeric_only bool Set to true if you want to filter out any non numeric data.
  • float_size str float size to use if would like to save some memory, eg can use 'float32' or 'float16'.
  • host_prefix bool True to prefix each colname with the corresponding host.
  • host_sep str A character for separating host and chart and dimensions in column names of dataframe.
Returns:
  • df pd.DataFrame A pandas dataframe with all chart data outer joined based on time index.

get_data[source]

get_data(hosts:list=['london.my-netdata.io'], charts:list=['system.cpu'], after:int=-60, before:int=0, points:int=0, col_sep:str='|', numeric_only:bool=True, ffill:bool=True, diff:bool=False, timeout:int=60, nunique_thold=None, std_thold:float=None, index_as_datetime:bool=False, freq:str='infer', group:str='average', sort_cols:bool=True, user:str=None, pwd:str=None, protocol:str='http', sort_rows:bool=True, float_size:str='float64', host_charts_dict:dict=None, host_prefix:bool=False, host_sep:str=':', charts_regex:str=None)

Define api calls to make and any post processing to be done.

Parameters:
  • hosts list A list of hosts to pull data from.
  • charts list A list of charts to pull data for.
  • after int The timestamp or relative integer from which to pull data after.
  • before int The timestamp or relative integer from which to pull data before.
  • points int The points parameter to pass to the api call if need to aggregate data in some way.
  • col_sep str A character for separating chart and dimension in column names of dataframe.
  • numeric_only bool Set to true if you want to filter out any non numeric data.
  • ffill bool Set to true if you want to forward fill any null or missing values.
  • diff bool Set to true if you want to get the difference of metrics as opposed to their raw value.
  • timeout int The number of seconds for trio to move_on_after.
  • nunique_thold [float,int] If defined calls function to filter cols with low number of unique values.
  • std_thold float If defined calls function to filter cols with low standard deviation.
  • index_as_datetime bool If true, set the index to be a pandas datetime.
  • freq str Freq to be passed to pandas datetime index.
  • group str The grouping function to use in the netdata api call.
  • sort_cols bool True to sort columns by name.
  • user str A username to use if netdata is password protected.
  • pwd str A password to use if netdata is password protected.
  • protocol str 'http' or 'https'.
  • sort_rows bool True to sort rows by index.
  • float_size str float size to use if would like to save some memory, eg can use 'float32' or 'float16'.
  • host_charts_dict dict dictionary of hosts to pull for where each value is list of relevant charts to pull from that host.
  • host_prefix bool True to prefix each colname with the corresponding host.
  • host_sep str A character for separating host and chart and dimensions in column names of dataframe.
  • charts_regex str A regex expression for charts you want data for.
Returns:
  • df pd.DataFrame A pandas dataframe with all chart data outer joined based on time index and any post processing done.

get_alarm_log[source]

get_alarm_log(host:str='127.0.0.1:19999', datetimes:bool=True, user:str=None, pwd:str=None, protocol:str='http', include_children:bool=False)

Get alarm log from host.

Parameters:
  • host str The host we want to get the alarm log from.
  • user str A username to use if netdata is password protected.
  • pwd str A password to use if netdata is password protected.
  • protocol str 'http' or 'https'.
  • include_children bool 'True' to include alarm log for all children streamed to host.
Returns:
  • df pd.DataFrame A df of the alarm_log.

get_allmetrics[source]

get_allmetrics(host='london.my-netdata.io', charts:list=None, wide:bool=False, col_sep:str='|', sort_cols:bool=True, user:str=None, pwd:str=None, protocol:str='http', numeric_only:bool=True, float_size:str='float64', host_charts_dict:dict=None, host_prefix:bool=False, host_sep:str=':')

Get allmetrics into a df.

Parameters:
  • host str The host we want to get the alarm log from.
  • charts list A list of charts to pull data for.
  • wide bool True if you want to return the data in wide format as opposed to long.
  • user str A username to use if netdata is password protected.
  • pwd str A password to use if netdata is password protected.
  • protocol str 'http' or 'https'.
  • numeric_only bool Set to true if you want to filter out any non numeric data.
  • float_size str float size to use if would like to save some memory, eg can use 'float32' or 'float16'.
Returns:
  • df pd.DataFrame A df of the latest data from allmetrics.

get_allmetrics_async[source]

get_allmetrics_async(host_charts_dict:dict=None, col_sep:str='|', numeric_only:bool=True, timeout:int=60, index_as_datetime:bool=False, freq:str='infer', sort_cols:bool=True, user:str=None, pwd:str=None, protocol:str='http', float_size:str='float64', host_prefix:bool=False, host_sep:str=':', wide:bool=False)

Define api calls to make and any post processing to be done.

Parameters:
  • col_sep str A character for separating chart and dimension in column names of dataframe.
  • numeric_only bool Set to true if you want to filter out any non numeric data.
  • timeout int The number of seconds for trio to move_on_after.
  • index_as_datetime bool If true, set the index to be a pandas datetime.
  • freq str Freq to be passed to pandas datetime index.
  • sort_cols bool True to sort columns by name.
  • user str A username to use if netdata is password protected.
  • pwd str A password to use if netdata is password protected.
  • protocol str 'http' or 'https'.
  • float_size str float size to use if would like to save some memory, eg can use 'float32' or 'float16'.
  • host_charts_dict dict dictionary of hosts to pull for where each value is list of relevant charts to pull from that host.
  • host_prefix bool True to prefix each colname with the corresponding host.
  • host_sep str A character for separating host and chart and dimensions in column names of dataframe.
Returns:
  • df pd.DataFrame A pandas dataframe with all chart data outer joined based on time index and any post processing done.