Clean up to cluster framework to make event handling clearer.

- Fixed a bug where notices were being passed to proxies.
  This was a mistake and should greatly reduce load on
  many clusters.

- Cluster event regex variables renamed to:
  - Notice::manager2worker_events
  - Notice::manager2proxy_events
  - Notice::worker2manager_events
  - Notice::worker2proxy_events
  - Notice::proxy2manager_events
  - Notice::proxy2worker_events

- The default Notice::policy set is cleared for all cluster
  nodes except for managers to cause all default notice
  processing to occur on managers.  This should reduce load
  on workers slightly.
This commit is contained in:
Seth Hall 2011-10-04 11:57:50 -04:00
parent 870bdf796d
commit aa9fdf38bb
4 changed files with 55 additions and 26 deletions

View file

@ -19,14 +19,29 @@ export {
TIME_MACHINE,
};
## Events raised by the manager and handled by the workers.
const manager_events = /Drop::.*/ &redef;
## Events raised by a manager and handled by the workers.
const manager2worker_events = /Drop::.*/ &redef;
## Events raised by the proxies and handled by the manager.
const proxy_events = /EMPTY/ &redef;
## Events raised by a manager and handled by proxies.
const manager2proxy_events = /EMPTY/ &redef;
## Events raised by workers and handled by the manager.
const worker_events = /(TimeMachine::command|Drop::.*)/ &redef;
## Events raised by proxies and handled by a manager.
const proxy2manager_events = /EMPTY/ &redef;
## Events raised by proxies and handled by workers.
const proxy2worker_events = /EMPTY/ &redef;
## Events raised by workers and handled by a manager.
const worker2manager_events = /(TimeMachine::command|Drop::.*)/ &redef;
## Events raised by workers and handled by proxies..
const worker2proxy_events = /EMPTY/ &redef;
## Events raised by TimeMachine instances and handled by a manager.
const tm2manager_events = /EMPTY/ &redef;
## Events raised by TimeMachine instances and handled by workers.
const tm2worker_events = /EMPTY/ &redef;
## Events sent by the control host (i.e. BroControl) when dynamically
## connecting to a running instance to update settings or request data.

View file

@ -24,23 +24,24 @@ event bro_init() &priority=9
if ( n$node_type == WORKER && n$manager == node )
Communication::nodes[i] =
[$host=n$ip, $connect=F,
$class=i, $events=worker_events, $request_logs=T];
$class=i, $events=worker2manager_events, $request_logs=T];
if ( n$node_type == PROXY && n$manager == node )
Communication::nodes[i] =
[$host=n$ip, $connect=F,
$class=i, $events=proxy_events, $request_logs=T];
$class=i, $events=proxy2manager_events, $request_logs=T];
if ( n$node_type == TIME_MACHINE && me?$time_machine && me$time_machine == i )
Communication::nodes["time-machine"] = [$host=nodes[i]$ip, $p=nodes[i]$p,
$connect=T, $retry=1min];
$connect=T, $retry=1min,
$events=tm2manager_events];
}
else if ( me$node_type == PROXY )
{
if ( n$node_type == WORKER && n$proxy == node )
Communication::nodes[i] =
[$host=n$ip, $connect=F, $class=i, $events=worker_events];
[$host=n$ip, $connect=F, $class=i, $events=worker2proxy_events];
# accepts connections from the previous one.
# (This is not ideal for setups with many proxies)
@ -58,25 +59,35 @@ event bro_init() &priority=9
# Finally the manager, to send it status updates.
if ( n$node_type == MANAGER && me$manager == i )
Communication::nodes["manager"] = [$host=nodes[i]$ip, $p=nodes[i]$p,
Communication::nodes["manager"] = [$host=nodes[i]$ip,
$p=nodes[i]$p,
$connect=T, $retry=1mins,
$class=node];
$class=node,
$events=manager2proxy_events];
}
else if ( me$node_type == WORKER )
{
if ( n$node_type == MANAGER && me$manager == i )
Communication::nodes["manager"] = [$host=nodes[i]$ip, $p=nodes[i]$p,
Communication::nodes["manager"] = [$host=nodes[i]$ip,
$p=nodes[i]$p,
$connect=T, $retry=1mins,
$class=node, $events=manager_events];
$class=node,
$events=manager2worker_events];
if ( n$node_type == PROXY && me$proxy == i )
Communication::nodes["proxy"] = [$host=nodes[i]$ip, $p=nodes[i]$p,
$connect=T, $retry=1mins, $sync=T,
$class=node];
Communication::nodes["proxy"] = [$host=nodes[i]$ip,
$p=nodes[i]$p,
$connect=T, $retry=1mins,
$sync=T, $class=node,
$events=proxy2worker_events];
if ( n$node_type == TIME_MACHINE && me?$time_machine && me$time_machine == i )
Communication::nodes["time-machine"] = [$host=nodes[i]$ip, $p=nodes[i]$p,
$connect=T, $retry=1min];
if ( n$node_type == TIME_MACHINE &&
me?$time_machine && me$time_machine == i )
Communication::nodes["time-machine"] = [$host=nodes[i]$ip,
$p=nodes[i]$p,
$connect=T,
$retry=1min,
$events=tm2worker_events];
}
}