MonitoringClient

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

class DIRAC.MonitoringSystem.Client.MonitoringClient.MonitoringClient(**kwargs)

Bases: Client

class MonitoringClient

This class expose the methods of the Monitoring Service

__init__(**kwargs)

Simple constructor

addMonitoringRecords(self, monitoringtype, data, **kwargs)

Bulk insert data directly to the given monitoring type.

Parameters:
  • monitoringtype (str) – monitoring type name

  • data (list) – list of documents

Returns:

S_OK or S_ERROR

Automatically created for the service function export_addMonitoringRecords()

addRecords(self, indexname, monitoringType, data, **kwargs)

It is used to insert data directly to the database… The data will be inserted to the given index.

Parameters:
  • indexname (str) – name of the index

  • monitoringType (str) – type of the monitoring

  • data (list) – data to insert

Returns:

S_OK or S_ERROR

Automatically created for the service function export_addRecords()

property call

To be removed once we’re sure self.call has been removed

Type:

Deprecated

deleteIndex(self, indexName, **kwargs)

It is used to delete an index! Note this is for experienced users!!!

Parameters:

indexName (str) – name of the index

Automatically created for the service function export_deleteIndex()

executeRPC(*parms, **kws)

This method extracts some parameters from kwargs that are used as parameter of the constructor or RPCClient. Unfortunately, only a few of all the available parameters of BaseClient are exposed.

Parameters:
  • rpc – if an RPC client is passed, use that one

  • timeout – we can change the timeout on a per call bases. Default is self.timeout

  • url – We can specify which url to use

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

generatePlot(self, reportRequest, **kwargs)

It creates a plots for a given request

Parameters:

reportRequest (dict) – contains the plot arguments…

Automatically created for the service function export_generatePlot()

getClientKWArgs()

Returns a copy of the connection arguments

getDataForAGivenPeriod(self, typeName, condDict, initialDate, endDate, **kwargs)

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

Automatically created for the service function export_getDataForAGivenPeriod()

getLastDayData(self, typeName, condDict, **kwargs)

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

Automatically created for the service function export_getLastDayData()

getLimitedData(self, typeName, condDict, size, **kwargs)

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

  • size (int) – Indicates how many entries should be retrieved from the log

Returns:

Up to size entries for the given component from the database

Automatically created for the service function export_getLimitedData()

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

It is used to get the raw data used to create a plot.

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

  • reportName (str) – the name of the plotter used to create the plot for example: NumberOfJobs

  • 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

Rerturn:

S_OK or S_ERROR

getServer()

Getter for the server url. Useful ?

httpsClient

alias of TornadoClient

listReports(self, typeName, **kwargs)
Parameters:

typeName (str) – monitoring type for example WMSHistory

Returns:

S_OK([]) or S_ERROR() the list of available plots

Automatically created for the service function export_listReports()

listUniqueKeyValues(self, typeName, **kwargs)
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

Automatically created for the service function export_listUniqueKeyValues()

pingDB(self, **kwargs)

We can check, if the db is available.

Automatically created for the service function export_pingDB()

put(self, recordsToInsert, monitoringType, **kwargs)

It is used to insert records to the db.

Parameters:
  • recordsToInsert (list) – records to be inserted to the db

  • monitoringType (str) – monitoring type…

Automatically created for the service function export_put()

setServer(url)

Set the server URL used by default

Parameters:

url – url of the service