Norikra ã§ã¯ã¨ãªããçµæã Mackerel ã«æãããå ´åãããã¾ã§ã¯ fluent-plugin-norikra ã§åå¾ã㦠fluent-plugin-mackerel ã§éä¿¡ãããã¨ããä½ãã«ãã¦ããã¨æãã¾ãã
Norikra 1.2以éã§ã¯ Listener plugin ã使ããããã«ãªã£ãã®ã§ãã¯ã¨ãªçµæãç´æ¥ Norikra ä¸ã§æ±ããã¨ãå¯è½ã«ãªãã¾ããã
ã¨ãããã¨ã§ãnorikra-listener-mackerel (rubygems) ãæ¸ãã¾ãããNorikra åä½ã§ãã¯ã¨ãªçµæã Mackerel ã®ãµã¼ãã¹ã¡ããªã¯ã¹ã¨ãã¦éä¿¡ã§ãã¾ãã
使ãæ¹
$ gem install norikra-listener-mackerel
norikra ãåä½ãã ruby ã§ã¤ã³ã¹ãã¼ã«ããã°ãnorikra start æã«èªåçã«èªã¿è¾¼ã¾ãã¾ãã
ã¯ã¨ãªãé常ã¨åãããã«æ¸ããgroup ã MACKEREL(service_name,api_key)
ã¨ãã¦ç»é²ãã¾ãã
- Mackerel ã®ãµã¼ãã¹å: nginx
- metricsã®prefix: status
- API Key: bpzpdhjzmTnkp+ZkE3bFX2EcoWG+N1wqy2x5wVdAr7o=
ã®å ´åã¯ä»¥ä¸ã®ããã«ãªãã¾ãã
MACKEREL(nginx.status,bpzpdhjzmTnkp+ZkE3bFX2EcoWG+N1wqy2x5wVdAr7o=)
API keyãæªæå®ã®å ´åã¯ç°å¢å¤æ° MACKEREL_APIKEY
ããèªãããã«ãªã£ã¦ãã¾ãã
ãã¨ãã°ãã¢ã¯ã»ã¹ãã°ããã¹ãã¼ã¿ã¹ã³ã¼ãã1åãã¨ã«ã«ã¦ã³ããã¦ãç§éã®ãªã¯ã¨ã¹ãæ°ã¨ãã¦éä¿¡ãããã¨ããããããã¦ã¼ã¹ã±ã¼ã¹ã ã¨ãããªæãã§ããã
SELECT COUNT(1, 200 <= status AND status <= 299) / 60.0 AS rate_2xx, COUNT(1, 300 <= status AND status <= 399) / 60.0 AS rate_3xx, COUNT(1, 400 <= status AND status <= 499) / 60.0 AS rate_4xx, COUNT(1, 500 <= status AND status <= 599) / 60.0 AS rate_5xx FROM nginx_access.win:time_batch(1 min) -- group: MACKEREL(nginx.status,bpzpdhjzmTnkp+ZkE3bFX2EcoWG+N1wqy2x5wVdAr7o=)
ãã㧠Norikra ã« fluentd ãããã°ãæµãè¾¼ãã§ããã°ãMackerel ã«èªåçã«ãµã¼ãã¹ã¡ããªã¯ã¹ãå®ç¾©ããã¦ã°ã©ããã§ããããã¾ãã(ãµã¼ãã¹ã®å®ç¾©ã ãã¯äºåã«ãã¦ããå¿ è¦ãããã¾ãã)
Norikra ããå¤ãåå¾ãã¦éä¿¡ãã fluentd ãä¸è¦ã«ãªãã®ã§ããããæ軽ã«ãªãã¾ããã