API updates for metrics framework.

- Removed default logging.  Now a function is available for the new
  $period_finished filter field to get the same behavior for logging
  named Metrics::write_log.

- Added index rollups for getting multiple metrics result values
  as the same time.
This commit is contained in:
Seth Hall 2012-12-18 01:08:59 -05:00
parent 69030fdff3
commit 69b7ce12d2
17 changed files with 304 additions and 162 deletions

View file

@ -15,8 +15,7 @@ event bro_init() &priority=5
$threshold=5,
$threshold_crossed(index: Metrics::Index, val: Metrics::ResultVal) = {
print fmt("THRESHOLD: hit a threshold value at %.0f for %s", val$sum, Metrics::index2str(index));
},
$log=F]);
}]);
Metrics::add_filter("test.metric",
[$name="foobar2",
@ -25,8 +24,7 @@ event bro_init() &priority=5
$threshold_series=vector(3,6,800),
$threshold_crossed(index: Metrics::Index, val: Metrics::ResultVal) = {
print fmt("THRESHOLD_SERIES: hit a threshold series value at %.0f for %s", val$sum, Metrics::index2str(index));
},
$log=F]);
}]);
Metrics::add_filter("test.metric",
[$every=3secs,
$measure=set(Metrics::SUM),
@ -36,8 +34,7 @@ event bro_init() &priority=5
},
$threshold_crossed(index: Metrics::Index, val: Metrics::ResultVal) = {
print fmt("THRESHOLD_FUNC: hit a threshold function value at %.0f for %s", val$sum, Metrics::index2str(index));
},
$log=F]);
}]);
Metrics::add_data("test.metric", [$host=1.2.3.4], [$num=3]);
Metrics::add_data("test.metric", [$host=6.5.4.3], [$num=2]);