새로운 컨테이너에서 해당명령어를 실행
-d, --detach : 백그라운드에서 컨테이너 실행 및 컨테이너 ID 출력
--name : 컨테이너 이름 할당
--network : 컨테이너를 네트워크에 연결
-v, --volume: 컨테이너 볼륨을 호스트 볼륨에 바인딩
컨테이너 목록 출력
-a, -all 전부
로그 출력
-f, --follow 로그 추적
하나 이상의 컨테이너 재시작
제거
-f, --force 강제 제거
설정 파일 경로
메트릭 저장소 경로
HTTP 통신을 통한 Prometheus reload 및 shutdown 활성화
얼마나 오랫동안 데이터를 유지할지
보존 할 수 있는 데이터의 크기를 제한 할 수 있다, 지정된 용량이 초과되면 이전 데이터는 자동으로 삭제됨.
지정된 단계 이상으로 로그를 보임 [debug, info, warn, error]
[도커로 프로메테우스 설치]
scrape_configs:
- job_name: 'prometheus'
scrape_interval: 3s
scrape_timeout: 1s
static_configs:
- targets:
- localhost:9090
docker run --rm prom/prometheus:v2.29.2
docker exec -it zen_wu sh ("zen_wu" 는 tab쳐서 나오 것 )
- /prometheus $
- /prometheus $ id
- UID=65534(nobody) gid=65534(nobody) // 디렉토리 권한설정을 사용자와 맞춰줘야함
docker exec -it prometheus /bin/bash
docker inspect prometheus
docker run \
-d --name=prometheus \
--net=host \
-v /prometheus/config:/etc/prometheus \
-v /prometheus/data:/data \
prom/prometheus:v2.29.2 \
--config.file=/etc/prometheus/prometheus.yml \
--storage.tsdb.path=/data
c0e5e113da4ef30c96f4069ff548fc55a48e73e5b756ce1197349f416bf1108c
-------------에러날떄 도커 stop & delete 후 다시 시작-----------
https://blog.d0ngd0nge.xyz/docker-container/
https://prometheus.io/docs/prometheus/latest/management_api/
[Health check]
curl localhost:9090/-/healthy -D /dev/stdout
[Readiness check]
curl localhost:9090/-/ready -D /dev/stdout
[Reload, Quit] 은 403 에러.
--web.enable-lifecycle 추가하고 다시실행
[Reload] restart 하지 않고도 prometheus 설정 변경
docker run -d --name=prometheus --net=host -v /prometheus/config:/etc/prometheus -v /prometheus/data:/data prom/prometheus:v2.29.2 --config.file=/etc/prometheus/prometheus.yml --storage.tsdb.path=/data --web.enable-lifecycle
HTTP/1.1 200 OK
[Public IP]
http://xxx.xxx.xxx.xxx:9090/config
docker run -d --name=prometheus --net=host -v /prometheus/config:/etc/prometheus -v /prometheus/data:/data prom/prometheus:v2.29.2 --config.file=/etc/prometheus/prometheus.yml --storage.tsdb.path=/data --web.enable-lifecycle --storage.tsdb.retention.time=20d
에러가 뜨지 않음.
--log.level=debug 로 변경
docker run -d --name=prometheus --net=host -v /prometheus/config:/etc/prometheus -v /prometheus/data:/data prom/prometheus:v2.29.2 --config.file=/etc/prometheus/prometheus.yml --storage.tsdb.path=/data --web.enable-lifecycle --storage.tsdb.retention.time=20d --log.level=debug