Search

Node Exporter & Prometheus & Grafana

docker run -d \ --net="host" \ --pid="host" \ -v "/:/host:ro,rslave" \ quay.io/prometheus/node-exporter:latest \ --path.rootfs=/host
Shell
복사
docker run -d \ --name prometheus \ --net="host" \ prom/prometheus
Shell
복사
docker exec -i $(docker ps -q -f ancestor=prom/prometheus) sh -c 'cat > /etc/prometheus/prometheus.yml' << 'EOF' # my global config global: scrape_interval: 15s evaluation_interval: 15s # Alertmanager configuration alerting: alertmanagers: - static_configs: - targets: # - alertmanager:9093 # Load rules once and periodically evaluate them according to the global 'evaluation_interval'. rule_files: # - "first_rules.yml" # - "second_rules.yml" # A scrape configuration containing exactly one endpoint to scrape: scrape_configs: # Prometheus - job_name: "prometheus" static_configs: - targets: ["localhost:9090"] # Node Exporter - job_name: "node-exporter" static_configs: - targets: ["localhost:9100"] EOF
Shell
복사

파일 내용 확인

docker exec -it $(docker ps -q -f ancestor=prom/prometheus) sh -c "vi /etc/prometheus/prometheus.yml"
Shell
복사
docker restart $(docker ps -q -f ancestor=prom/prometheus)
Shell
복사
CPU 사용률 (%)
Query
메모리 사용률 (%)
Query
디스크 사용률 (%)
Query
네트워크 수신 트래픽 (bytes/sec)
Query
네트워크 송신 트래픽 (bytes/sec)
Query
시스템 로드 평균
Query
디스크 I/O 읽기 (bytes/sec)
Query
디스크 I/O 쓰기 (bytes/sec)
Query
docker run -d \ --name grafana \ --net="host" \ grafana/grafana
Shell
복사