MonitoringClient

Exposes singleton object gMonitor, which is instance of MonitoringClient class

Uses RPC Framework/Monitoring service. Calls registerActivities exposed function

class DIRAC.FrameworkSystem.Client.MonitoringClient.MonitoringClient

Bases: object

This class is used to create the gMonitor object and acts as a client side for registering activities and committing the data.

COMPONENT_AGENT = 'agent'
COMPONENT_SCRIPT = 'script'
COMPONENT_SERVICE = 'service'
COMPONENT_TORNADO = 'tornado'
COMPONENT_WEB = 'web'
OP_ACUM = 'acum'
OP_MEAN = 'mean'
OP_RATE = 'rate'
OP_SUM = 'sum'
__init__()
property activitiesLock
addMark(name, value=1)

Adds a new mark to the specified activity

Parameters
  • name (string) – Name of the activity to report

  • value (number) – Weight of the mark. By default it’s one.

disable()
enable()
flush(allData=False)

This method is used to periodically flush the data and send it to the server side.

Parameters

allData (bool) – This is used to indicate whether all the data is present or not.

property flushingLock
forceFlush(exitCode)

This method can be used to force flush all the data directly without flushing the data periodically.

getComponentsStatus(condDict)

This method is used to get the status of the components.

Parameters

condDict (dictionary) – A condition dictionary.

Returns

S_OK with status and message about the component.

getComponentsStatusWebFormatted(condDict={}, sortingList=[], startItem=0, maxItems=0)
initialize()
registerActivity(name, description, category, unit, operation, bucketLength=60)

Registers new activity. Before reporting information to the server, the activity must be registered.

Parameters
  • name (string) – Id of the activity to report

  • description (string) – Description of the activity

  • category (string) – Grouping of the activity

  • unit (string) – String representing the unit that will be printed in the plots

  • operation (string) – Type of data operation to represent data. All the possibilities are defined in the Constants.py file

  • bucketLength (int) – Bucket length in seconds

setComponentExtraParam(name, value)

Sets the extra parameters of the component reporting.

Parameters
  • name (string) – It should belong to one of these ‘version’, ‘DIRACVersion’, ‘description’, ‘startTime’, ‘platform’, ‘cycles’, ‘queries’.

  • value (string) – The proper value corresponding to one of the selected names.

setComponentLocation(componentLocation=False)

Sets the location of the component reporting.

Parameters

componentLocation (string) – Location of the component reporting

setComponentName(componentName)

Sets the name of the component reporting.

Parameters

componentName (string) – Name of the component reporting

setComponentType(componentType)

Defines the type of component reporting data.

Parameters

componentType (string) – Defines the grouping of the host by type. All the possibilities are defined in the Constants.py file

exception DIRAC.FrameworkSystem.Client.MonitoringClient.MonitoringClientActivityNotDefined(message)

Bases: Exception

This class is used to raise an exception if an activity is not defined meaning not registered using the registerActivity method of the gMonitor object.

__init__(message)
args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception DIRAC.FrameworkSystem.Client.MonitoringClient.MonitoringClientActivityValueTypeError(message)

Bases: Exception

This class is used to raise an exception if an activity type is mismatched while calling the addMark method of the gMonitor object.

__init__(message)
args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception DIRAC.FrameworkSystem.Client.MonitoringClient.MonitoringClientUnknownParameter(message)

Bases: Exception

This class is used to raise an exception when some unkown parameter is passed to the setComponentExtraParam method of the gMonitor object.

__init__(message)
args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

class DIRAC.FrameworkSystem.Client.MonitoringClient.MonitoringFlusher

Bases: object

This class is used to flush all the instances of the MonitoringClient registered periodically.

__init__()
flush(allData=False)

This method is used to periodically flush the data.

Parameters

allData (bool) – This is used to indicate whether all the data is present or not.

registerMonitoringClient(mc)

This method is used to register instances of the MonitoringClient.

Parameters

mc (object of MonitoringClient) – Its just an instance of the MonitoringClient that we want to register.