Monitoring
Get metrics
Count runs and findings over a time range, in total, per group and over time.
How it works
Ask for up to five metrics in one request. Give each one a name and a measure, and its counts come back under that name. A metric can have its own rule_id and severities, so you can count findings twice with different filters.
Choose what to count with measure, and how to split it with group_by:
| To count | measure | group_by | Filters |
|---|---|---|---|
| Runs, in total | runs | leave it out | agent_id, rule_set_id |
| Runs, per rule set | runs | rule_set_id | agent_id |
| Findings, in total or per rule set, rule or agent | findings | leave it out, rule_set_id, rule_id or agent_id | all four |
| Rules not met, per severity | findings | severity | all four |
A finding is one agent not meeting one rule, so finding_count counts distinct findings. It doesn’t add up across groups or time periods, which is why total is counted on its own.
The response always has total: every metric over the whole time range. Set include_previous to also get previous, the same counts for the time range of the same length just before, to show a trend. Set timeseries to get series: the counts for every period of resolution_seconds from start, with empty periods as zeros.
With group_by, groups has every group any metric has, in the time range or the one before, ranked by the first metric. Each group carries every metric, with zeros where a metric has none. Use limit to keep only the top groups. Metrics count the rule sets your agents are bound to now.
With both group_by and timeseries, a response can hold up to 100,000 counts (groups × periods × metrics). Past that, you get a 400: ask for fewer groups, longer periods or a shorter time range.
Request body
application/json
- metricsobject[]required1 to 5
The metrics to count.
- namestringrequiredup to 40 characters
A name for the metric, different from the others in the request. Its counts come back under this name. Lowercase letters, numbers and
_, starting with a letter. - measurestringrequired
What to count.
runsfindings - rule_idstring
Only this rule. With
findingsonly. - severitiesstring[]
Only these severities. With
findingsonly.criticalhighmediumlowunknown
- group_bystring
How to split every metric. Leave it out for totals only.
rule_set_idrule_idagent_idseverity - agent_idstring
Only this agent, for every metric.
- rule_set_idstring (uuid)
Only this rule set, for every metric.
- startstring (date-time)up to 5,000 days before end
The start of the time range, included. Defaults to 30 days before
end. - endstring (date-time)
The end of the time range, not included. Defaults to now.
- include_previousboolean
Also count the time range of the same length just before, in
previous. - timeseriesboolean
Also count every period of time, in
series. - resolution_secondsintegerat least 60
The length of each period, in seconds. With
timeseriesonly. Defaults to an hour for time ranges up to a day, and a day for longer ones. - limitinteger
Keep only the top groups. With
group_byset torule_set_id,rule_idoragent_id. - sourcestringdefault platform
Which runs to count:
platformfor ones Ollive collected,apiormcpfor ones sent to Ollive.platformapimcp
Response
The counts. Zeros if nothing matched.
- group_bystringrequired
How the counts were split.
- startstring (date-time)required
The start of the time range.
- endstring (date-time)required
The end of the time range.
- previous_startstring (date-time)
The start of the previous time range. With
include_previousonly. - previous_endstring (date-time)
The end of the previous time range. With
include_previousonly. - resolution_secondsintegerrequired
The length of each period.
0withouttimeseries. - totalobjectrequired
Each metric’s counts over the whole time range, by name.
- run_countinteger
Runs.
runsmetrics only. - checked_run_countinteger
Runs that finished checking.
runsmetrics only. - finding_countinteger
Findings.
findingsmetrics only. - flagged_run_countinteger
Runs with at least one finding.
findingsmetrics only. - not_met_countinteger
Rules not met. With
group_by: severityonly.
- previousobjectrequired
Each metric’s counts over the previous time range, by name. Empty without
include_previous. - seriesobject[]required
The counts per period, oldest first. Empty without
timeseries.- atstring (date-time)required
The start of the period.
- valuesobjectrequired
Each metric’s counts for that period, by name.
- groupsobject[]required
One entry per group, ranked by the first metric. Empty without
group_by.- keystringrequired
The group’s ID: a rule set, rule or agent ID, or a severity.
unknownwhen Ollive couldn’t tell which one. - labelstringrequired
A readable name for the group.
- valuesobjectrequired
Each metric’s counts for this group, by name.
- previousobjectrequired
The same for the previous time range. Empty without
include_previous. - seriesobject[]required
This group’s counts per period, oldest first. Empty without
timeseries.
- total_groupsintegerrequired
How many groups there were before
limit. - truncatedbooleanrequired
Whether
limitleft some groups out.
That combination of measure and group_by isn’t available, or something else in the request is wrong.
Returns an error, for example with the code unsupported_metric.
The API key is missing, wrong, revoked or expired.
Returns an error, for example with the code authentication_failed.