升级 GitLab 至 v16.3.9-ee 版后,普罗米修斯监控一直提示数据库健康检查失败,错误代码 500。
异常现象
在监控中可以看到节点异常,手动执行查询指标(地址为数据库主站节点 IP):
curl http://10.10.10.81:9187/metrics
返回值:
An error has occurred while serving metrics:
collected metric pg_replication_is_replica label:{name:"server" value:"/var/opt/gitlab/postgresql:5432"} gauge:{value:0} has help "Indicates if this host is a slave" but should have "Indicates if the server is a replica"
异常处理
查阅上游议题,发现这是 已知问题,原因为这个版本升级内置 postgres-exporter 版本,生成配置文件后会生成重复的 pg_replication_is_replica 字段,导致监控报异常。
最简单的处理办法为升级至 v16.4 之后的版本,如果短期内无法升级版本可以在 /etc/gitlab/gitlab.rb 中添加临时参数,后续升级再去掉:
postgres_exporter['flags'] = {
'collector.replication' => false
}
如果已经有 postgres_exporter['flags'] 配置,不要覆盖原来的项目,只需增加:
'collector.replication' => false
例如:
postgres_exporter['flags'] = {
'collector.stat_user_tables' => false,
'collector.replication' => false,
}
然后执行:
gitlab-ctl reconfigure
gitlab-ctl restart postgres-exporter
重启服务后检查服务监控即恢复健康。
附录
参考链接
如果遇到问题或者对文章内容存疑,请在下方留言,博主看到后将及时回复,谢谢!
本文由 柒 创作,采用 知识共享署名4.0 国际许可协议进行许可。
转载本站文章前请注明出处,文章作者保留所有权限。
最后编辑时间:

暂无评论