Skip to main content

Agent Metrics

See how to get various Agent health and resource utilization numbers available to scrape at /health and /metrics endpoints.

You can enable 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:latest
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.

  • The 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!