Agent metrics
/health
and /metrics
endpoints.You can activate metrics configuration by exposing your agent data via environmental variables in your Docker container or Kubernetes cluster.
To get the Nobl9 agent metrics, you need to have a monitoring solution that can scrape a Prometheus-compliant metrics endpoint.
Metric endpointsβ
/health
endpointβ
/health
endpointβThis endpoint returns an HTTP/1.1 200
OK
response to a standard GET
request if the agent is "healthy." The OK
response means that the agent code has completed initialization and is running.
/metrics
endpointβ
/metrics
endpointβThis endpoint returns Prometheus-scrapable metrics data in response to a standard GET
request. It is a text-based endpoint handled by the Golang Prometheus libraries.
Exposing the agent to metricsβ
To scrape agent's metrics, you need to define the N9_METRICS_PORT
as an environmental variable while deploying your agent through Kubernetes YAML or a Docker invocation generated in the UI:
- Kubernetes
- Docker
Here's a shortened example of Kubernetes deployment YAML with the defined N9_METRICS_PORT
variable:
apiVersion: v1
kind: Secret
<...>
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: nobl9-agent-example
namespace: default
spec:
<...>
spec:
containers:
- name: agent-container
image: nobl9/agent:0.82.2
resources:
requests:
memory: "350Mi"
cpu: "0.1"
env:
<...>
- name: N9_METRICS_PORT
value: "9090"
Here's an example of Docker deployment command with the defined N9_METRICS_PORT
variable:
docker run -d --restart on-failure \
--name nobl9-agent-example \
-e N9_CLIENT_ID="unique_client_id" \
-e N9_CLIENT_SECRET="unique_client_secret" \
-e N9_METRICS_PORT="9090" \
nobl9/agent:0.82.2
-
The
N9_METRICS_PORT
is a variable specifying the TCP port to which the/metrics
and/health
endpoints are exposed. -
Port
9090
is the default value, and you can change it to adjust to the port that youβre using on your infrastructure. -
If you don't want the agent metrics to be exposed, comment out or delete the
N9_METRICS_PORT
variable.
You can find the list of available agent metrics in the Agent documentation.
Examplesβ
After deploying the Nobl9 agent, you can check if the agent completed the initialization and is running by exposing the /health
endpoint. You can then get the following response:
{"message":"Status OK"}
You can also expose the /metrics
endpoint, for example, using Prometheus. The metrics exposed by Nobl9 have the n9
prefix, for example:
For more metrics use cases, refer to the Agent metrics documentation.