MonitoringHandler

It is used to create plots using Elasticsearch

class DIRAC.MonitoringSystem.Service.MonitoringHandler.MonitoringHandler(handlerInitDict, trid)

Bases: DIRAC.Core.DISET.RequestHandler.RequestHandler

class MonitoringHandler
Parameters:
  • __reportRequestDict (dict) – contains the arguments used to create a certain plot
  • __db (object) – used to retrieve the data from the db.
exception ConnectionError(msg)

Bases: exceptions.Exception

__init__(msg)

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

args
message
__init__(handlerInitDict, trid)

Constructor

Parameters:
  • handlerInitDict (dictionary) – Information vars for the service
  • trid (object) – Transport to use
auth_ping = ['all']
export_addMonitoringRecords(monitoringtype, doc_type, data)

It is used to insert data directly to the given monitoring type

Parameters:
  • monitoringtype (str) –
  • data (list) –
export_addRecords(indexname, doc_type, data)

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

Parameters:
  • indexname (str) –
  • data (list) –
export_deleteIndex(indexName)

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

Parameters:indexName (str) –
static export_echo(data)

This method used for testing the performance of a service

export_generatePlot(reportRequest)

It creates a plots for a given request

Parameters:reportRequest (dict) – contains the plot arguments…
export_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

export_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
export_getLimitedData(typeName, condDict, size)

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

export_getReport(reportRequest)

It is used to get the raw data used to create a plot. The reportRequest has the following parameters:

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
Returns:

S_OK or S_ERROR S_OK value is a dictionary which contains all values used to create the plot

export_listReports(typeName)
Parameters:typeName (str) – monitoring type for example WMSHistory
Returns:S_OK([]) or S_ERROR() the list of available plots
export_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
export_ping()
export_pingDB()

We can check, if the db is available.

export_put(recordsToInsert, monitoringType)

It is used to insert records to the db.

Parameters:
  • recordsToInsert (list) – records to be inserted to the db
  • monitoringType (str) – monitoring type…
classmethod getCSOption(optionName, defaultValue=False)

Get an option from the CS section of the services

Returns:Value for serviceSection/optionName in the CS being defaultValue the default
getRemoteAddress()

Get the address of the remote peer.

Returns:Address of remote peer.
getRemoteCredentials()

Get the credentials of the remote peer.

Returns:Credentials dictionary of remote peer.
initialize()

Initialize this instance of the handler (to be overwritten)

classmethod initializeHandler(serviceInfo)
srv_disconnect(trid=None)
classmethod srv_disconnectClient(trid)
srv_getActionTuple()
classmethod srv_getCSOption(optionName, defaultValue=False)

Get an option from the CS section of the services

Returns:Value for serviceSection/optionName in the CS being defaultValue the default
srv_getClientSetup()
srv_getClientVO()
srv_getFormattedRemoteCredentials()
classmethod srv_getMonitor()
srv_getRemoteAddress()

Get the address of the remote peer.

Returns:Address of remote peer.
srv_getRemoteCredentials()

Get the credentials of the remote peer.

Returns:Credentials dictionary of remote peer.
classmethod srv_getServiceName()
srv_getTransportID()
classmethod srv_getURL()
classmethod srv_msgCreate(msgName)
srv_msgReply(msgObj)
classmethod srv_msgSend(trid, msgObj)
transfer_bulkFromClient(bulkId, token, bulkSize, fileHelper)
transfer_bulkToClient(bulkId, token, fileHelper)
transfer_fromClient(fileId, token, fileSize, fileHelper)
transfer_listBulk(bulkId, token, fileHelper)
transfer_toClient(fileId, token, fileHelper)

Get graphs data

Parameters:
types_addMonitoringRecords = [<type 'basestring'>, <type 'basestring'>, <type 'list'>]
types_addRecords = [<type 'basestring'>, <type 'basestring'>, <type 'list'>]
types_deleteIndex = [<type 'basestring'>]
types_echo = [<type 'basestring'>]
types_generatePlot = [<type 'dict'>]
types_getDataForAGivenPeriod = [<type 'basestring'>, <type 'dict'>, <type 'basestring'>, <type 'basestring'>]
types_getLastDayData = [<type 'basestring'>, <type 'dict'>]
types_getLimitedDat = [<type 'basestring'>, <type 'dict'>, <type 'int'>]
types_getReport = [<type 'dict'>]
types_listReports = [<type 'basestring'>]
types_listUniqueKeyValues = [<type 'basestring'>]
types_ping = []
types_pingDB = []
types_put = [<type 'list'>, <type 'basestring'>]