From 54802016cb34cef2d7cd02bd4cf2008087154638 Mon Sep 17 00:00:00 2001 From: Onong Tayeng Date: Mon, 3 Jun 2024 13:54:45 +0530 Subject: [PATCH] docs: prometheus howto --- docs/prometheus.md | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 docs/prometheus.md diff --git a/docs/prometheus.md b/docs/prometheus.md new file mode 100644 index 00000000..a178439d --- /dev/null +++ b/docs/prometheus.md @@ -0,0 +1,41 @@ +# Prometheus howto + +Create a `prometheus.yml` file: + +``` +scrape_configs: +- job_name: myapp + scrape_interval: 10s + static_configs: + - targets: + - 172.18.0.2:8888 + - 172.18.0.3:8888 + - 172.18.0.4:8888 + - 172.18.0.6:8888 +``` + +Replace the IP addrs under `targets` to the actual IP addrs of the worker nodes +in the cluster. + + +Run the prometheus container: + + +```bash +docker run --network host -p 9090:9090 -v $PWD/prometheus.yml:/etc/prometheus/prometheus.yml prom/prometheus & +``` + + +Point browser to the IP addr of the node where prometheus is running: + +``` +http://:9090 +``` + + +Another simple test to see if prometheus is working: + + +```bash +$ curl http://:8888/metrics +```