一、安装
node_exporter:image: prom/node-exporter:v1.8.0container_name: node_exportervolumes:- /proc:/host/proc:ro- /sys:/host/sys:ro- /:/rootfs:ro# ports:# - 9100:9100environment:TZ: Asia/Shanghaicommand:- '--path.procfs=/host/proc'- '--path.rootfs=/rootfs'- '--path.sysfs=/host/sys'- '--collector.filesystem.ignored-mount-points=^/(sys|proc|dev|host|etc)($$|/)'network_mode: "host"restart: always
二、接入prometheus
1、通过静态文件配置加入
scrape_configs:# The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.- job_name: "prometheus"# metrics_path defaults to '/metrics'# scheme defaults to 'http'.static_configs:- targets: ["127.0.0.1:9100"]
三、图表
1、grafana
https://grafana.com/grafana/dashboards/
搜索:node-expoter
https://grafana.com/grafana/dashboards/1860-node-exporter-full/
之后下载,导入到grafana里
2、夜莺
夜莺内置了一些常用exporter采集图表
我用的是社区版:v7.0.0,从仪表盘 -> 内置仪表盘 -> 搜索linux -> 点击搜索到的,选择带有 Node Exporter的图表
四、监控
一些高频常用的监控
up
cpu使用率
内存使用率
网络使用情况
磁盘使用情况
一般需要对这些比较核心的指标进行配置告警
夜莺里面也有内置一些常用的监控策略,从告警管理 -> 内置规则 ->linux,选择 linux_by_exporter