Prometheus+Grafana+node_exporter实现Linux系统的监控

本文详细介绍了如何在Ubuntu18.04上部署Prometheus监控系统,包括安装Prometheus、配置监控目标、安装node_exporter以及设置Grafana来可视化监控数据。此外,还提供了相关软件的下载链接和配置文件示例。
摘要由CSDN通过智能技术生成

prometheus
prometheus是一套开源的监控与报警与时间序列数据库的组合。
grafana
grafana是一个跨平台的开源的度量分析和可视化工具,可以通过将采集的数据查询然后可视化的展示,并及时通知。
node_exporter
node_exporter是采集器,负责将采集的数据存储到prometheus数据库,然后grafana取promethues数据库的数据进行展示。

安装包:可以去官网下载离线安装包https://prometheus.io/download/
https://grafana.com/

如果觉得官网下载很慢,可以在csdn里面下载,此次安装包下载 https://download.csdn.net/download/weixin_45548465/87383302

使用ubuntu1804部署 192.168.190.194

prometheus的安装

wget https://github.com/prometheus/prometheus/releases/download/v2.41.0/prometheus-2.41.0.linux-amd64.tar.gz
tar -xvf prometheus-2.41.0.linux-amd64.tar.gz
mv prometheus-2.41.0.linux-amd64 /usr/local/prometheus
cd  /usr/local/prometheus
cp prometheus /usr/local/bin/
cp promtool /usr/local/bin/
mkdir -p /etc/prometheus && mkdir -p /var/lib/prometheus
cp -p prometheus.yml /etc/prometheus/
vi /usr/lib/systemd/system/prometheus.service
[Unit]
Description=Prometheus: the monitoring system
Documentation=http://prometheus.io/docs/

[Service]
ExecStart=/usr/local/bin/prometheus --config.file=/etc/prometheus/prometheus.yml --storage.tsdb.path=/var/lib/prometheus
Restart=always
StartLimitInterval=0
RestartSec=10

[Install]
WantedBy=multi-user.target
systemctl daemon-reload && systemctl start prometheus && systemctl enable prometheus

通过网址访问 http:ip:9090
在这里插入图片描述

被监控主机安装node_exporter 192.168.190.39

wget https://github.com/prometheus/node_exporter/releases/download/v1.5.0/node_exporter-1.5.0.linux-amd64.tar.gz
tar xvf node_exporter-1.5.0.linux-amd64.tar.gz
mv node_exporter-1.5.0.linux-amd64/node_exporter /usr/local/bin/
vi /etc/systemd/system/node_exporter.service
[Unit]
Description=node_exporter
Documentation=https://prometheus.io/
After=network.target
[Service]
ExecStart=/usr/local/bin/node_exporter
Restart=on-failure
[Install]
WantedBy=multi-user.target
systemctl start  node_exporter && systemctl enable node_exporter

配置prometheus server端可以拉取node信息 在文件最后添加内容 注意格式

vim /etc/prometheus/prometheus.yml
  - job_name: "node"
    static_configs:
      - targets: ["192.168.190.39:9100"]

在这里插入图片描述

systemctl restart prometheus

web端刷新,可以看到增加了一台监控的信息
在这里插入图片描述

grafana安装 192.168.190.194

sudo apt-get install -y adduser libfontconfig1
wget https://dl.grafana.com/enterprise/release/grafana-enterprise_9.3.2_amd64.deb
sudo dpkg -i grafana-enterprise_9.3.2_amd64.deb
systemctl start grafana-server  &&  systemctl enable grafana-server

web登录 http://ip:3000 账户密码都是admin
在这里插入图片描述
添加数据源
在这里插入图片描述
设置数据源,名称、类型、ip和端口 (填写)
在这里插入图片描述
添加图形
可以去官网下载模板 https://grafana.com/grafana/dashboards
导入模板
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

import 后即可看到当前服务器监控信息
在这里插入图片描述

参考文档:https://www.cnblogs.com/hurric/p/16363155.html
https://zhuanlan.zhihu.com/p/443034743
https://note.youdao.com/ynoteshare/index.html?id=65c974d251958a70c75f9840d91467f9&type=note&_time=1673745353585

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值