首页 > 编程语言 >Prometheus笔记-安装Node_exporter

Prometheus笔记-安装Node_exporter

时间:2023-01-17 13:57:32浏览次数:43  
标签:Node node exporter amd64 -- metrics Prometheus linux

Node_exporter是可以在* Nix和Linux系统上运行的计算机度量标准的导出器。
Node_exporter 主要用于暴露 metrics 给 Prometheus,其中 metrics 包括:cpu 的负载,内存的使用情况,网络等。

配置文件

修改主配置文件

[root@VM-24-9-centos prometheus-2.41.0.linux-amd64]# vi prometheus.yml
global:
  scrape_interval: 15s # #每15s采集一次数据
  evaluation_interval: 15s #每15s做一次告警检测.
  # scrape_timeout is set to the global default (10s).

# Alertmanager configuration(告警配置)
alerting:
  alertmanagers:
    - static_configs:
        - targets:
          # - alertmanager:9093

# rule_files 加载告警规则文件
rule_files:
  # - "first_rules.yml"
  # - "second_rules.yml"

# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
  # 定义一个job名称
  - job_name: "prometheus"

    # 默认指标地址 '/metrics'
    metrics_path: '/metrics'
    # scheme defaults to 'http'.
    scheme: 'http'
    file_sd_configs:
      - files: ["/usr/local/src/Prometheus_server/prometheus-2.41.0.linux-amd64/child_config/prometheus.yml"]

  - job_name: "node_exporter"
    metrics_path: '/metrics'
    scheme: 'http'
    file_sd_configs:
      - files: ["/usr/local/src/Prometheus_server/prometheus-2.41.0.linux-amd64/child_config/node_exporter.yml"]

新增子配置文件

[root@VM-24-9-centos child_config]# vi node_exporter.yml 
- targets: ['localhost:9100']
  labels:
    env: 'test'
    host: 'localhosti'
    type: 'node_exporter'

下载node_exporter

# 下载
wget https://github.com/prometheus/node_exporter/releases/download/v1.5.0/node_exporter-1.5.0.linux-amd64.tar.gz
# 使用第三方加速 https://ghproxy.com/
wget wget https://ghproxy.com/https://github.com/prometheus/node_exporter/releases/download/v1.5.0/node_exporter-1.5.0.linux-amd64.tar.gz

安装node_exporter

[root@VM-24-9-centos exporter_package]# tar -zxvf node_exporter-1.5.0.linux-amd64.tar.gz 
node_exporter-1.5.0.linux-amd64/
node_exporter-1.5.0.linux-amd64/LICENSE
node_exporter-1.5.0.linux-amd64/NOTICE
node_exporter-1.5.0.linux-amd64/node_exporter

node_exporter启动

常用启动配置项

--web.listen-address=":9100"  
#node_exporter监听的端口,默认是9100,若需要修改则通过此参数。

--web.telemetry-path="/metrics"  
#获取metric信息的url,默认是/metrics,若需要修改则通过此参数

--log.level="info" 
#设置日志级别

--log.format="logger:stderr"  
#设置打印日志的格式,若有自动化日志提取工具可以使用这个参数规范日志打印的格式

# 以下内容不常用
--collector.diskstats.ignored-devices="^(ram|loop|fd|(h|s|v|xv)d[a-z]|nvme\\d+n\\d+p)\\d+$"
#通过正则表达式忽略某些磁盘的信息收集

--collector.filesystem.ignored-mount-points="^/(dev|proc|sys|var/lib/docker/.+)($|/)"  
#通过正则表达式忽略某些文件系统挂载点的信息收集

--collector.filesystem.ignored-fs-types="^(autofs|binfmt_misc|bpf|cgroup2?|configfs|debugfs|devpts|devtmpfs|fusectl|hugetlbfs|mqueue|nsfs|overlay|proc|procfs|pstore|rpc_pipefs|securityfs|selinuxfs|squashfs|sysfs|tracefs)$"  
#通过正则表达式忽略某些文件系统类型的信息收集

--collector.netclass.ignored-devices="^$"  
#通过正则表达式忽略某些网络类的信息收集

--collector.netdev.ignored-devices="^$"  
#通过正则表达式忽略某些网络设备的信息收集

  --collector.netstat.fields="^$"
 #通过正则表达式配置需要获取的网络状态信息
 
--collector.vmstat.fields="^(oom_kill|pgpg|pswp|pg.*fault).*" 
#通过正则表达式配置vmstat返回信息中需要收集的选项

启动node_exporter

[root@VM-24-9-centos node_exporter-1.5.0.linux-amd64]# nohup ./node_exporter --web.listen-address=":9100" &

显示效果

image.png

标签:Node,node,exporter,amd64,--,metrics,Prometheus,linux
From: https://www.cnblogs.com/jruing/p/17057625.html

相关文章

  • Prometheus笔记-安装
    官网https://prometheus.io/docs/introduction/overview/下载Prometheushttps://prometheus.io/download/安装Prometheus配置文件#myglobalconfigglobal:......
  • Prometheus笔记-Label标签
    LabelLable是为了方便管理及查询监控目标,在后续写promtheus查询语法的时候需要使用标签作为查询条件配置文件#Ascrapeconfigurationcontainingexactlyoneendpoin......
  • Prometheus笔记-file_sd_config
    一般一个job作为一个业务服务,它下面的监控的机器/节点都是这个服务的节点,为了方便管理,我们可以按照job划分,为每个job创建一个子配置文件,这样方便管理配置文件#myglob......
  • Prometheus由于时间不同步导致数据不显示
    问题部署prometheus后,访问前端界面发现:这是由于你windows机器与部署prometheus服务器的​​时间不同步​​导致的。解决在服务器执行如下命令:ntpdatentp.aliyun.com就能......
  • Prometheus Operator配置Alertmanager告警
    1、管理Alertmanagerconfiguration1.1方式一,使用存储在Kubernetessecret中的本地Alertmanager配置文件1、编写alertmanager配置alertmanager.yamlroute:group_by......
  • 解决 Ambari 部分从节点的 NodeManager 无法启动问题
    一、问题描述日志文件信息如下:2019-07-1811:20:28,104INFOnodemanager.NodeManager(LogAdapter.java:info(45))-registeredUNIXsignalhandlersfor[TERM,H......
  • ubuntu22 安装node16报错
    情况用的阿里云ECS,本地apt安装只能到12,所以采取网上说法curl-sLhttps://deb.nodesource.com/setup_16.x|sudo-Ebash-sudoapt-getinstall-ynodejs然后遇到......
  • node和npm如何升级版本
    node和npm在某种意义上,早已成为当前前端开发中不可或缺的工具。本文将介绍如何进行node和npm的版本升级和指定等等操作。查看node和npm版本:node-vnpm-v清除npm缓......
  • ceph集群添加node节点及OSD
      初始化ceph存储节点  初始化存储节点等于在存储节点安装了ceph及ceph-rodsgw安装包,但是使用默认的官方仓库会因为网络原因导致初始化超时,因此各存储节点推荐......
  • nodemon
         ......