agent icon indicating copy to clipboard operation
agent copied to clipboard

How are NGINX Agent monitoring reports presented through Prometheus

Open myfourteen opened this issue 2 years ago • 8 comments

myfourteen avatar Sep 23 '23 03:09 myfourteen

Hi @meng-x-zhou, we have an example here (https://github.com/nginx/agent/tree/main/examples/grafana-metrics) that you can follow which shows how to configure the NGINX Agent and Prometheus to collect metrics. It also has a Grafana dashboard as well to visualise the metrics.

dhurley avatar Sep 26 '23 09:09 dhurley

Is there an instruction manual

myfourteen avatar Sep 26 '23 10:09 myfourteen

Here are the instructions on how to enable the NGINX Agent API: https://github.com/nginx/agent#enabling-the-rest-interface Then to setup Prometheus you can follow the official Prometheus docs: https://prometheus.io/docs/introduction/first_steps/ In the configuration section (https://prometheus.io/docs/introduction/first_steps/#configuring-prometheus), you just need to set the scrape config target to be the NGINX Agent IP & port.

dhurley avatar Sep 26 '23 12:09 dhurley

After configuring the NGINX Agent API interface, accessing and returning 404 page not found

[root@master sbin]# curl localhost:8038 404 page not found

myfourteen avatar Sep 26 '23 12:09 myfourteen

Try this curl localhost:8038/metrics/ to get your metrics

dhurley avatar Sep 26 '23 13:09 dhurley

May I ask how the three line charts in the Grafana dashboard were generated? Why is there no data on the location of the line charts when I connect them to the Grafana dashboard

myfourteen avatar Sep 27 '23 07:09 myfourteen

agent

myfourteen avatar Sep 27 '23 07:09 myfourteen

I believe the reason you aren't seeing some metrics is because the NGINX Agent relies on the NGINX API being configured. If you are using NGINX Plus add the following to your NGINX config

location /api/ {
    api write=on;
    allow 127.0.0.1;
    deny all;
}

otherwise if you are using the open source version of NGINX add the following

location /api {
    stub_status;
    allow 127.0.0.1;
    deny all;
}

dhurley avatar Sep 28 '23 10:09 dhurley

Hi @meng-x-zhou

As there hasn't been any further response, I'm going to close this issue. If you have any other questions or need further assistance, please feel free to reopen this issue or create a new one.

Thank you!

Best regards, @oCHRISo

oCHRISo avatar May 23 '24 08:05 oCHRISo