Windows下Grafana+Promethus+node_export监控Windows系统资源详细教程

目录

1、安装Grafana(必须安装)

2、安装Promethus(必须)

 3、安装GO环境

4、安装node_exporter(必须)

6、成功展示

7、参考


说明:估计有很多像我一样没有用过Grafana、Promethus的同学会遇到相同的问题,比如安装完成后在grafana中导入模板后,表盘中都是NO DATA,去网上搜索可能找不到明确的解决方法,所以写这篇文章记录一下自己遇到的问题,希望对有需要的同学能有帮助。

Grafana、Promethus、node_export这三个必须安装,且配置正确。安装顺序建议:GO环境-node_export-Promethus-Grafana

注意 :node_export、Promethus通过浏览器能够访问到,且有数据,一般来讲是成功的了,添加模板后没有数据显示,原因可能有:1本机时间与监控机时间不一致,同步时间后再试;2模板不正确,可多试用几个模板。这里提供几个模板id:监控服务器资源(1860、9276)、监控Jmeter influxdb(5496)

1、安装Grafana(必须安装)

下载地址Download Grafana | Grafana Labs,选择需要下载的版本

 下载、解压后,双击grafana-server.exe即可启动

 在浏览器中输入http://localhost:3000/打开界面,默认用户名密码admin/admin

2、安装Promethus(必须)

下载地址:Download | Prometheus,选择需要下载的版本

下载完成后,解压,双击prometheus.exe运行 prometheus,打开http://localhost:9090/targets,查看已有的监控

 3、安装GO环境

要打开prometheus界面,必须先安装GO环境。下载地址https://golang.org/dl/,下载后直接安装即可。安装完成后,在doc窗口查看版本号,确保安装成功。

4、安装node_exporter(必须)

node_exporter分为windows、Linux、darwin版本,根据需要监控的服务器的操作系统选择对应版本。

windows版本下载地址:Releases · prometheus-community/windows_exporter · GitHub

Linux及darwin版本下载地址:Download | Prometheus

 由于我本机是windows系统,所以下载windows对应的版本,下载后直接运行windows_exporter-0.16.0-amd64.exe即可。windows_exporter-0.16.0-amd64.msi我这边一直安装失败,说是权限不足,后面搞了几次也不行,暂时先不管了吧。

运行完可能会出现这个错误 level=error msg="Error reading textfile collector directory \"C:\\\\Program Files\\\\windows_exporter\\\\textfile_inputs\": open C:\\Program Files\\windows_exporter\\textfile_inputs: The system cannot find the file specified." source="textfile.go:222"

 这里说C盘下没有这个文件夹。我们根据提示添加对应的文件夹即可(我是在git上看node_exporter这个文件的说明文档,然后猜的,证明可行)

 添加文件夹目录后,报错没有了

node_export安装完成后,需要修改promethus配置文件prometheus.yml,在scrape_configs后面加上,注意格式及位置

  - job_name: 'localhost9182'
    static_configs:
      - targets: ['localhost:9182']

  5、在grafana中添加数据源、添加模板

模板地址:Dashboards | Grafana Labs

添加数据源及模板可参照网上其他教程,前面的1234都配置正确的话,应该就能看到监控信息了

6、成功展示

7、参考

window10,Grafana+Prometheus+node_exporter部署 - 简书

grafana+prometheus+node_exporter在win10环境上的部署_测试界的博客-CSDN博客_node_exporter windows

监控神器普罗米修斯Prometheus安装配置_咖啡那么浓的博客-CSDN博客_prometheus安装配置

  • 3
    点赞
  • 26
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
答:以下是一个示例的docker-compose.yml文件,用于启动Prometheus和Grafana监控一个或多个应用程序: ``` version: '3' services: prometheus: image: prom/prometheus container_name: prometheus ports: - "9090:9090" volumes: - ./prometheus.yml:/etc/prometheus/prometheus.yml command: - '--config.file=/etc/prometheus/prometheus.yml' restart: always grafana: image: grafana/grafana container_name: grafana depends_on: - prometheus ports: - "3000:3000" environment: GF_SERVER_ROOT_URL: http://localhost:3000 GF_SECURITY_ADMIN_USER: admin GF_SECURITY_ADMIN_PASSWORD: admin volumes: - ./grafana-data:/var/lib/grafana restart: always ``` 在该docker-compose.yml文件中,我们创建了两个服务:prometheus和grafanaPrometheus服务使用Prometheus Docker映像,并将端口映射到9090。它还将/prometheus.yml文件作为挂载卷传递给容器。在启动容器时,我们使用命令行参数来指定/config.file=/etc/prometheus/prometheus.yml。 Grafana服务程序使用Grafana Docker映像,并依赖于prometheus服务。Grafana服务映射端口3000,并将以下环境变量传递给容器:GF_SERVER_ROOT_URL:使用localhost:3000 (在该容器中内部)作为grafana的根URL,GF_SECURITY_ADMIN_USER和GF_SECURITY_ADMIN_PASSWORD管理Grafana管理员的凭据。此服务还挂载了grafana-data目录,以便可以在重启容器时保留所有Grafana的设置。 最后,我们定义了restart: always参数以确保容器在退出时自动重新启动。
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值