Инструменты пользователя

Инструменты сайта


service:prometheus

Различия

Показаны различия между двумя версиями страницы.

Ссылка на это сравнение

Предыдущая версия справа и слеваПредыдущая версия
Следующая версия
Предыдущая версия
service:prometheus [28.06.2024 12:38] – [Мониторинг хоста] viacheslavservice:prometheus [17.08.2024 07:34] (текущий) – [Конфиг] viacheslav
Строка 93: Строка 93:
 __meta_kubernetes_pod_annotation_prometheus_io_path __meta_kubernetes_pod_annotation_prometheus_io_path
 </code> </code>
-, поэтому их заменяют на что-то более короткое и удобное, выше ''__meta_kubernetes_namespace'' заменяется на ''kubernetes_namespace''.+, поэтому их заменяют на что-то более короткое и удобное, выше ''%%__meta_kubernetes_namespace%%'' заменяется на ''kubernetes_namespace''.
  
 Тут для подов нужно задать аннотации Тут для подов нужно задать аннотации
Строка 143: Строка 143:
 https://github.com/prometheus/node_exporter https://github.com/prometheus/node_exporter
  
 +===== Мониторинг SMART =====
 +Поставить smartctl-exporter для экспорта метрик. Docker-compose:
 +<code yaml>
 +  smartctl-exporter:
 +    image: prometheuscommunity/smartctl-exporter
 +    container_name: smartctl-exporter
 +    privileged: true
 +    user: root
 +</code>
 +
 +Внести в prometheus.yml
 +<code yaml>
 +  - job_name: 'smartctl-exporter'
 +    metrics_path: '/metrics'
 +    static_configs:
 +      - targets: ['smartctl-exporter:9633']
 +</code>
 +https://hub.docker.com/r/prometheuscommunity/smartctl-exporter\\
 +https://github.com/prometheus-community/smartctl_exporter\\
 +
 +Метрики начинаются на ''smartctl_''
 +<code>
 +{__name__=~"smartctl.*"}
 +</code>
 ===== Мониторинг nginx ===== ===== Мониторинг nginx =====
 Для nginx нужно включить там метрики ''stub_status on;'' Для nginx нужно включить там метрики ''stub_status on;''
Строка 166: Строка 190:
 } }
 </file> </file>
 +
 Dockerfile Dockerfile
 <file bash nginx/Dockerfile> <file bash nginx/Dockerfile>
Строка 232: Строка 257:
       - targets: ['nginx-prometheus-exporter:9113']       - targets: ['nginx-prometheus-exporter:9113']
 </file> </file>
 +
 +Как выглядит страница ''%%http://<nginx address>/stub_status%%'' у nginx:
 +<code>
 +Active connections:
 +server accepts handled requests
 + 26 26 14840 
 +Reading: 0 Writing: 1 Waiting: 3 
 +</code>
 +Страница ''%%http://<nginx-prometheus-exporter address>/metrics%%'' (фрагмент)
 +<code>
 +# HELP nginx_connections_accepted Accepted client connections
 +# TYPE nginx_connections_accepted counter
 +nginx_connections_accepted 26
 +# HELP nginx_connections_active Active client connections
 +# TYPE nginx_connections_active gauge
 +nginx_connections_active 3
 +# HELP nginx_connections_handled Handled client connections
 +# TYPE nginx_connections_handled counter
 +nginx_connections_handled 26
 +# HELP nginx_connections_reading Connections where NGINX is reading the request header
 +# TYPE nginx_connections_reading gauge
 +nginx_connections_reading 0
 +# HELP nginx_connections_waiting Idle client connections
 +# TYPE nginx_connections_waiting gauge
 +nginx_connections_waiting 2
 +# HELP nginx_connections_writing Connections where NGINX is writing the response back to the client
 +# TYPE nginx_connections_writing gauge
 +nginx_connections_writing 1
 +# HELP nginx_exporter_build_info A metric with a constant '1' value labeled by version, revision, branch, goversion from which nginx_exporter was built, and the goos and goarch for the build.
 +# TYPE nginx_exporter_build_info gauge
 +nginx_exporter_build_info{branch="HEAD",goarch="amd64",goos="linux",goversion="go1.22.3",revision="fce2d387946038e4199eab79ad9e7b809abab330",tags="unknown",version="1.1.2"} 1
 +# HELP nginx_http_requests_total Total http requests
 +# TYPE nginx_http_requests_total counter
 +nginx_http_requests_total 14995
 +# HELP nginx_up Status of the last metric scrape
 +# TYPE nginx_up gauge
 +nginx_up 1
 +</code>
 +
 +Литература:
 +https://hub.docker.com/r/nginx/nginx-prometheus-exporter\\
 +https://hub.docker.com/r/prom/prometheus\\
 +[[https://kamaok.org.ua/?p=3224|Мониторинг Nginx в Prometheus]]\\
 ===== Howto ===== ===== Howto =====
 ==== unixtime to datetime ==== ==== unixtime to datetime ====
 Значение * 1000, выставить формат отображения Datetime (Field -> Unit -> Datetime). Значение * 1000, выставить формат отображения Datetime (Field -> Unit -> Datetime).
  
service/prometheus.1719578302.txt.gz · Последнее изменение: 30.07.2024 19:20 (внешнее изменение)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki