This guide works with Prometheus ("Prometheus Agent" mode) and with the Grafana Agent Operator.
Imagine that you have installed the Grafana Agent Operator in the grafana
namespace with Helm:
You have created a PodMonitor or a ServiceMonitor but nothing is showing in Grafana.
Unfortunately, the Grafana Agent Operator and the Grafana Agent don't show anything in the logs that will help you diagnose if your ServiceMonitor is working.
It should show the list of monitors that the Grafana Agent Operator has found and loaded into the ConfigMap:
If your PodMonitor or ServiceMonitor doesn't show in the list:
Try restarting the Grafana Agent Operator:
Check that the labels match in the MetricsInstance:
For example, if you have:
Then, look at your PodMonitors and ServiceMonitor and check that they have that label among their labels:
The first thing you will want to do is to create a Service to access the Grafana Agent's API. Imagining that your agent is in the default namespace, the command will be:
Then, query the Grafana Agent's API:
That command will list each service monitor and show their state:
As you can see, the ServiceMonitor foo
in the namespace default
can't be reached. If the Service is also named foo
, we can check whether the /metrics
endpoint is reachable with the following command:
That should help you debug the issue further.
I have found that when I forget to set the correct labels, the Grafana Agent Operator doesn't create the corresponding entry in the grafana-agent-config
:
When a service monitor doesn't show in the Grafana Agent API: