尊龙凯时人生就是博

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

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

Ëæ×ÅÈÝÆ÷ÊÖÒÕµÄÉú³¤£¬ÈÝÆ÷±àÅÅƽ̨×÷ΪÖÎÀíºÍ°²ÅÅÈÝÆ÷»¯Ó¦ÓõÄÖ÷Òª¹¤¾ß£¬±»Ô½À´Ô½¶àµÄÆóÒµËù½ÓÄÉ¡£Îª°ü¹ÜÈÝÆ÷±àÅÅƽ̨µÄ¸ß¿ÉÓÃÐÔ£¬¼à¿ØÊǺÜÊÇÖ÷ÒªµÄÒ»»·£¬Ëü¿ÉÒÔ×ÊÖúÎÒÃÇʵʱÏàʶƽ̨µÄÔËÐÐ״̬¡¢¿ìËÙ¶¨Î»ÎÊÌâ²¢¾ÙÐйÊÕϻָ´¡£±¾ÎĽ«ÏÈÈÝÔõÑùÔÚlinuxÉÏÉèÖø߿ÉÓõÄÈÝÆ÷±àÅÅƽ̨¼à¿Ø£¬²¢ÌṩÏà¹ØµÄ´úÂëʾÀý¡£

Ò»¡¢Ñ¡ÔñºÏÊʵļà¿Ø¹¤¾ß

ÔÚÉèÖÃÈÝÆ÷±àÅÅƽ̨¼à¿Ø֮ǰ£¬ÎÒÃÇÐèҪѡÔñºÏÊʵļà¿Ø¹¤¾ß¡£³£¼ûµÄÈÝÆ÷¼à¿Ø¹¤¾ßÓÐPrometheus¡¢Grafana¡¢CAdvisorµÈ¡£ÆäÖУ¬PrometheusÊÇÒ»ÖÖ¿ªÔ´µÄ¼à¿Øϵͳ£¬ÊÊÓÃÓÚÈÝÆ÷ÇéÐεļà¿Ø£¬²¢ÇҾ߱¸¸ß¿ÉÓõÄÌØÕ÷¡£GrafanaÊÇÒ»¸ö¿ÉÊÓ»¯µÄ¼à¿ØºÍÆÊÎöƽ̨£¬¿ÉÒÔÓëPrometheus¼¯³É£¬Ìṩ¸üÖ±¹ÛµÄ¼à¿ØÊý¾ÝչʾºÍÆÊÎö¹¦Ð§¡£¶øCAdvisorÊÇÒ»¸öÓÃÓÚ¼à¿ØÈÝÆ÷×ÊԴʹÓÃÇéÐεŤ¾ß£¬¿ÉÒÔ½«ÈÝÆ÷µÄ×ÊԴʹÓÃÇéÐεÈÊý¾Ý̻¶¸øPrometheus¾ÙÐÐÊÕÂÞ¡£

¶þ¡¢×°ÖúÍÉèÖÃPrometheus

×°ÖÃPrometheus

ÔÚLinuxÉÏ×°ÖÃPrometheusºÜÊǼòÆÓ£¬ÎÒÃÇ¿ÉÒÔͨ¹ýÏÂÔضþ½øÖÆÎļþ¾ÙÐÐ×°Öá£Ïêϸ°ì·¨ÈçÏ£º

$ wget https://github.com/prometheus/prometheus/releases/download/v2.26.0/prometheus-2.26.0.linux-amd64.tar.gz
$ tar -zxvf prometheus-2.26.0.linux-amd64.tar.gz
$ cd prometheus-2.26.0.linux-amd64

µÇ¼ºó¸´ÖÆ

ÉèÖÃPrometheus

ÔÚPrometheusµÄÉèÖÃÎļþprometheus.ymlÖУ¬ÎÒÃÇÐèÒªÉèÖÃÐèÒª¼à¿ØµÄÄ¿µÄºÍÊÕÂÞ¹æÔò¡£Ê¾ÀýÉèÖÃÈçÏ£º

global:
  scrape_interval: 15s
  scrape_timeout: 10s
  evaluation_interval: 15s

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

  - job_name: 'cadvisor'
 static_configs:
   - targets: ['localhost:8080']

µÇ¼ºó¸´ÖÆ

ÔÚÉÏÊöÉèÖÃÖУ¬ÎÒÃǽç˵ÁËÁ½¸öjob£¬Ò»¸ö¼à¿ØPrometheus×ÔÉí£¬Ò»¸ö¼à¿ØCAdvisor¡£ÆäÖУ¬targets×ֶνç˵ÁËÐèÒª¼à¿ØµÄÄ¿µÄµØµãºÍ¶Ë¿Ú¡£

Èý¡¢×°ÖúÍÉèÖÃGrafana

×°ÖÃGrafana

ÎÒÃÇ¿ÉÒÔͨ¹ýÏÂÔضþ½øÖÆÎļþµÄ·½·¨¾ÙÐÐGrafanaµÄ×°Öá£Ïêϸ°ì·¨ÈçÏ£º

$ wget https://dl.grafana.com/oss/release/grafana-8.1.5.linux-amd64.tar.gz
$ tar -zxvf grafana-8.1.5.linux-amd64.tar.gz
$ cd grafana-8.1.5.linux-amd64

µÇ¼ºó¸´ÖÆ

ÉèÖÃGrafana

ÔÚGrafanaµÄÉèÖÃÎļþgrafana.iniÖУ¬ÎÒÃÇÐèÒªÉèÖÃÊý¾ÝÔ´ºÍÃæ°å¡£Ê¾ÀýÉèÖÃÈçÏ£º

[datasource.prometheus]
type = prometheus
url = http://localhost:9090
access = proxy

[dashboard]
enabled = true

µÇ¼ºó¸´ÖÆ

ÔÚÉÏÊöÉèÖÃÖУ¬ÎÒÃÇÉèÖÃÁËPrometheus×÷ΪÊý¾ÝÔ´£¬½ç˵ÁËPrometheusµÄURLºÍ»á¼ûȨÏÞ¡£

ËÄ¡¢ÉèÖÃCAdvisor

CAdvisor×÷ΪÈÝÆ÷×ÊÔ´¼à¿ØµÄ¹¤¾ß£¬ÎÒÃÇÐèÒªÉèÖÃÈÝÆ÷ÔËÐÐʱÀ´Æô¶¯CAdvisor²¢½«Æä̻¶¸øPrometheus¡£ÒÔDockerΪÀý£¬ÎÒÃÇ¿ÉÒÔÔÚÈÝÆ÷Æô¶¯Ê±Ìí¼ÓÒÔϲÎÊý£º

$ docker run -d --name=cadvisor --privileged --volume=/:/rootfs:ro --volume=/var/run:/var/run:rw --volume=/sys:/sys:ro --volume=/var/lib/docker/:/var/lib/docker:ro --publish=8080:8080/google/cadvisor:latest

µÇ¼ºó¸´ÖÆ

ÒÔÉϲÎÊýÒâζ׎«ÈÝÆ÷ÄÚµÄ/ºÍ/var/lib/docker/µÈĿ¼¹ÒÔص½CAdvisorÈÝÆ÷ÖУ¬²¢½«CAdvisorµÄ¼à¿Ø¶Ë¿Ú̻¶µ½ËÞÖ÷»úµÄ8080¶Ë¿ÚÉÏ¡£

Îå¡¢ÔËÐмà¿Øϵͳ

Æô¶¯PrometheusºÍGrafana

·­¿ªÒ»¸öÖն˴°¿Ú£¬Ö´ÐÐÒÔÏÂÏÂÁîÆô¶¯Prometheus£º

$ ./prometheus --config.file=prometheus.yml

µÇ¼ºó¸´ÖÆ

ÔÙ·­¿ªÒ»¸öÖն˴°¿Ú£¬Ö´ÐÐÒÔÏÂÏÂÁîÆô¶¯Grafana£º

$ ./bin/grafana-server

µÇ¼ºó¸´ÖÆ

ÉèÖÃGrafanaµÄÊý¾ÝÔ´

·­¿ªä¯ÀÀÆ÷£¬»á¼ûhttp://localhost:3000£¬½øÈëGrafanaµÄWeb½çÃæ¡£ÔÚ½çÃæÉÏÑ¡ÔñÊý¾ÝÔ´²Ëµ¥£¬Ìí¼ÓÒ»¸öPrometheusÊý¾ÝÔ´£¬²¢ÉèÖúöÔÓ¦µÄURLºÍ»á¼ûȨÏÞ¡£

Ìí¼Ó¼à¿ØÃæ°å

½øÈëÒDZíÅ̲˵¥£¬µã»÷Ìí¼ÓÒDZíÅÌ£¬Ñ¡ÔñÏà¹ØÖ¸±êºÍͼ±í¾ÙÐÐÉèÖá£Í¨¹ýGrafana£¬ÎÒÃÇ¿ÉÒÔ×Ô½çËÃ÷ÈչʾÐèÒªµÄ¼à¿ØÖ¸±êºÍͼ±í¡£

Áù¡¢×ܽá

ͨ¹ýÒÔÉÏ°ì·¨£¬ÎÒÃÇÀֳɵØÔÚLinuxÉÏÉèÖÃÁ˸߿ÉÓõÄÈÝÆ÷±àÅÅƽ̨¼à¿Øϵͳ¡£Prometheus×÷Ϊ¼à¿ØÒýÇ棬ÓÃÓÚÊÕÂ޺ʹ洢ÈÝÆ÷±àÅÅƽ̨µÄ¼à¿ØÊý¾Ý£»GrafanaÔòÌṩÁËÖ±¹ÛÇÒ¿É×Ô½ç˵µÄ¼à¿ØÊý¾ÝչʾºÍÆÊÎö¹¦Ð§¡£ÔÚÉèÖÃÀú³ÌÖУ¬ÎÒÃÇÐèҪעÖØ׼ȷÉèÖüà¿ØÄ¿µÄ¡¢Êý¾ÝÔ´ºÍÃæ°å£¬ÒÔÈ·±£¼à¿ØϵͳÄܹ»×¼È·ÊÕÂÞºÍչʾÈÝÆ÷±àÅÅƽ̨µÄÔËÐÐ״̬¡£

Ï£Íû±¾ÎÄÄܹ»¶ÔÕýÔÚʹÓûòÍýÏëʹÓÃÈÝÆ÷±àÅÅƽ̨µÄ¿ª·¢ÕߺÍÔËάְԱÌṩһЩ×ÊÖú£¬¸üºÃµØÉèÖúÍÖÎÀí¸ß¿ÉÓõÄÈÝÆ÷±àÅÅƽ̨¼à¿Ø¡£ÈôÓÐÐèÒª£¬¿ÉÒÔƾ֤ÏÖÕæÏàÐζÔʾÀýÖеÄÉèÖþÙÐÐÐ޸ĺ͵÷½â£¬ÒÔÖª×ã×Ô¼ºµÄ¼à¿ØÐèÇó¡£

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

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

Ïà¹ØÐÂÎÅ

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

18523999891

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

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

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