Skip to content

Herd Agent

BorjaFG edited this page Jun 12, 2017 · 15 revisions

Herd Agent Windows service

This tool is a Windows service that executes jobs sent from a client (ie, Badger) and, once the job is finished, returns the results to the client.

Agent discovery

When a client wants to find out which agents can be used to run whatever jobs it wants to send, it sends a broadcast message via UDP (no broadcast can be done using TCP), and agents answer to the client sending information about their availability and some properties of the host machine: number of processors (they currently send the number of processors -1), available RAM memory, version of the service, etc...

The agent listens to port CJobDispatcher.m_discoveryPortHerd and, when a CJobDispatcher.m_discoveryMessage message is received, the information of the local machine is gathered and sent to the client in HerdAgent.DiscoveryCallback().

Sending jobs to an agent

A job consists of a list of input files (to avoid sending over the same file more than once), a list of output files that are to be returned to the client after execution, and a list of tasks (commands).

public class CJob
{
public string name;
public List<CTask> tasks;
public List<string> inputFiles;
public List<string> outputFiles;
}

Each of the tasks will be run on a separate process.

public class CTask { public string exe; public string arguments; public string pipe; public string name; }

The HerdAgent Windows service stores temporal copies of the input/output files in the [HerdAgentInstallDir]/temp directory and, on starting the service, it deletes all the files/directories that are at least 2 weeks old.

FAQ

  • How do I start/stop the service if it's not running?

Start -> cmd (run as Administrator) -> net start/stop herdagent

  • What ports do I have to open for the agent to be reached?

The installer should add the needed rules to the Windows firewall. To install the agent, just right-click in Visual Studio on Installers/Herd Agent installer project->install

Clone this wiki locally