prometheus监控linux系统-node_exporter

简介: prometheus监控linux系统-node_exporter

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,即可看到服务器信息

目录
相关文章
|
8月前
|
Ubuntu Linux Anolis
Linux系统禁用swap
本文介绍了在新版本Linux系统(如Ubuntu 20.04+、CentOS Stream、openEuler等)中禁用swap的两种方法。传统通过注释/etc/fstab中swap行的方式已失效,现需使用systemd管理swap.target服务或在/etc/fstab中添加noauto参数实现禁用。方法1通过屏蔽swap.target适用于新版系统,方法2通过修改fstab挂载选项更通用,兼容所有系统。
727 3
Linux系统禁用swap
|
8月前
|
Linux
Linux系统修改网卡名为eth0、eth1
在Linux系统中,可通过修改GRUB配置和创建Udev规则或使用systemd链接文件,将网卡名改为`eth0`、`eth1`等传统命名方式,适用于多种发行版并支持多网卡配置。
1296 3
|
9月前
|
Ubuntu Linux
计算机基础知识:linux系统怎么安装?
在虚拟机软件中创建一个新的虚拟机,并选择相应操作系统类型和硬盘空间大小等参数。将下载的 ISO 镜像文件加载到虚拟机中。启动虚拟机,进入安装界面,并按照步骤进行安装。安装完成后,可以在虚拟机中使用 Linux 系统。
|
9月前
|
存储 Ubuntu Linux
「正点原子Linux连载」第二章Ubuntu系统入门
在图2.8.2.4中,我们使用命令umount卸载了U盘,卸载以后当我们再去访问文件夹/mnt/tmp的时候发现里面没有任何文件了,说明我们卸载成功了。
|
Ubuntu Linux 网络安全
Linux系统初始化脚本
一款支持Rocky、CentOS、Ubuntu、Debian、openEuler等主流Linux发行版的系统初始化Shell脚本,涵盖网络配置、主机名设置、镜像源更换、安全加固等多项功能,适配单/双网卡环境,支持UEFI引导,提供多版本下载与持续更新。
792 3
Linux系统初始化脚本
|
9月前
|
运维 Linux 开发者
Linux系统中使用Python的ping3库进行网络连通性测试
以上步骤展示了如何利用 Python 的 `ping3` 库来检测网络连通性,并且提供了基本错误处理方法以确保程序能够优雅地处理各种意外情形。通过简洁明快、易读易懂、实操性强等特点使得该方法非常适合开发者或系统管理员快速集成至自动化工具链之内进行日常运维任务之需求满足。
628 18
|
8月前
|
安全 Linux Shell
Linux系统提权方式全面总结:从基础到高级攻防技术
本文全面总结Linux系统提权技术,涵盖权限体系、配置错误、漏洞利用、密码攻击等方法,帮助安全研究人员掌握攻防技术,提升系统防护能力。
976 1
|
8月前
|
监控 安全 Linux
Linux系统提权之计划任务(Cron Jobs)提权
在Linux系统中,计划任务(Cron Jobs)常用于定时执行脚本或命令。若配置不当,攻击者可利用其提权至root权限。常见漏洞包括可写的Cron脚本、目录、通配符注入及PATH变量劫持。攻击者通过修改脚本、创建恶意任务或注入命令实现提权。系统管理员应遵循最小权限原则、使用绝对路径、避免通配符、设置安全PATH并定期审计,以防范此类攻击。
1305 1
|
9月前
|
缓存 监控 Linux
Linux系统清理缓存(buff/cache)的有效方法。
总结而言,在大多数情形下你不必担心Linux中buffer与cache占用过多内存在影响到其他程序运行;因为当程序请求更多内存在没有足够可用资源时,Linux会自行调整其占有量。只有当你明确知道当前环境与需求并希望立即回收这部分资源给即将运行重负载任务之前才考虑上述方法去主动干预。
2356 10
|
9月前
|
安全 Linux 数据安全/隐私保护
为Linux系统的普通账户授予sudo访问权限的过程
完成上述步骤后,你提升的用户就能够使用 `sudo`命令来执行管理员级别的操作,而无需切换到root用户。这是一种更加安全和便捷的权限管理方式,因为它能够留下完整的权限使用记录,并以最小权限的方式工作。需要注意的是,随意授予sudo权限可能会使系统暴露在风险之中,尤其是在用户不了解其所执行命令可能带来的后果的情况下。所以在配置sudo权限时,必须谨慎行事。
1600 0