MonitoringHandler

The Monitoring/Monitoring service interacts with the ElasticSearch backend exposed by MonitoringDB.

Monitoring options
Monitoring
{
  Port = 9137
  Authorization
  {
    Default = authenticated
    FileTransfer
    {
      Default = authenticated
    }
  }
}
class DIRAC.MonitoringSystem.Service.MonitoringHandler.MonitoringHandler(handlerInitDict, trid)

Bases: 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.

__init__(handlerInitDict, trid)

Constructor

Parameters
  • handlerInitDict (dictionary) – Information vars for the service

  • trid (object) – Transport to use

auth_ping = ['all']
auth_refreshConfiguration = ['CSAdministrator']
auth_whoami = ['all']
export_addMonitoringRecords(monitoringtype, data)

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

export_addRecords(indexname, monitoringType, data)

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

export_deleteIndex(indexName)

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

Parameters

indexName (str) – name of the index

static export_echo(data)

This method is used for testing performance of the service

Parameters

data (str) – data to be sent back to the caller

Returns

S_OK, Value is the input data

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

str typeName: the type of the monitoring str reportName: the name of the plotter used to create the plot for example: NumberOfJobs int startTime: epoch time, start time of the plot int endTime: epoch time, end time of the plot dict condDict: is the conditions used to gnerate the plot: {‘Status’:[‘Running’],’grouping’: [‘Site’] } str grouping: is the grouping of the data for example: ‘Site’ dict extraArgs: 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…

static export_refreshConfiguration(fromMaster)

Force refreshing the configuration data

Parameters

fromMaster (bool) – flag to refresh from the master configuration service

export_whoami()

A simple whoami, returns all credential dictionary, except certificate chain object.

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_getClientVersion()
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 = [(<class 'str'>,), <class 'list'>]
types_addRecords = [(<class 'str'>,), (<class 'str'>,), <class 'list'>]
types_deleteIndex = [(<class 'str'>,)]
types_echo = [(<class 'str'>,)]
types_generatePlot = [<class 'dict'>]
types_getDataForAGivenPeriod = [(<class 'str'>,), <class 'dict'>, (<class 'str'>,), (<class 'str'>,)]
types_getLastDayData = [(<class 'str'>,), <class 'dict'>]
types_getLimitedDat = [(<class 'str'>,), <class 'dict'>, <class 'int'>]
types_getReport = [<class 'dict'>]
types_listReports = [(<class 'str'>,)]
types_listUniqueKeyValues = [(<class 'str'>,)]
types_ping = []
types_pingDB = []
types_put = [<class 'list'>, (<class 'str'>,)]
types_refreshConfiguration = [<class 'bool'>]
types_whoami = []