NetworkAgent

Accounting agent to consume perfSONAR network metrics received via a message queue.

NetworkAgent options
NetworkAgent
{
  MaxCycles = 0
  PollingTime = 60
  # URI of the MQ of the perfSONAR information
  MessageQueueURI =
  # time how long objects are kept in the buffer if they cannot be written to the DB
  BufferTimeout = 3600
}
class DIRAC.AccountingSystem.Agent.NetworkAgent.NetworkAgent(agentName, loadName, baseAgentName=False, properties={})

Bases: AgentModule

AccountingSystem agent to processes messages containing perfSONAR network metrics. Results are stored in the accounting database.

BUFFER_TIMEOUT = 3600

default number of seconds after which network accounting objects are removed from the temporary buffer

__init__(agentName, loadName, baseAgentName=False, properties={})

Common __init__ method for all Agents. All Agent modules must define: __doc__

They are used to populate __codeProperties

The following Options are used from the Configuration: - /DIRAC/Setup - Status - Enabled - PollingTime default = 120 - MaxCycles default = 500 - WatchdogTime default = 0 (disabled) - ControlDirectory control/SystemName/AgentName - WorkDirectory work/SystemName/AgentName - shifterProxy ‘’ - shifterProxyLocation WorkDirectory/SystemName/AgentName/.shifterCred

It defines the following default Options that can be set via Configuration (above): - MonitoringEnabled True - Enabled True if Status == Active - PollingTime 120 - MaxCycles 500 - ControlDirectory control/SystemName/AgentName - WorkDirectory work/SystemName/AgentName - shifterProxy False - shifterProxyLocation work/SystemName/AgentName/.shifterCred

different defaults can be set in the initialize() method of the Agent using am_setOption()

In order to get a shifter proxy in the environment during the execute() the configuration Option ‘shifterProxy’ must be set, a default may be given in the initialize() method.

am_Enabled()
am_checkStopAgentFile()
am_createStopAgentFile()
am_getControlDirectory()
am_getCyclesDone()
am_getMaxCycles()
am_getModuleParam(optionName)
am_getOption(optionName, defaultValue=None)

Gets an option from the agent’s configuration section. The section will be a subsection of the /Systems section in the CS.

am_getPollingTime()
am_getShifterProxyLocation()
am_getStopAgentFile()
am_getWatchdogTime()
am_getWorkDirectory()
am_go()
am_initialize(*initArgs)

Common initialization for all the agents.

This is executed every time an agent (re)starts. This is called by the AgentReactor, should not be overridden.

am_removeStopAgentFile()
am_secureCall(functor, args=(), name=False)
am_setModuleParam(optionName, value)
am_setOption(optionName, value)
am_stopExecution()
beginExecution()
checkConsumers()

Check whether consumers exist and work properly. (Re)create consumers if needed.

commitData()

Iterates through all object in the temporary buffer and commit objects to DB if both packet-loss-rate and one-way-delay values are set.

Objects in the buffer older than self.bufferTimeout seconds which still have missing data are removed permanently (a warning is issued).

endExecution()
execute()

During each cycle update the internal host-to-dirac name dictionary, check the consumers status (restart them if necessary), commit data stored in the buffer and show statistics.

finalize()

Gracefully close all consumer connections and commit last records to the DB.

initialize()

Agents should override this method for specific initialization. Executed at every agent (re)start.

processMessage(headers, body)

Process a message containing perfSONAR data and store the result in the Accounting DB. Supports packet-loss-rate and one-way-delay metrics send in raw data streams.

Function is designed to be an MQConsumer callback function.

showStatistics()

Display different statistics as info messages in the log file.

updateNameDictionary()

Update the internal host-to-dirac name dictionary.