Agent

class Agent(configuration: AgentConfiguration, pool: <Error class: unknown class>)

The agent manages the node. It maintains a connection to the PowerGoblin service, it constantly polls for new commands and performs them sequentially.

Most commands block until they either fail or succeed. The collector command is started as a background process.

Constructors

Link copied to clipboard
constructor(configuration: AgentConfiguration, pool: <Error class: unknown class>)

Properties

Link copied to clipboard
val startTime: <Error class: unknown class>

Start time of the agent.

Functions

Link copied to clipboard
open fun close()

Close the client and shut down connections.

Link copied to clipboard
Link copied to clipboard

Determines the collection capabilities of the agent. Processes the AgentDetermineCapabilitiesCommand.

Link copied to clipboard

Fetch a measurement. Processes the AgentDownloadMeasurementCommand.

fun download(input: <Error class: unknown class>, targetCandidate: String): AgentDownloadTask

Download the measurement from the input stream. This is used by the local web API.

Link copied to clipboard
Link copied to clipboard

Execute and arbitrary command / script. Processes the AgentExecuteCommand.

Link copied to clipboard
Link copied to clipboard

Handler for GET requests coming from the integrated web server.

Link copied to clipboard
Link copied to clipboard
fun launchCollectd(cmd: AgentCollectCommand, filter: List<CollectorFlag> = capabilities)

Start the collector (collectd). Processes the AgentCollectCommand.

Link copied to clipboard
fun listen()

Starts a loop where first a connection is established. Once we have a connection, new commands are queried periodically.

Link copied to clipboard

Starts a measurement. Processes the AgentMeasureCommand.

Link copied to clipboard

Handler for POST requests coming from the integrated web server.

Link copied to clipboard
fun powerOff()

Powers off the whole node, including the agent. Processes the AgentPowerOffCommand.

Link copied to clipboard
fun processDownload(task: AgentDownloadTask, target: <Error class: unknown class>, input: ByteArray)

Fetch a measurement. Processes the AgentDownloadMeasurementCommand.

Link copied to clipboard
fun reboot()

Reboot the whole node, including the agent. Processes the AgentPowerOffCommand.

Link copied to clipboard

Reconfigure the agent. Processes the AgentReconfigureCommand.

Link copied to clipboard
fun runCommand(cmd: AgentCommand, log: Boolean = true): String?

Processes a polymorphic AgentCommand.

Link copied to clipboard

Stops the collector (collectd). Processes the AgentCollectorStopCommand.

Link copied to clipboard
fun updateStatus(newTask: AgentTask? = null)