1. 下载node_exporter
[root@localhost ~]# wget https://github.com/prometheus/node_exporter/releases/download/v1.8.2/node_exporter-1.8.2.linux-amd64.tar.gz
2. 解压缩
[root@localhost ~]# tar -zxvf node_exporter-1.8.2.linux-amd64.tar.gz
3. 复制到/usrl/local路径下
[root@localhost ~]# cp -rf node_exporter-1.8.2.linux-amd64 /usr/local/node_exporter
4. 启动node_exporter
[root@localhost node_exporter]# ./node_exporter
ts=2024-08-21T12:24:10.177Z caller=node_exporter.go:193 level=info msg="Starting node_exporter" version="(version=1.8.2, branch=HEAD, revision=f1e0e8360aa60b6cb5e5cc1560bed348fc2c1895)"
ts=2024-08-21T12:24:10.177Z caller=node_exporter.go:194 level=info msg="Build context" build_context="(go=go1.22.5, platform=linux/amd64, user=root@03d440803209, date=20240714-11:53:45, tags=unknown)"
ts=2024-08-21T12:24:10.177Z caller=node_exporter.go:196 level=warn msg="Node Exporter is running as root user. This exporter is designed to run as unprivileged user, root is not required."
ts=2024-08-21T12:24:10.178Z caller=diskstats_common.go:111 level=info collector=diskstats msg="Parsed flag --collector.diskstats.device-exclude" flag=^(z?ram|loop|fd|(h|s|v|xv)d[a-z]|nvme\d+n\d+p)\d+$
ts=2024-08-21T12:24:10.178Z 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/.+|var/lib/containers/storage/.+)($|/)
ts=2024-08-21T12:24:10.178Z 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=2024-08-21T12:24:10.180Z caller=node_exporter.go:111 level=info msg="Enabled collectors"
ts=2024-08-21T12:24:10.180Z caller=node_exporter.go:118 level=info collector=arp
ts=2024-08-21T12:24:10.180Z caller=node_exporter.go:118 level=info collector=bcache
ts=2024-08-21T12:24:10.180Z caller=node_exporter.go:118 level=info collector=bonding
ts=2024-08-21T12:24:10.180Z caller=node_exporter.go:118 level=info collector=btrfs
ts=2024-08-21T12:24:10.180Z caller=node_exporter.go:118 level=info collector=conntrack
ts=2024-08-21T12:24:10.180Z caller=node_exporter.go:118 level=info collector=cpu
ts=2024-08-21T12:24:10.180Z caller=node_exporter.go:118 level=info collector=cpufreq
ts=2024-08-21T12:24:10.180Z caller=node_exporter.go:118 level=info collector=diskstats
ts=2024-08-21T12:24:10.180Z caller=node_exporter.go:118 level=info collector=dmi
ts=2024-08-21T12:24:10.180Z caller=node_exporter.go:118 level=info collector=edac
ts=2024-08-21T12:24:10.180Z caller=node_exporter.go:118 level=info collector=entropy
ts=2024-08-21T12:24:10.180Z caller=node_exporter.go:118 level=info collector=fibrechannel
ts=2024-08-21T12:24:10.180Z caller=node_exporter.go:118 level=info collector=filefd
ts=2024-08-21T12:24:10.180Z caller=node_exporter.go:118 level=info collector=filesystem
ts=2024-08-21T12:24:10.180Z caller=node_exporter.go:118 level=info collector=hwmon
ts=2024-08-21T12:24:10.180Z caller=node_exporter.go:118 level=info collector=infiniband
ts=2024-08-21T12:24:10.180Z caller=node_exporter.go:118 level=info collector=ipvs
ts=2024-08-21T12:24:10.180Z caller=node_exporter.go:118 level=info collector=loadavg
ts=2024-08-21T12:24:10.180Z caller=node_exporter.go:118 level=info collector=mdadm
ts=2024-08-21T12:24:10.180Z caller=node_exporter.go:118 level=info collector=meminfo
ts=2024-08-21T12:24:10.180Z caller=node_exporter.go:118 level=info collector=netclass
ts=2024-08-21T12:24:10.180Z caller=node_exporter.go:118 level=info collector=netdev
ts=2024-08-21T12:24:10.180Z caller=node_exporter.go:118 level=info collector=netstat
ts=2024-08-21T12:24:10.180Z caller=node_exporter.go:118 level=info collector=nfs
ts=2024-08-21T12:24:10.180Z caller=node_exporter.go:118 level=info collector=nfsd
ts=2024-08-21T12:24:10.180Z caller=node_exporter.go:118 level=info collector=nvme
ts=2024-08-21T12:24:10.180Z caller=node_exporter.go:118 level=info collector=os
ts=2024-08-21T12:24:10.180Z caller=node_exporter.go:118 level=info collector=powersupplyclass
ts=2024-08-21T12:24:10.180Z caller=node_exporter.go:118 level=info collector=pressure
ts=2024-08-21T12:24:10.180Z caller=node_exporter.go:118 level=info collector=rapl
ts=2024-08-21T12:24:10.180Z caller=node_exporter.go:118 level=info collector=schedstat
ts=2024-08-21T12:24:10.180Z caller=node_exporter.go:118 level=info collector=selinux
ts=2024-08-21T12:24:10.180Z caller=node_exporter.go:118 level=info collector=sockstat
ts=2024-08-21T12:24:10.180Z caller=node_exporter.go:118 level=info collector=softnet
ts=2024-08-21T12:24:10.180Z caller=node_exporter.go:118 level=info collector=stat
ts=2024-08-21T12:24:10.180Z caller=node_exporter.go:118 level=info collector=tapestats
ts=2024-08-21T12:24:10.180Z caller=node_exporter.go:118 level=info collector=textfile
ts=2024-08-21T12:24:10.180Z caller=node_exporter.go:118 level=info collector=thermal_zone
ts=2024-08-21T12:24:10.180Z caller=node_exporter.go:118 level=info collector=time
ts=2024-08-21T12:24:10.180Z caller=node_exporter.go:118 level=info collector=timex
ts=2024-08-21T12:24:10.180Z caller=node_exporter.go:118 level=info collector=udp_queues
ts=2024-08-21T12:24:10.180Z caller=node_exporter.go:118 level=info collector=uname
ts=2024-08-21T12:24:10.180Z caller=node_exporter.go:118 level=info collector=vmstat
ts=2024-08-21T12:24:10.180Z caller=node_exporter.go:118 level=info collector=watchdog
ts=2024-08-21T12:24:10.180Z caller=node_exporter.go:118 level=info collector=xfs
ts=2024-08-21T12:24:10.180Z caller=node_exporter.go:118 level=info collector=zfs
ts=2024-08-21T12:24:10.181Z caller=tls_config.go:313 level=info msg="Listening on" address=[::]:9100
ts=2024-08-21T12:24:10.181Z caller=tls_config.go:316 level=info msg="TLS is disabled." http2=false address=[::]:9100
5. node_exporter的默认工作端口是9100
可通过浏览器访问
6. 运行后,可以使用curl命令进行测试
[root@localhost ~]# curl localhost:9100/metrics
7. 之后,结合prometheus,输入要监控的字典中的key,会生成相应的图像。如果只记得关键字,会有提示哦
至此,完成基础监控node_exporter配置。