grr/server/grr_response_server/client_report_utils.py
def _FetchAllGraphSeriesFromTheLegacyDB(
    label,
    report_type,
    period = None,
    token = None
):
  """Fetches graph-series from the legacy DB [see FetchAllGraphSeries()]."""
  if period is None:
    time_range = aff4.ALL_TIMES
  else:
    range_end = rdfvalue.RDFDatetime.Now()
    time_range = (range_end - period, range_end)
  series_with_timestamps = {}
  try:
    stats_for_label = aff4.FACTORY.Open(
        GetAFF4ClientReportsURN().Add(label),
        aff4_type=aff4_stats.ClientFleetStats,
        mode="r",
        age=time_range,
        token=token)
  except aff4.InstantiationError:
    # Nothing to return for the given label and report-type.
    return series_with_timestamps
  aff4_attr = _GetAFF4AttributeForReportType(report_type)
  if aff4_attr.attribute_type == rdf_stats.GraphSeries:
    for graphs in stats_for_label.GetValuesForAttribute(aff4_attr):
      graph_series = rdf_stats.ClientGraphSeries(report_type=report_type)
      for graph in graphs:
        graph_series.graphs.Append(graph)
      series_with_timestamps[graphs.age] = graph_series
  elif aff4_attr.attribute_type == rdf_stats.Graph:
    for graph in stats_for_label.GetValuesForAttribute(aff4_attr):
      graph_series = rdf_stats.ClientGraphSeries(report_type=report_type)
      graph_series.graphs.Append(graph)
      series_with_timestamps[graph.age] = graph_series
  else:
    raise AFF4AttributeTypeError(aff4_attr.attribute_type)
  return series_with_timestamps
Fetches graph-series from the legacy DB [see FetchAllGraphSeries()].
Fetches graph-series from the legacy DB [see FetchAllGraphSeries()].
Fetches graph - series from the legacy DB [ see FetchAllGraphSeries () ] .
def _FetchAllGraphSeriesFromTheLegacyDB(
    label,
    report_type,
    period = None,
    token = None
):
  if period is None:
    time_range = aff4.ALL_TIMES
  else:
    range_end = rdfvalue.RDFDatetime.Now()
    time_range = (range_end - period, range_end)
  series_with_timestamps = {}
  try:
    stats_for_label = aff4.FACTORY.Open(
        GetAFF4ClientReportsURN().Add(label),
        aff4_type=aff4_stats.ClientFleetStats,
        mode="r",
        age=time_range,
        token=token)
  except aff4.InstantiationError:
    return series_with_timestamps
  aff4_attr = _GetAFF4AttributeForReportType(report_type)
  if aff4_attr.attribute_type == rdf_stats.GraphSeries:
    for graphs in stats_for_label.GetValuesForAttribute(aff4_attr):
      graph_series = rdf_stats.ClientGraphSeries(report_type=report_type)
      for graph in graphs:
        graph_series.graphs.Append(graph)
      series_with_timestamps[graphs.age] = graph_series
  elif aff4_attr.attribute_type == rdf_stats.Graph:
    for graph in stats_for_label.GetValuesForAttribute(aff4_attr):
      graph_series = rdf_stats.ClientGraphSeries(report_type=report_type)
      graph_series.graphs.Append(graph)
      series_with_timestamps[graph.age] = graph_series
  else:
    raise AFF4AttributeTypeError(aff4_attr.attribute_type)
  return series_with_timestamps
def _FetchAllGraphSeriesFromTheLegacyDB ( label , report_type , period = None , token = None ) : if period is None : time_range = aff4 . ALL_TIMES else : range_end = rdfvalue . RDFDatetime . Now ( ) time_range = ( range_end - period , range_end ) series_with_timestamps = { } try : stats_for_label = aff4 . FACTORY . Open ( GetAFF4ClientReportsURN ( ) . Add ( label ) , aff4_type = aff4_stats . ClientFleetStats , mode = "r" , age = time_range , token = token ) except aff4 . InstantiationError : return series_with_timestamps aff4_attr = _GetAFF4AttributeForReportType ( report_type ) if aff4_attr . attribute_type == rdf_stats . GraphSeries : for graphs in stats_for_label . GetValuesForAttribute ( aff4_attr ) : graph_series = rdf_stats . ClientGraphSeries ( report_type = report_type ) for graph in graphs : graph_series . graphs . Append ( graph ) series_with_timestamps [ graphs . age ] = graph_series elif aff4_attr . attribute_type == rdf_stats . Graph : for graph in stats_for_label . GetValuesForAttribute ( aff4_attr ) : graph_series = rdf_stats . ClientGraphSeries ( report_type = report_type ) graph_series . graphs . Append ( graph ) series_with_timestamps [ graph . age ] = graph_series else : raise AFF4AttributeTypeError ( aff4_attr . attribute_type ) return series_with_timestamps
Fetches graph-series from the legacy DB [see FetchAllGraphSeries()].
Fetches graph - series from the legacy DB [ see FetchAllGraphSeries () ] .
"""Fetches graph-series from the legacy DB [see FetchAllGraphSeries()].""" # Nothing to return for the given label and report-type.
label
report_type
period
token