πκΈ°λ‘
νλ‘λ©ν μ°μ€ μ€μΉ μ½μ§
Hugehoo
2023. 5. 21. 16:06
ssh μλ²μμ λμ»€λ‘ νλ‘λ©ν μ°μ€λ₯Ό μ€ννλ κ³Όμ μμ μ§μμ μΌλ‘ μλ¬κ° λ°μνλ€.
μλ λͺ λ Ήμ΄λ‘ νλ‘λ©ν μ°μ€ 컨ν μ΄λλ₯Ό μ€ν(μλ)νλ€.
docker run -d -p 9090:9090 -v /etc/prometheus:/etc/prometheus prom/prometheus
λ컀 컨ν μ΄λκ° μ λλ‘ μ€νλμ§ μμ κ±Έ λ³΄κ³ docker logs {container name} λͺ λ Ήμ΄λ‘ λ‘κ·Έλ₯Ό νμΈν¨
ts=2023-05-21T06:48:25.063Z caller=main.go:479 level=error msg="Error loading config (--config.file=/etc/prometheus/prometheus.yml)" file=/etc/prometheus/prometheus.yml err="parsing YAML file /etc/prometheus/prometheus.yml: \"http://{host-ip}:8080\" is not a valid hostname"
prometheus.yml
ssh μλ²μ μμ±ν prometheus.yml νμΌμ μλμ κ°λ€.
global:
scrape_interval: 15s
scrape_configs:
- job_name: prometheus
static_configs:
- targets: ['http://{host-ip}:8080'] <<< http:// λ₯Ό μ§μμ£Όμ
metrics_path: '/actuator/prometheus' <<< μ΄κ±Έ μ§μμ£Όμ
μ 리νλ©΄ http:// λ₯Ό μ§μμ£Όκ³ metrics_path λΌμΈλ μμ νλ€.
μλλ prometheus.yml μ μ΅μ’ μμ λ³Έμ΄λ€.
global:
scrape_interval: 15s
scrape_configs:
- job_name: prometheus
static_configs:
- targets: ['{host-ip}:{port}']