File tree Expand file tree Collapse file tree
06-monitoring/00-prometheus
01-como-funciona-prometheus
03-summaries-histograms/02-usando-summaries-histograms Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -140,3 +140,5 @@ Se incluye el total de eventos en el bucket con label `+Inf`
140140## Demo: Summaries & Histograms
141141
142142[ Demo: Summaries & Histograms] ( ../03-summaries-histograms/readme.md )
143+
144+ ## Etiquetas y Granularidad
Original file line number Diff line number Diff line change 1+ ## Setup
2+
3+ ``` Vagrantfile
4+ $script = <<-SCRIPT
5+ echo Downloading prometheus node exporter linux
6+
7+ apt-get update
8+ apt-get -y install prometheus-node-exporter
9+
10+ SCRIPT
11+
12+ Vagrant.configure("2") do |config|
13+ config.vm.box = "bento/ubuntu-20.04"
14+ config.vm.network "private_network", ip: "10.0.0.10"
15+ config.vm.provision "docker"
16+ config.vm.provision "shell", inline: $script
17+ end
18+ ```
19+
20+ > Node exporter ya está instalado pero necesiatamos invocarlo manualmente.
21+
22+ > Está máquina es accesible desde el ` host ` en la IP ` 10.0.0.10 `
23+
24+ Arrancamos la máquina de la siguiente forma:
25+
26+ ``` bash
27+ vagrant up
28+ ```
29+
30+ Para entrar en la máquina:
31+
32+ ``` bash
33+ vagrant ssh
34+ ```
35+
36+ ## 1. Web Application
37+
38+ Arrancamos la aplicación web que utilizaba la librería cliente de ` Prometheus ` para generar las métricas.
39+
40+ ``` bash
41+ docker run -d --name web \
42+ -e PORT=" 8080" \
43+ -p 8080:8080 \
44+ jaimesalas/prom-web
45+
46+ docker logs web
47+ ```
48+
49+ Vamos a realizar un par de peticiones
50+
51+ ``` bash
52+ curl http://10.0.0.10:8080/quote
53+ curl -X GET " http://10.0.0.10:8080/quote?slow=true"
54+ ```
55+
56+ > Navegar a: http://10.0.0.10:8080/metrics
57+
58+ ### Podemos encontrar las siguientes métricas
59+
60+ - ` http_requests_received_total ` - es un ` counter ` con las etiquetas para el método HTTP y el código de la respuesta
61+ - ` http_request_duration_seconds ` - es un ` histogram ` con la duración del procesado de peticiones por segundo
62+ - - ` web_delay_seconds ` - es un ` summary ` del retardo añadido a la respuesta
63+
64+ Si navegamos a http://10.0.0.10:9100/metrics estamos accediendo a las métricas expuestas por el Node Exporter.
65+
You can’t perform that action at this time.
0 commit comments