MonitoringClient

This is the client of the Monitoring service based on Elasticsearch.

class DIRAC.MonitoringSystem.Client.MonitoringClient.MonitoringClient(rpcClient=None)

Bases: object

class MonitoringClient

This class expose the methods of the Monitoring Service

Parameters:__rpcClient (RPCClient) – stores the rpc client used to connect to the service
__init__(rpcClient=None)

x.__init__(…) initializes x; see help(type(x)) for signature

addMonitoringRecords(monitoringtype, doc_type, data)
Parameters:
  • monitoringtype (str) –
  • doc_type (str) –
  • data (dict) –
addRecords(indexName, doc_type, data)

add records to the database

Parameters:
  • indexName (str) –
  • doc_type (str) –
  • data (dict) –
deleteIndex(indexName)

It deletes a specific index…

Parameters:indexName (str) –
generateDelayedPlot(typeName, reportName, startTime, endTime, condDict, grouping, extraArgs=None, compress=True)

It is used to encode the plot parameters used to create a certain plot.

Parameters:
  • typeName (str) – the type of the monitoring
  • startTime (int) – epoch time, start time of the plot
  • endTime (int) – epoch time, end time of the plot
  • condDict (dict) – is the conditions used to gnerate the plot: {‘Status’:[‘Running’],’grouping’: [‘Site’] }
  • grouping (str) – is the grouping of the data for example: ‘Site’
  • extraArgs (dict) – epoch time which can be last day, last week, last month
  • compress (bool) – apply compression of the encoded values.
Returns:

S_OK(str) or S_ERROR() it returns the encoded plot parameters

getDataForAGivenPeriod(typeName, condDict, initialDate='', endDate='')

Retrieves the history of logging entries for the given component during a given given time period

Parameters:
  • typeName (str) – name of the monitoring type
  • condDict (dict) –

    conditions for the query

    • key -> name of the field
    • value -> list of possible values
  • initialDate (str) – Indicates the start of the time period in the format ‘DD/MM/YYYY hh:mm’
  • endDate (str) – Indicate the end of the time period in the format ‘DD/MM/YYYY hh:mm’
Returns:

Entries from the database for the given component recorded between the initial and the end dates

getLastDayData(typeName, condDict)

It returns the data from the last day index. Note: we create daily indexes.

Parameters:
  • typeName (str) – name of the monitoring type
  • condDict (dict) –

    conditions for the query

    • key -> name of the field
    • value -> list of possible values
getLimitedData(typeName, condDict, size=10)

Returns a list of records for a given selection.

Parameters:
  • typeName (str) – name of the monitoring type
  • condDict (dict) –

    conditions for the query

    • key -> name of the field
    • value -> list of possible values
Returns:

Up to size entries for the given component from the database

getReport(typeName, reportName, startTime, endTime, condDict, grouping, extraArgs=None)

It is used to get the raw data used to create a plot. :param str typeName the type of the monitoring :param str reportName the name of the plotter used to create the plot for example: NumberOfJobs :param int startTime epoch time, start time of the plot :param int endTime epoch time, end time of the plot :param dict condDict is the conditions used to gnerate the plot: {‘Status’:[‘Running’],’grouping’: [‘Site’] } :param str grouping is the grouping of the data for example: ‘Site’ :paran dict extraArgs epoch time which can be last day, last week, last month :rerturn S_OK or S_ERROR

listReports(typeName)
Parameters:typeName (str) – monitoring type for example WMSHistory
Returns:S_OK([]) or S_ERROR() the list of available plots
listUniqueKeyValues(typeName)
Parameters:typeName (str) – is the monitoring type registered in the Types.
Returns:S_OK({key:[]}) or S_ERROR() The key is element of the __keyFields of the BaseType