Версия программы: ================= prometheus-json_exporter-0.7.0-alt2 Стенды с ошибкой, обновлен. до Sisyphus: ======================================== Alt Workstation 11 Шаги, приводящие к ошибке: ========================== 1. Установить пакеты prometheus-json_exporter, prometheus: # apt-get install prometheus-json_exporter prometheus 2. Добавить json_exporter в prometheus: # echo " - job_name: 'json_exporter' static_configs: - targets: ['localhost:7979'] # URL экспортера " >> /etc/prometheus/prometheus.yml 3. Запустить сервис prometheus и проверить статус: # systemctl enable --now prometheus && sleep 5 && systemctl status prometheus 4. Создать конфиг для json_exporter # vim /etc/prometheus/json_exporter.yml: modules: default: metrics: - name: "service_status" path: "{.status}" help: "Service health status (1=healthy, 0=unhealthy)" value_type: gauge - name: users_online path: "{.users_online}" help: "Number of active users" value_type: counter 5. Добавить конфиг в сервис prometheus-json_exporter и запустить его: # vim /lib/systemd/system/prometheus-json_exporter.service: ExecStart=/usr/bin/json_exporter --web.systemd-socket $OPTIONS -> ExecStart=/usr/bin/json_exporter --config.file /etc/prometheus/json_exporter.yml # systemctl enable --now prometheus-json_exporter && sleep 5 && systemctl status prometheus-json_exporter json_exporter можно запустить еще так: # json_exporter --config.file /etc/prometheus/json_exporter.yml 6. Запустить тестовый HTTP-сервер: # python3 -m http.server 8002 & echo '{"status": 1, "users_online": 42}' > test.json 7. Выполнить запрос # curl "http://localhost:7979/probe?target=http://localhost:8002/test.json" 8. Проверить метрики : # curl http://localhost:7979/metrics | grep -E "service_status|users_online" Ожидаемый результат: ==================== Вывод метрик из prometheus Фактический результат: ====================== Метрики не отображаются в prometheus: # curl http://localhost:7979/metrics | grep -E "service_status|users_online" % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 9880 0 9880 0 0 2846k 0 --:--:-- --:--:-- --:--:-- 3216k При выполнении запроса # curl "http://localhost:7979/probe?target=http://localhost:8002/test.json", следующий вывод: # HELP service_status Service health status (1=healthy, 0=unhealthy) # TYPE service_status untyped service_status 1 # HELP users_online Number of active users # TYPE users_online untyped users_online 42
Created attachment 18807 [details] Метрики в prometheus/graph После того, как поменяла конфиг prometheus для добавления json_exporter на: - job_name: 'json_exporter' metrics_path: /probe static_configs: - targets: #['localhost:8000'] # URL экспортера - http://localhost:8000/test.json relabel_configs: - source_labels: [__address__] target_label: __param_target - source_labels: [__param_target] target_label: instance - target_label: __address__ replacement: localhost:7979 Стали отображаться метрики в http://localhost:9090/graph (См. Вложение) Но на http://localhost:7979/metrics по прежнему не отображаются
prometheus-json_exporter-0.7.0-alt3 -> sisyphus: Sun Aug 24 2025 Andrey Cherepanov <cas@altlinux> 0.7.0-alt3 - Removed socket file, fixed service file (ALT #54679). - Set program version.
Версия пакета: prometheus-json_exporter-0.7.0-alt3.x86_64 Ошибка актуальна