ãã®è¨äºã¯ Mackerel ãã©ã°ã¤ã³ã¢ããã³ãã«ã¬ã³ãã¼(å ¨é¨CREï¼ ã®14æ¥ç®ã§ãã
ããã§ã¯14æ¥ç®ã¯ mackerel-plugin-mongodb
ã§ãã
mackerel-plugin-mongodbã¯ããã¥ã¡ã³ãæåãã¼ã¿ãã¼ã¹ã®NoSQL MongoDB
ã®å°ç¨ãã©ã°ã¤ã³ã§ãã
ã¤ã³ã¹ãã¼ã«ã¨è¨å®æé
MongoDBã®ãã©ã°ã¤ã³ã¯ db.serverStatus()
ã®ä¸èº«ãå¯è¦åãã¦ããããã©ã°ã¤ã³ã§ãã
æ¬ãã©ã°ã¤ã³ã¯ãã©ã°ã¤ã³éã¨ãã¦æä¾ãã¦ããããã±ã¼ã¸ã® mackerel-agent-plugins
ã«å«ã¾ãã¦ãã¾ãã
ã¤ã³ã¹ãã¼ã«å
㯠/usr/bin/mackerel-plugin-mongodb
ã§ãã
次ã«Mackerelã®ãã©ã°ã¤ã³ã¯ã³ãã³ãã§ãã®ã§å®è¡ããäºãã§ãã¾ãã
â»MongoDBã®ãã¼ã¸ã§ã³ã¯3.2ã使ã£ã¦ãã¾ãã
-- /usr/bin ã¯PATHãéã£ã¦ããã®ã§çç¥åºæ¥ã¾ã # mackerel-plugin-mongodb mongodb.opcounters.opcounters_insert 0.000000 1513220008 mongodb.opcounters.opcounters_query 0.000000 1513220008 mongodb.opcounters.opcounters_update 0.000000 1513220008 mongodb.opcounters.opcounters_delete 0.000000 1513220008 mongodb.opcounters.opcounters_getmore 0.000000 1513220008 mongodb.opcounters.opcounters_command 720.000000 1513220008 mongodb.connections.connections_current 1.000000 1513220008
è¨å®ãã¡ã¤ã«ã§ããmackerel-agent.confã¯æ¨æºã§ã¯ /etc/mackerel-agent/mackerel-agent.conf
ã«ã¤ã³ã¹ãã¼ã«ããã¾ãã
ãã¡ãã«ä¸è¨ã®ã¨ãã追è¨ãã¾ãããã
[plugin.metrics.mongodb] command = "mackerel-plugin-mongodb"
以ä¸ãè¡ã£ãä¸ã§mackerel-agentãåèµ·åãã¦ãã ããã
è¦ããã¡ããªãã¯
MongoDBã®serverStatusã¯ã¨ã¦ãå¤ãã®æ å ±ãã¨ãã¾ããmackerel-plugin-mongodbã¯ã·ã³ãã«ã«ä½¿ããããæ å ±ã«ãã©ã¼ã«ã¹ãã¦åéãã¦ãã¾ãã
serverStatus — MongoDB Manual 3.6
åã°ã©ãå®ç¾©ãã¨ã«èª¬æãã¾ãã
ããã§ã¯åã°ã©ãå®ç¾©ãã¨ã«èª¬æãã¾ãã
ã¾ã表ã«åºã¦ããdiffã¨ã¯ãã©ã°ã¤ã³ä¸ã§å·®åå¤è¨ç®ããããã©ããã§ãã
â¯
ã¨ãªã£ã¦ããé
ç®ã¯ãã©ã°ã¤ã³ã§ååã®å®è¡æã®å¤ã¨å·®åå¤è¨ç®ãã¦åºåãã¦ãã¾ãã
MongoDB Connections
ã¡ããªãã¯å(ã©ãã«) | ãã©ã°ã¤ã³ã®åºåå | diff | 説æ |
---|---|---|---|
current | mongodb.connections.connections_current | ã¼ | æ¥ç¶æ° |
ãã¡ãã¯MongoDBã«æ¥ç¶ãã¦ããæ°ã§ãã
MongoDBã¯å¿è«ãã¼ã¿ãã¼ã¹ã§ãã®ã§æ¥ç¶æ°ãç£è¦ã¯å¤§äºã§ãã
ãããMongoDBã®ã®maxConnsã®ããã©ã«ãå¤ã¯20000ã§ãã
ï¼3.6ã§ã¯ãã®ä¸éãå»æ¢ããã¦ããã®ã§ç¡å¶éã§ãï¼
ããããã¨ã©ããªããã¨è¨ãã¨å
ã«OSã®ããã»ã¹æ°ã®ä¸éã«ã²ã£ãããã¾ãã
UNIXã®ããã»ã¹æ°ã®ä¸é㯠ulimit -u
ã§ç¢ºèªã§ãã¾ãã®ã§åããã¦ç¢ºèªãã¾ãããã
# ulimit -u 3904
ä¸éå¶éã調æ´ããã人åãã«MongoDBã®å ¬å¼ããã¥ã¡ã³ããåºã¦ãã¾ãã
UNIX ulimit Settings — MongoDB Manual 3.6
ãã®ããã«MongoDBã¯ã³ãã¯ã·ã§ã³ãOSã®éçã¾ã§ä½¿ããã¡ã§ãã®ã§MongoDBã®ã³ãã¯ã·ã§ã³æ°ã¨åããã¦ã·ã¹ãã ã¡ããªãã¯ã¹ã確èªãã¾ãããã ã¡ã¢ãªã®ã¨ã©ã¼ãåºã¦ããã®ã§MongoDB Connectionsã確èªããããããã³ãã¯ã·ã§ã³ãè²¼ã£ã¦ããã¨ãããã¨ããããã¾ãã
MongoDB opcounters
ã¡ããªãã¯å(ã©ãã«) | ãã©ã°ã¤ã³ã®åºåå | diff | 説æ |
---|---|---|---|
Insert | mongodb.opcounters.opcounters_insert | ⯠| ä¸åéãããã®Insertæ° |
Query | mongodb.opcounters.opcounters_query | ⯠| ä¸åéãããã®Queryæ° |
Update | mongodb.opcounters.opcounters_update | ⯠| ä¸åéãããã®Updateæ° |
Delete | mongodb.opcounters.opcounters_delete | ⯠| ä¸åéãããã®Deleteæ° |
Getmore | mongodb.opcounters.opcounters_getmore | ⯠| ä¸åéãããã®Getmoreæ° |
Command | mongodb.opcounters.opcounters_command | ⯠| ä¸åéãããã®Commandæ° |
ãã¡ãã¯MongoDBã§å®è¡ããã¦ããããããã®æ°ã§ãã ããã«ãã£ã¦ã³ãã¯ã·ã§ã³ã®å²ã«Queryã¯ãããªã«æãã¦ãªãã£ãããæ´æ°ã®éãå¤ããªã©ä½ãèµ·ãã£ã¦ãããä¸ç®çç¶ã§ãã ã¢ããªã±ã¼ã·ã§ã³ããªãªã¼ã¹ããç´å¾ãªã©ã¯æ¯ãèããå¤ãããããã¨ããã§ãã®ã§ç¢ºèªãããããã¨è¯ãã§ãããã
14æ¥ç®ã¯ããã¥ã¡ã³ãæåãã¼ã¿ãã¼ã¹ã®MongoDBãã©ã°ã¤ã³ã«ã¤ãã¦ã®èª¬æã§ããã
ã¿ãªããiptablesã¯ä½¿ã£ã¦ã¾ããï¼ææ¥ã¯iptablesã® ip_conntrack
ã®ç£è¦ã§ãã
å¼ãç¶ããMackerel ãã©ã°ã¤ã³ã¢ããã³ãã«ã¬ã³ãã¼ãã楽ãã¿ã«ï¼