Skip to main content

Agent metrics

Reading time: 0 minute(s) (0 words)
See how to get various agent health and resource utilization numbers available to scrape at /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​

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​

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:

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"
NOTES
  • 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:

metrics endpoint
tip

For more metrics use cases, refer to the Agent metrics documentation.

Well done! Now, you're ready to create your first SLO!