使用node-exporter监控主机信息
所属分类 prometheus
浏览量 2834
MONITORING LINUX HOST METRICS WITH THE NODE EXPORTER
https://prometheus.io/docs/guides/node-exporter/
The Prometheus Node Exporter exposes a wide variety of hardware- and kernel-related metrics.
Node Exporter 提供硬件和内核相关的指标
Start up a Node Exporter on localhost
Start up a Prometheus instance on localhost that's configured to scrape metrics from the running Node Exporter
配置从Node Exporter 抓取 指标
While the Prometheus Node Exporter is for *nix systems
Node Exporter is a single static binary that you can install via tarball.
Node Exporter 是一个静态二进制文件,可以通过tarball安装。
tarball 压缩文件
解压之后 启动 node-exporter
/Users/dugang/soft/prometheus/node-exporter/node_exporter-0.17.0.darwin-amd64
./node_exporter
http://localhost:9100/metrics
node_ 开头的为 节点相关的 指标
node_load1 2.18115234375
# HELP node_load15 15m load average.
# TYPE node_load15 gauge
node_load15 2.27197265625
# HELP node_load5 5m load average.
# TYPE node_load5 gauge
node_load5 2.29833984375
node_filesystem_free_bytes{device="/dev/disk1",fstype="hfs",mountpoint="/"} 4.515776512e+10
node_network_receive_bytes_total{device="en0"} 3.170029721e+09
node_network_receive_bytes_total{device="lo0"} 3.312666664e+09
node_network_transmit_bytes_total{device="en0"} 3.3919407e+07
node_network_transmit_bytes_total{device="lo0"} 3.312666664e+09
node_cpu_seconds_total{cpu="0",mode="idle"} 30441.25
node_cpu_seconds_total{cpu="0",mode="nice"} 0
node_cpu_seconds_total{cpu="0",mode="system"} 6259.73
node_cpu_seconds_total{cpu="0",mode="user"} 10615.13
node_cpu_seconds_total{cpu="1",mode="idle"} 38021.24
node_cpu_seconds_total{cpu="1",mode="nice"} 0
node_cpu_seconds_total{cpu="1",mode="system"} 2784.61
node_cpu_seconds_total{cpu="1",mode="user"} 6506.45
node_cpu_seconds_total{cpu="2",mode="idle"} 31968.11
node_cpu_seconds_total{cpu="2",mode="nice"} 0
node_cpu_seconds_total{cpu="2",mode="system"} 4779.34
node_cpu_seconds_total{cpu="2",mode="user"} 10564.89
node_cpu_seconds_total{cpu="3",mode="idle"} 37936.63
node_cpu_seconds_total{cpu="3",mode="nice"} 0
node_cpu_seconds_total{cpu="3",mode="system"} 2802.23
node_cpu_seconds_total{cpu="3",mode="user"} 6573.42
node_disk_read_bytes_total{device="disk0"} 2.9755127296e+10
server 配置
prometheus.yml
scrape_configs:
- job_name: 'node'
static_configs:
- targets: ['localhost:9100']
targets: ['localhost:9090','localhost:9100']
post http://127.0.0.1:9090/-/reload
Lifecycle APIs are not enabled
重启 server
./prometheus --config.file=prometheus.yml
Its not safe to turn that on said in prometheus doc, one can just use kill -HUP pid instead
kill -HUP pid
kill -HUP 45223
level=info ts=2019-04-08T09:18:42.117443Z caller=main.go:724 msg="Loading configuration file" filename=prometheus.yml
level=info ts=2019-04-08T09:18:42.120042Z caller=main.go:751 msg="Completed loading of configuration file" filename=prometheus.yml
job_name: 'node' 在哪里配置 ?
node_exporter_build_info
node_exporter_build_info{branch="HEAD",goversion="go1.11.2",revision="f6f6194a436b9a63d0439abc585c76b19a206b21",version="0.17.0"} 1
rate(node_cpu_seconds_total{mode="system"}[1m])
The average amount of CPU time spent in system mode, per second, over the last minute (in seconds)
node_filesystem_avail_bytes
The filesystem space available to non-root users (in bytes)
rate(node_network_receive_bytes_total[1m])
The average network traffic received, per second, over the last minute (in bytes)
可以在图例上选择要显示的曲线
rate(node_network_receive_bytes_total{device="en0"}[1m])
指定 tag device="en0"
曲线不会自动刷新 需要手工 点 Execute 按钮
如何设置自动刷新?
status 菜单
http://127.0.0.1:9090/targets
http://127.0.0.1:9090/config
http://127.0.0.1:9090/service-discovery
上一篇
下一篇
linux内核版本与系统版本查看以及x86与x86_64的区别
prometheus FAQ 要点整理
prometheus使用入门
prometheus数据模型
java异常处理12条建议
软件架构的10个常见模式