prometheus监控linux系统-node_exporter
【摘要】 在prometheus安装教程 已经了解到了如何安装prometheusnode_exporter安装node_exporter可以采集主机信息(服务器信息)下载地址:https://github.com/prometheus/node_exporter/releaseswget https://github.com/prometheus/node_exporter/releases/do...
在prometheus安装教程 已经了解到了如何安装prometheus
node_exporter安装
node_exporter可以采集主机信息(服务器信息)
下载地址:
https://github.com/prometheus/node_exporter/releases
wget https://github.com/prometheus/node_exporter/releases/download/v1.3.1/node_exporter-1.3.1.linux-amd64.tar.gz
tar -zvxf node_exporter-1.3.1.linux-amd64.tar.gz
cd node_exporter-1.3.1.linux-amd64/
复制
启动
[root@localhost node_exporter-1.3.1.linux-amd64]# ./node_exporter
ts=2022-06-07T05:47:29.871Z caller=node_exporter.go:182 level=info msg="Starting node_exporter" version="(version=1.3.1, branch=HEAD, revision=a2321e7b940ddcff26873612bccdf7cd4c42b6b6)"
ts=2022-06-07T05:47:29.871Z caller=node_exporter.go:183 level=info msg="Build context" build_context="(go=go1.17.3, user=root@243aafa5525c, date=20211205-11:09:49)"
ts=2022-06-07T05:47:29.871Z caller=node_exporter.go:185 level=warn msg="Node Exporter is running as root user. This exporter is designed to run as unpriviledged user, root is not required."
ts=2022-06-07T05:47:29.871Z caller=filesystem_common.go:111 level=info collector=filesystem msg="Parsed flag --collector.filesystem.mount-points-exclude" flag=^/(dev|proc|run/credentials/.+|sys|var/lib/docker/.+)($|/)
ts=2022-06-07T05:47:29.871Z caller=filesystem_common.go:113 level=info collector=filesystem msg="Parsed flag --collector.filesystem.fs-types-exclude" flag=^(autofs|binfmt_misc|bpf|cgroup2?|configfs|debugfs|devpts|devtmpfs|fusectl|hugetlbfs|iso9660|mqueue|nsfs|overlay|proc|procfs|pstore|rpc_pipefs|securityfs|selinuxfs|squashfs|sysfs|tracefs)$
ts=2022-06-07T05:47:29.872Z caller=node_exporter.go:108 level=info msg="Enabled collectors"
ts=2022-06-07T05:47:29.872Z caller=node_exporter.go:115 level=info collector=arp
ts=2022-06-07T05:47:29.872Z caller=node_exporter.go:115 level=info collector=bcache
ts=2022-06-07T05:47:29.872Z caller=node_exporter.go:115 level=info collector=bonding
ts=2022-06-07T05:47:29.872Z caller=node_exporter.go:115 level=info collector=btrfs
ts=2022-06-07T05:47:29.872Z caller=node_exporter.go:115 level=info collector=conntrack
ts=2022-06-07T05:47:29.872Z caller=node_exporter.go:115 level=info collector=cpu
ts=2022-06-07T05:47:29.872Z caller=node_exporter.go:115 level=info collector=cpufreq
复制
设置为系统服务
vi /etc/systemd/system/node_exporter.service
复制
[Unit]
Description=node-exporter
[Service]
Type=simple
Restart=on-failure
RestartSec=5
ExecStart=/usr/local/node_exporter/node_exporter
[Install]
WantedBy=multi-user.target
复制
启动:
systemctl start node_exporter
systemctl status node_exporter
systemctl enable node_exporter
复制
配置prometheus
在prometheus.yml上新增监控节点:
- job_name: 'my-home-linux'
static_configs:
- targets:
- 'localhost:9100'
复制
重启prometheus,即可看到服务器信息
【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
评论(0)