×ðÁú¿­Ê±

ÔõÑùÔÚGitLabÖа²Åżà¿Øϵͳ

gitlabÊÇÒ»¿î»ùÓÚgitµÄ¿ªÔ´Èí¼þ£¬ËüÌṩÁË´úÂëÍйܡ¢´úÂëÉó²é¡¢ci/cdµÈһվʽ½â¾ö¼Æ»®£¬Êܵ½ÁËÆÕ±éµÄ½Ó´ý¡£È»¶ø£¬ÔÚ´ó¹æÄ£Ó¦ÓÃgitlabʱ£¬ÔõÑù¼à¿ØgitlabµÄÐÔÄܺÍÔËÐÐ״̬£¬×èÖ¹·ºÆð¹ÊÕÏ£¬ÊÇÒ»ÏîÐèҪ˼Á¿µÄÎÊÌâ¡£±¾ÎĽ«ÏÈÈÝÔõÑùÔÚgitlabÖа²Åżà¿Øϵͳ£¬ÊµÏÖ¶ÔgitlabµÄ¼à¿Ø¡£

¼à¿Øϵͳ

ΪÁËʵÏÖ¶ÔGitLabµÄ¼à¿Ø£¬ÐèҪѡÔñÊʺϵļà¿Øϵͳ¡£ÔÚÖÚ¶à¼à¿ØϵͳÖУ¬PrometheusÊÇÒ»¿î¹¦Ð§Ç¿Ê¢¡¢ÐÔÄÜÓÅÁ¼µÄ¿ªÔ´¼à¿Øƽ̨£¬Ö§³Ö¶àÖÖÊý¾ÝÔ´¡¢ÎÞаµÄÅÌÎÊÓïÑԺͿÉÊÓ»¯µÈ¹¦Ð§£¬±»ÆÕ±éÓ¦ÓÃÓÚÔÆÔ­ÉúºÍ΢ЧÀͼܹ¹ÖС£

×°ÖÃPrometheus

¹ÙÍøÌṩÁ˶àÖÖ×°Ö÷½·¨£¬±¾ÎÄÒÔDocker·½·¨¾ÙÐÐ×°Öá£

1) ×°ÖÃDocker

Ê×ÏÈÐèҪװÖÃDocker£¬¿ÉÒÔͨ¹ý¹ÙÍøµÄ×°Öþ籾¾ÙÐÐ×°Öá£

2) ×°ÖÃPrometheus

ʹÓÃDockerÔËÐÐPrometheus¾µÏñ£º

docker run -d --name=prometheus -p 9090:9090 prom/prometheus

µÇ¼ºó¸´ÖÆ

ÉÏÊöÏÂÁî»áÔÚÍâµØÆô¶¯Ò»¸öPrometheusÈÝÆ÷£¬²¢ÇÒ½«ÈÝÆ÷µÄ9090¶Ë¿ÚÓ³Éäµ½ÍâµØµÄ9090¶Ë¿Ú¡£

ÉèÖÃPrometheus

PrometheusÊÇÒ»¸öÎÞаµÄ¼à¿Øϵͳ£¬ÐèÒªÉèÖÃÊý¾ÝÔ´ºÍʹÃü¡£ÔÚ¼à¿ØGitLabʱ£¬ÐèÒªÉèÖÃÊý¾ÝÔ´ºÍÏà¹ØµÄÊÕÂÞʹÃü¡£

1) ÉèÖÃÊý¾ÝÔ´

ÔÚPrometheusµÄÉèÖÃÎļþprometheus.ymlÖÐÌí¼ÓGitLabµÄÊý¾ÝÔ´£º

scrape_configs:
  - job_name: 'gitlab'
    metrics_path: '/metrics'
    static_configs:
    - targets: ['<gitlab-ip>:9090']</gitlab-ip>

µÇ¼ºó¸´ÖÆ

ÆäÖУ¬ ÊÇGitLabЧÀÍÆ÷µÄIPµØµã¡£

2) ÉèÖÃÊÕÂÞʹÃü

Prometheus¹ØÓÚGitLabµÄ¼à¿ØÊý¾ÝÊÕÂÞ¿ÉÒÔͨ¹ýAPI·½·¨¾ÙÐС£ÔÚprometheus.ymlÎļþÖУ¬ÔöÌíÒÔÏÂÉèÖãº

- job_name: 'gitlab-api'
  scrape_interval: 5s
  metrics_path: '/probe'
  params:
    module: [http_2xx]
  static_configs:
    - targets:
        - 'http://<gitlab-ip>/health_check'
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [__param_target]
        target_label: instance
      - target_label: __address__
        replacement: '<gitlab-ip>:8080'</gitlab-ip></gitlab-ip>

µÇ¼ºó¸´ÖÆ

ÆäÖУ¬ ÊÇGitLabЧÀÍÆ÷µÄIPµØµã¡£

3) ÖØÆôPrometheus

ΪÁËʹÉèÖÃÉúЧ£¬ÐèÒªÖØÆôPrometheus¡£

docker restart prometheus

µÇ¼ºó¸´ÖÆ

GitLabÉèÖÃ

ÔÚGitLab ServerÉÏ£¬ÐèÒª·­¿ªPrometheus Exporter²å¼þ£¬ÒÔ±ãPrometheusÊÕÂÞGitLabµÄ¼à¿ØÊý¾Ý¡£

1) ×°ÖÃPrometheus Exporter²å¼þ

ÔÚGitLabµÄÖÎÀíÒ³ÃæÖУ¬Ñ¡ÔñPlugins£¬ËÑË÷prometheus£¬½«GitLab Prometheus Exporter²å¼þÆôÓá£

2) ÉèÖÃPrometheus Exporter²å¼þ

ÔÚGitLab Prometheus Exporter²å¼þµÄÉèÖÃÒ³ÃæÖУ¬·­¿ªEnabledÑ¡Ï²¢ÌîÈëPrometheusЧÀÍÆ÷µÄIPµØµãºÍ¶Ë¿ÚºÅ¡£

Ч¹û

¾­ÓÉÉÏÊö°ì·¨£¬¾Í¿ÉÒÔʵÏÖ¶ÔGitLabµÄ¼à¿Ø¡£ÔÚPrometheusµÄWeb UIÖУ¬¿ÉÒÔÅÌÎÊGitLabµÄ¼à¿ØÊý¾Ý£¬²¢¾ÙÐпÉÊÓ»¯Õ¹Ê¾¡£

±ðµÄ£¬»¹¿ÉÒÔʹÓÃAlertManager¶ÔGitLabµÄÒì³£¾ÙÐмà¿ØºÍ±¨¾¯¡£

×ܽá

±¾ÎÄÏÈÈÝÁËÔõÑùÔÚGitLabÖа²Åżà¿Øϵͳ£¬ÊµÏÖ¶ÔGitLabµÄ¼à¿Ø¡£ÆäÖУ¬Ñ¡ÔñÊʺϵļà¿ØϵͳÊÇÒªº¦£¬Õû¸öÀú³ÌÐèÒª×ÐϸÉèÖã¬È·±£¼à¿ØϵͳÄܹ»ÎȹÌÔËÐС£ÔÚÏÖʵӦÓÃÖУ¬¿ÉÒÔÍŽáPrometheusµÄÎĵµ£¬µ÷½â¼à¿ØϵͳµÄÏà¹Ø²ÎÊý£¬Ìá¸ßGitLabµÄÔËÐÐЧÂʺÍÎȹÌÐÔ¡£

ÒÔÉϾÍÊÇÔõÑùÔÚGitLabÖа²Åżà¿ØϵͳµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

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

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±

18523999891

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

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

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