Follow the instructions below to install and configure this check for an Agent running on a Kubernetes cluster. See also the Autodiscovery Integration Templates for guidance on applying these instructions.
Installation
To install the open_policy_agent check on your Kubernetes cluster:
The default dashboard includes some graphs related to a metric around OPA decisions, called open_policy_agent.decisions. This metric is created based on the OPA “Decision Logs”. To generate this metric and populate this part of the dashboard, create a new log-generated metric in Datadog.
First, create a facet for the msg field of the OPA logs, as it only generates metrics for the “Decision Logs” type of log entry. For that, select any of the log entries coming from OPA, click on the engine log near the msg field and select “Create facet for @msg”:
Create two facets, one for the input.request.kind.kind field and one for the result.response.allowed field, both available in any of the log entries type “Decision Log”.
Once you have created the facets, generate the needed metric for the Dashboard to be complete. Click on the menu “Logs -> Generate Metrics”. Click on “Add a new metric” and fill in the form with the following data:
Configuration
Edit the open_policy_agent/conf.yaml file, in the /confd folder that you added to the Agent pod to start collecting your OPA performance data. See the sample open_policy_agent/conf.yaml for all available configuration options.
The count of the HTTP request latencies in seconds for the OPA service Shown as second
open_policy_agent.request.duration.sum (count)
The sum of the HTTP request latencies in seconds for the OPA service Shown as second
open_policy_agent.policies (gauge)
The number of policies enabled in the OPA server
Events
open_policy_agent does not include any events.
Service Checks
open_policy_agent.prometheus.health Returns CRITICAL if the agent fails to connect to the Prometheus endpoint, otherwise OK. Statuses: ok, critical
open_policy_agent.health Returns CRITICAL if the agent fails to connect to the OPA health endpoint, OK if it returns 200, WARNING otherwise. Statuses: ok, warning, critical
open_policy_agent.bundles_health Returns CRITICAL if the agent fails to connect to the OPA bundles health endpoint, OK if it returns 200, WARNING otherwise. Statuses: ok, warning, critical
open_policy_agent.plugins_health Returns CRITICAL if the agent fails to connect to the OPA plugins health point, OK if it returns 200, WARNING otherwise. Statuses: ok, warning, critical