尊龙凯时人生就是搏

ÔõÑùÔÚLinuxÉÏÉèÖø߿ÉÓõÄÈÝÆ÷¼à¿Ø

ÔõÑùÔÚlinuxÉÏÉèÖø߿ÉÓõÄÈÝÆ÷¼à¿Ø

¸ÅÊö£º

Ëæ×ÅÈÝÆ÷ÊÖÒÕµÄÉú³¤£¬Ô½À´Ô½¶àµÄÆóÒµ½«Ó¦ÓóÌÐò°²Åŵ½ÈÝÆ÷ÖС£¶øÕë¶ÔÕâЩÈÝÆ÷µÄ¼à¿ØÔò³ÉΪÁËÒ»¸öÖ÷ÒªµÄÐèÇó¡£±¾ÎĽ«ÏÈÈÝÔõÑùÔÚlinuxÉÏÉèÖø߿ÉÓõÄÈÝÆ÷¼à¿Ø¡£ÎÒÃǽ«Ê¹ÓÃPrometheus×÷Ϊ¼à¿Øϵͳ£¬Grafana×÷Ϊ¿ÉÊÓ»¯¹¤¾ß£¬²¢Ê¹ÓÃDocker SwarmÀ´ÊµÏÖÈÝÆ÷µÄ¸ß¿ÉÓÃÐÔ¡£

°ì·¨1£º×°ÖÃDocker Swarm

Docker SwarmÊÇDocker¹Ù·½ÌṩµÄÈÝÆ÷±àÅŹ¤¾ß£¬ÓÃÓÚʵÏÖÈÝÆ÷µÄ¸ß¿ÉÓÃÐÔ¡£Ê×ÏÈ£¬ÄãÐèÒªÔÚÄãµÄLinuxЧÀÍÆ÷ÉÏ×°ÖÃDocker Swarm¡£Çëƾ֤Docker Swarm¹Ù·½ÎĵµµÄÖ¸Òý¾ÙÐÐ×°Öá£

°ì·¨2£º×°ÖÃPrometheusºÍGrafana

PrometheusÊÇÒ»ÖÖ¿ªÔ´µÄ¼à¿Ø½â¾ö¼Æ»®£¬ÆäÌṩÁËÇ¿Ê¢µÄ¼à¿Ø¹¦Ð§ºÍÎÞаµÄÅÌÎÊÓïÑÔ¡£GrafanaÊÇÒ»¸öÊ¢ÐеĿÉÊÓ»¯¹¤¾ß£¬¿ÉÒÔÓÃÀ´Õ¹Ê¾ºÍÆÊÎö¼à¿ØÊý¾Ý¡£

Ê×ÏÈ£¬ÄãÐèÒªÔÚÄãµÄLinuxЧÀÍÆ÷ÉÏ×°ÖÃPrometheusºÍGrafana¡£Äã¿ÉÒÔʹÓÃÒÔÏÂÏÂÁîÀ´×°Öãº

docker service create --name prometheus 
--publish 9090:9090 
--mount type=bind,source=/path/to/prometheus.yml,target=/etc/prometheus/prometheus.yml 
prom/prometheus

docker service create --name grafana 
--publish 3000:3000 
--env "GF_SECURITY_ADMIN_PASSWORD=yourpassword" 
grafana/grafana

µÇ¼ºó¸´ÖÆ

ÉÏÊö´úÂ뽫»®·ÖÔÚ9090¶Ë¿ÚºÍ3000¶Ë¿Ú½¨ÉèÁ½¸öÈÝÆ÷£¬Ò»¸öÊÇPrometheusÈÝÆ÷£¬ÁíÒ»¸öÊÇGrafanaÈÝÆ÷¡£Ç뽫/path/to/prometheus.ymlÌ滻ΪÄã×Ô¼ºµÄÉèÖÃÎļþËùÔÚ·¾¶£¬²¢½«yourpasswordÌ滻ΪÄã×Ô¼ºÉ趨µÄÃÜÂë¡£

°ì·¨3£ºÉèÖÃPrometheus¼à¿ØЧÀÍ

½ÓÏÂÀ´£¬ÎÒÃÇÐèÒªÉèÖÃPrometheusÀ´¼à¿ØÎÒÃǵÄÈÝÆ÷¡£ÔÚÄãµÄLinuxЧÀÍÆ÷ÉϽ¨ÉèÒ»¸öÃûΪprometheus.ymlµÄÎļþ£¬²¢Æ¾Ö¤ÒÔÏÂʾÀý¾ÙÐÐÉèÖãº

global:
  scrape_interval: 15s
  evaluation_interval: 15s

scrape_configs:
- job_name: 'prometheus'
  metrics_path: '/metrics'
  static_configs:
  - targets: ['localhost:9090']

- job_name: 'node_exporter'
  metrics_path: '/metrics'
  static_configs:
  - targets: ['localhost:9100', 'node1:9100', 'node2:9100']

- job_name: 'docker'
  metrics_path: '/metrics'
  static_configs:
  - targets: ['localhost:9323']

µÇ¼ºó¸´ÖÆ

ÉÏÊöÉèÖÃÎļþ½ç˵ÁËÈý¸ö¼à¿ØʹÃü£¬»®·ÖÊǶÔPrometheus×ÔÉíµÄ¼à¿Ø¡¢¶ÔÖ÷»ú½ÚµãµÄ¼à¿ØºÍ¶ÔDockerÈÝÆ÷µÄ¼à¿Ø¡£Ç뽫ÆäÖеÄnode1ºÍnode2Ì滻ΪÄã×Ô¼ºµÄ½ÚµãµØµã¡£

È»ºó£¬ÔÚÄãµÄLinuxЧÀÍÆ÷ÉÏÆô¶¯PrometheusÈÝÆ÷£º

docker service create --name prometheus 
--publish 9090:9090 
--mount type=bind,source=/path/to/prometheus.yml,target=/etc/prometheus/prometheus.yml 
prom/prometheus

µÇ¼ºó¸´ÖÆ

°ì·¨4£ºÉèÖÃGrafana

ÏÖÔÚ£¬ÎÒÃÇÐèÒªÉèÖÃGrafanaÀ´¿ÉÊÓ»¯ÎÒÃǵļà¿ØÊý¾Ý¡£Ê×ÏÈ£¬·­¿ªÄãµÄä¯ÀÀÆ÷²¢»á¼ûhttp://yourserverip:3000£¬Ê¹ÓÃÄãÔÚ֮ǰµÄ×°Öð취ÖÐÉèÖõÄÃÜÂëµÇ¼Grafana¡£

È»ºó£¬Ç°ÍùGrafanaµÄÊý¾ÝÔ´½çÃæ²¢Ìí¼ÓÒ»¸öеÄÊý¾ÝÔ´¡£Ñ¡ÔñPrometheus×÷ΪÊý¾ÝÔ´ÀàÐÍ£¬²¢ÉèÖÃPrometheusµÄ»á¿´·¨Ö·£¨ÀýÈ磺http://yourserverip:9090£©¡£

½ÓÏÂÀ´£¬Äã¿ÉÒÔ½¨ÉèÒ»¸öеÄÒDZí°å²¢Ìí¼Ó×Ô½ç˵µÄÃæ°åÀ´Õ¹Ê¾Äã¸ÐÐËȤµÄ¼à¿ØÖ¸±ê¡£

½áÂÛ£º

ͨ¹ýÒÔÉÏ°ì·¨£¬ÎÒÃÇÀֳɵØÔÚLinuxÉÏÉèÖÃÁ˸߿ÉÓõÄÈÝÆ÷¼à¿Ø¡£Ê¹ÓÃPrometheusºÍGrafana£¬ÎÒÃÇ¿ÉÒÔÎÞаµØÍøÂç¡¢´æ´¢ºÍ¿ÉÊÓ»¯ÈÝÆ÷µÄ¼à¿ØÊý¾Ý¡£Õ⽫ÓÐÖúÓÚÎÒÃÇʵʱ·¢Ã÷²¢½â¾öÈÝÆ÷ÔËÐÐÖеÄÎÊÌ⣬ÌáÉýÓ¦ÓóÌÐòµÄ¿É¿¿ÐÔºÍÐÔÄÜ¡£

Ï£Íû±¾ÎĹØÓÚÄãÉèÖø߿ÉÓõÄÈÝÆ÷¼à¿ØÓÐËù×ÊÖú£¡

ÒÔÉϾÍÊÇÔõÑùÔÚLinuxÉÏÉèÖø߿ÉÓõÄÈÝÆ÷¼à¿ØµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí£¬°æȨÕùÒéÓë±¾Õ¾Î޹أ¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í尊龙凯时人生就是搏ÂËÓÍ»úÍø¹Ù·½Ì¬¶È£¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ£¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢£¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢£¬ÇëÄúÁ¬Ã¦ÁªÏµ尊龙凯时人生就是搏ʵʱÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ尊龙凯时人生就是搏

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎ壬9:30-18:30£¬½ÚãåÈÕÐÝÏ¢

QR code
sitemap¡¢ÍøÕ¾µØͼ