728x90
반응형
GCP VM Machine 에 MongoDB를 사용하는 경우 MongoDB Metrics 수집이 필요한 경우 ops-agent에 MongoDB agent를 설치하여 모니터링 한다.
구성방법
VM Machine 접속
$ ssh <VM external IP>
ops-agent 설정
# Configures Ops Agent to collect telemetry from the app and restart Ops Agent.
set -e
# Create a back up of the existing file so existing configurations are not lost.
sudo cp /etc/google-cloud-ops-agent/config.yaml /etc/google-cloud-ops-agent/config.yaml.bak
# Configure the Ops Agent.
sudo tee /etc/google-cloud-ops-agent/config.yaml > /dev/null << EOF
metrics:
receivers:
mongodb:
type: mongodb
insecure: true
service:
pipelines:
mongo:
receivers: [mongodb]
logging:
receivers:
mongodb:
type: mongodb
service:
pipelines:
mongo:
receivers: [mongodb]
EOF
sudo service google-cloud-ops-agent restart
sleep 60
로그 및 매트릭 확인
resource.type="gce_instance"
log_id("mongodb")
fetch gce_instance
| metric 'workload.googleapis.com/mongodb.memory.usage'
| every 1m
참고:
728x90
반응형
'Programming > Google Cloud(GCP)' 카테고리의 다른 글
가비아 도메인 Cloud Run (GCP)에 연결하기 (64) | 2023.03.19 |
---|
댓글