监控 Debian 上的 GitLab 可以从 系统层、GitLab 服务层、应用层、日志、告警 五个维度来做。下面给你一套从基础到进阶的完整方案,适合生产环境。
不同安装方式,监控方式略有差异:
# 查看 GitLab 版本
gitlab-rake gitlab:env:info
常见安装方式:
下面以 Omnibus GitLab on Debian 为主。
重点监控:
/var/opt/gitlab)✅ Prometheus + node_exporter(推荐)
✅ htop / dstat(临时排查)
apt install htop dstat -y
Omnibus GitLab 默认已集成 Prometheus
gitlab-ctl status prometheus
/etc/gitlab/gitlab.rb
确保包含:
prometheus_monitoring['enable'] = true
重新加载:
gitlab-ctl reconfigure
http://gitlab_ip:9090
| Exporter | 作用 |
|---|---|
gitlab_exporter |
GitLab 应用指标 |
postgres_exporter |
数据库 |
redis_exporter |
Redis |
node_exporter |
系统 |
puma_exporter |
Web 服务 |
查看状态:
gitlab-ctl status
gitlab-ctl status
重点服务:
pumasidekiqpostgresqlredisnginxgitalygitlab-ctl status gitaly
关键指标:
Prometheus 查询示例:
rate(gitaly_service_requests_total[5m])
重点监控:
Prometheus 指标:
sidekiq_queue_size
sidekiq_jobs_failed_total
监控:
Nginx 日志:
/var/log/gitlab/nginx/
/var/log/gitlab/
重点:
gitlab-rails/production.log
gitlab-rails/sidekiq.log
gitaly/current
postgresql/
nginx/
gitlab-ctl tail
gitlab-ctl tail gitaly
gitlab-ctl tail sidekiq
✅ ELK / EFK ✅ Grafana Loki ✅ rsyslog + logrotate
apt install grafana -y
systemctl enable grafana-server
systemctl start grafana-server
http://localhost:9090
官方 Dashboard ID:
8931860监控告警示例:
gitlab-rake gitlab:check
gitlab-rake gitlab:doctor:secrets
curl -I http://gitlab.local/-/health
Debian GitLab
├─ node_exporter
├─ Prometheus
├─ Grafana
└─ Alertmanager
✅ 必做
✅ 推荐
✅ 警告
如果你愿意,我可以:
你现在 GitLab 是 Omnibus 还是 Docker?