注册
达梦数据库搭建普罗米修斯监控
培训园地/ 文章详情 /

达梦数据库搭建普罗米修斯监控

北极熊 2025/08/06 50 0 0

Prometheus+grafana监控达梦8实例

01、环境准备

image.png

02、安装prometheus (192.168.88.80)

1)、安装

cd /opt
ln -sf prometheus-2.43.0.linux-amd64/ prometheus
cd prometheus
./promtool check config prometheus.yml  # 配置文件语法校验

cd /opt/prometheus
vim prometheus.yml # [部分]

  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
  - job_name: "prometheus"

    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.

    static_configs:
      - targets: ["192.168.88.80:9090"]   # 注意修改localhost为 prometheus服务器IP

2) 默认配置启动

cd /opt/prometheus
./prometheus --config.file=prometheus.yml &
ps -ef|grep prome

3) 浏览器查看 http://192.168.88.80:9090

image.png

4) 配置prometheus启动命令

prometheus启动选项:
--config.file # 指明prometheus的配置文件路径
--web.enable-lifecycle # 指明prometheus配置更改后可以进行热加载
--storage.tsdb.path # 指明监控数据存储路径
--storage.tsdb.retention # 指明数据保留时间

5) 设置开机自启动prometheus

vim /etc/rc.d/rc.local

chmod +x rc.local

03、DM服务器安装node_exporter

191、192操作:

ln -sf node_exporter-1.5.0.linux-amd64/ node_exporter
nohup /opt/node_exporter/node_exporter &
vi /etc/rc.d/rc.local
nohup /opt/node_exporter/node_exporter &
chmod +x /etc/rc.d/rc.local

访问:
192.168.88.80:9100/metrics

04、达梦服务器安装dameng_exporter

192.168.88.80操作:

tar -xf dameng_exporter_v1.1.6_linux_amd64.tar.gz -C /opt/dmexporter
cd /opt/

达梦数据库创建监控用户
CREATE user export01 IDENTIFIED by Dameng123;
ALTER user export01 IDENTIFIED BY Dameng123;
alter user export01 DEFAULT TABLESPACE export_tbs DEFAULT INDEX TABLESPACE export_tbs;
grant public,resource,soi,svi,vti to export01;

修改配置文件:

vim /opt/dmexporter/dameng_exporter.config

dbUser=export01
dbPwd=Dameng123

前台启动dameng_exporter调试:

chmod +x dameng_exporter_linux_amd64
ps -ef|grep exporter
image.png

配置开机后台自启动

vi /etc/rc.d/rc.local

nohup /opt/dmexporter/dameng_exporter_linux_amd64 >> /var/log/dm_exporter.log 2>&1 &
chmod +x /etc/rc.d/rc.local
image.png

05、修改prometheus配置并重启

vim /opt/prometheus/prometheus.yml

  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
  - job_name: "prometheus"

    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.

    static_configs:
      - targets: ["192.168.88.80:9090"] #注意,如果要监控主备集群,则这里的实例可以写多个

  - job_name: "dameng_80"
    static_configs:
      - targets: ["192.168.88.80:9200"] #注意,如果要监控主备集群,则这里的实例可以写多个
        labels:
          cluster_name: 'dameng_single_instance' 

nohup /opt/prometheus/prometheus --config.file=/opt/prometheus/prometheus.yml --web.enable-lifecycle --storage.tsdb.path=/opt/prometheus/data --storage.tsdb.retention=60d >> /var/log/prometheus.log 2>&1 &

06、配置grafana

systemctl start grafana-server
systemctl enable grafana-server

image.png

http://192.168.88.80:3000/login #初始密码admin/admin,按提示修改密码

#导入prometheus数据源

image.png
image.png
image.png

#导入达梦监控面板的json文件

image.png

image.png

评论
后发表回复

作者

文章

阅读量

获赞

扫一扫
联系客服