[Using GCP] Stackdriver Third-party Appication Monitoring (3.MongoDB)

글쓴이 : 윤성재 (공작명왕)
E-mail : <gongjak@gmail.com>
Facebook : < https://www.facebook.com/sungjae.yun >

MongoDB Plugin

1.MongoDB 설치와 시작

< Debian 8 >

sudo apt-get install mongodb

< CentOS 7 >

sudo yum install mongodb-server mongodb
sudo systemctl start mongod

2.사전 준비

모니터링을 위해 clusterMonitor Role를 가진 유저를 admin database에 생성해준다. db.auth 명령어에서 “1”이 나오면 정상으로 인증에 성공한 것이다.

< Debian 8 >

mongo
> use admin
> show users;
> db.addUser("stackuser","stack1234","clusterMonitor");
> db.auth("stackuser","stack1234");
1
> exit

< CentOS 7 >

mongo
> use admin
> show users;
> db.createUser( { user: "stackuser", pwd: "stack1234", roles: ["clusterMonitor"] } )
> db.auth("stackuser","stack1234");
1
> exit

3.Plugin 설치

cd /opt/stackdriver/collectd/etc/collectd.d/ && sudo curl -O https://raw.githubusercontent.com/Stackdriver/stackdriver-agent-service-configs/master/etc/collectd.d/mongodb.conf

mongodb.conf 파일을 열어 STATS_USER, STATS_PASS 의 주석처리(“#”)을 지워주고, 앞에서 생성한 유저의 ID와 Password로 바꿔준다.

4.Stackdriver Agent 재시작

< Debian 8 >

sudo service stackdriver-agent restart

< CentOS 7 >

sudo systemctl restart stackdriver-agent

5.Monitoring 확인

Monitoring -> Resources -> Instances

각 서버를 클릭해보자. stackdriver agent가 plugin이 정상으로 동작하여 정보를 제대로 가져온다면 Monitoring의 오른쪽 그래프 윗부분에서 다음과 같은 화면을 볼 수 있다.

stackdriver-2-image04

[ 출처: Flickr, gongjak1 ]

6.현재 모니터링 가능한 항목

  • Current Connections (count): The number of active connections to MongoDB.
  • Global Lock Hold Time (ms): How long the global lock has been held.
  • Mapped Memory (bytes): The amount of mapped memory used by MongoDB. This is roughly equivalent to the total size of your database, due to the use of memory mapped files.
  • Virtual Memory (bytes): The amount of virtual memory used by MongoDB. If the virtual memory size is significantly larger than mapped memory size (e.g. 3 or more times), this may indicate a memory leak.
  • Resident Memory (bytes): The amount of resident memory that is used by MongoDB. This is the amount of RAM being physically used by the database.
  • Operations [command, delete, getmore, insert, query, update] (count/s): The number of [command, delete, getmore, insert, query, update] operations executed per second.
  • Database [Collection, Index, Object, Extents] Count (count): The number of [collections, indices, objects, extents] currently in the database.
  • Database Data Size (bytes): The size of the data currently in the database.
  • Database Storage Size (bytes): The size of the storage currently allocated to the database.
  • Database Index Size (bytes): The size of the index for the database.

답글 남기기

아래 항목을 채우거나 오른쪽 아이콘 중 하나를 클릭하여 로그 인 하세요:

WordPress.com 로고

WordPress.com의 계정을 사용하여 댓글을 남깁니다. 로그아웃 /  변경 )

Facebook 사진

Facebook의 계정을 사용하여 댓글을 남깁니다. 로그아웃 /  변경 )

%s에 연결하는 중

%d 블로거가 이것을 좋아합니다: