基于Grafana+Prometheus 实现window服务器,数据库监控

优采云 发布时间: 2020-08-13 10:00

  基于Grafana+Prometheus 实现Windows服务器,MySQL数据库监控

  目前市面上的主流是以Liunx系统服务器为主,但是仍存在使用windows系统服务器的企业,下面的内容将介绍怎样基于Grafana+Prometheus 实现windows服务器,数据库监控。

  一、简介

  二、下载安装

  1、Windows系统性能指标采集

  #下载地址:https://github.com/martinlindhe/wmi_exporter/releases

#选择最新msi文件下载安装即可。通过访问http://ip+默认端口9182(如:http://localhost:9182) 出现下图,即代表安装采集数据成功。

  

  2、Mysql数据指标采集器

  #下载地址:https://prometheus.io/download/

#找到mysqld_exporter采集器,选择windows 版本即可 (如:mysqld_exporter-0.11.0.windows-amd64.tar.gz)

  ,在mysqld_exporter.exe的同级目录下创建.f 并启动

  

  .f中内容:

  [client]

host=127.0.0.1 #mysql ip

user=root #账号

password=123456 #密码

  3、Prometheus

  #下载地址:https://prometheus.io/download/

#选择windows 版本即可

  a.下载解压后,修改配置文件,修改新增mysql、windows数据采集器配置:

  scrape_configs:

# The job name is added as a label `job=` to any timeseries scraped from this config.

- job_name: 'windows'

# metrics_path defaults to '/metrics'

# scheme defaults to 'http'.

static_configs:

- targets: ['localhost:9182']

- job_name: 'mysql'

static_configs:

- targets: ['localhost:3306']

  

  b、启动,cmd步入安装目录(& – -> 后台运行)

  prometheus.exe --config.file=prometheus.yml --web.listen-address=:9090 &

  c、访问:9090 ,(如::9090)出现如下界面即为prometheus安装成功、数据采集器验证成功 (PS: up为成功,down 为不成功。)

  

  3、Grafana

  #下载地址:https://grafana.com/grafana/download

#选择windows 版本即可

  解压完成,进入bin目录启动grafana-server.exe 打开浏览器访问:3000,(如::3000) 用户名/密码 admin/admin

  三、性能数据展示

  1、配置数据源

  Configuration -- Add data source ---Prometheus , 输入名称,prometheus的访问url ,点击保存测试,验证是否成功

  

  2、选择监控仪表盘模板导出。

  访问地址: --- serch框输入windows ---- 选择心仪模板 (注意模板所支持的数据源为prometheus) ----- 进行 ID 或者JOSN文件两种形式导出。

  

  

  

  3、展示数据

  模板导出成功即可见到监控数据

  

  PS : MySQL性能数据展示步骤一致。

0 个评论

要回复文章请先登录注册


官方客服QQ群

微信人工客服

QQ人工客服


线