• 欢迎来到小爱博客,一个分享互联网IT技术的网站,喜欢就收藏吧!

Gitlab修改prometheus磁盘位置

linux 小爱 2个月前 (08-30) 48次浏览 已收录 0个评论 扫描二维码

Gitlab磁盘空间不够后,会导致git使用出现异常。一般网上搜索到的是针对gitlab的data配置进行转移,但是还有一种情况是prometheus的data也会占用一定的磁盘空间。我遇到的正是因为prometheus导致的磁盘空间不足。

linux(CentOS 6.5)下

1、先查看磁盘空间大小。确定是prometheus占用空间

du -h –max-depth=1 /var/opt/gitlab/

2、修改gitlab中prometheus配置  vi /etc/gitlab/gitlab.rb

################################################################################
## Prometheus
##! Docs: https://docs.gitlab.com/ee/administration/monitoring/prometheus/
################################################################################

###! **To enable only Monitoring service in this machine, uncomment
###!   the line below.**
###! Docs: https://docs.gitlab.com/ee/administration/high_availability
# monitoring_role[‘enable’] = true

# prometheus[‘enable’] = true
# prometheus[‘monitor_kubernetes’] = true
# prometheus[‘username’] = ‘gitlab-prometheus’
# prometheus[‘group’] = ‘gitlab-prometheus’
# prometheus[‘uid’] = nil
# prometheus[‘gid’] = nil
# prometheus[‘shell’] = ‘/bin/sh’
# prometheus[‘home’] = ‘/var/opt/gitlab/prometheus’
# prometheus[‘log_directory’] = ‘/var/log/gitlab/prometheus’
# prometheus[‘rules_files’] = [‘/var/opt/gitlab/prometheus/rules/*.rules’]
# prometheus[‘scrape_interval’] = 15
# prometheus[‘scrape_timeout’] = 15
# prometheus[‘env_directory’] = ‘/opt/gitlab/etc/prometheus/env’
# prometheus[‘env’] = {
#   ‘SSL_CERT_DIR’ => “/opt/gitlab/embedded/ssl/certs/”
# }
#
### Custom Prometheus flags
#
# prometheus[‘flags’] = {
#   ‘storage.tsdb.path’ => “/var/opt/gitlab/prometheus/data”,
#   ‘storage.tsdb.retention.time’ => “15d”,
#   ‘config.file’ => “/var/opt/gitlab/prometheus/prometheus.yml”
# }
找到如上配置项,有3个办法,1)关掉prometheus 。这个是系统监控收集信息的工具。prometheus_monitoring[‘enable’] = false

2)修改data路径,改为磁盘空间更大的路径。 ‘storage.tsdb.path’ => “/var/opt/gitlab/prometheus/data”

3)修改data保存时间。改小天数prometheus会自动清除过期的data。  ‘storage.tsdb.retention.time’ => “15d”

 

3、保存配置修改,重启gitlab

gitlab-ctl stop

gitlab-ctl reconfigure

gitlab-ctl start


小爱博客 , 版权所有
转载请注明原文链接:Gitlab修改prometheus磁盘位置
喜欢 (0)
【你的支持, 我的动力】
分享 (0)
发表我的评论
取消评论
表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址