Search code examples
dockerprometheusgrafanaprometheus-alertmanagerprometheus-node-exporter

how expose nginx metrics in prometheus?


so my question is the way to expose Nginx metrics it's only with docker? because I had read in internet and I saw something like this https://github.com/nginxinc/nginx-prometheus-exporter what I want is to monitor the Nginx log, for failed responses.

$ docker run -p 9113:9113 nginx/nginx-prometheus-exporter:0.8.0 -nginx.scrape-uri http://<nginx>:8080/stub_status

Solution

  • To summarize our discussion in the comments:

    1. The node-prometheus-exporter is handy tool to get the Nginx in-built metrics and send it to Prometheus. But if you need any specialised metric, you have to either modify the source code or create your own solution.
    2. I think you specifically want to check Nginx logs for failed responses. This warrants a log aggregation and/or parsing tool and the corresponding connection to Prometheus. For this you can look at the ELK family for something nice or built a quick script yourself.