node-exporter部署手册

node-exporter部署手册

来源

https://github.com/prometheus/node_exporter/

说明

  *NIX 内核公开的硬件和操作系统指标的 Prometheus 导出器,用 Go 编写,带有可插入的指标收集器。

部署方式

二进制文件安装

下载地址:
https://github.com/prometheus/node_exporter/releases/download/v1.1.2/node_exporter-1.1.2.linux-amd64.tar.gz
下载后解压进入该目录下,执行./node_exporter --help 命令可查看所有可配置项:

usage: node_exporter [<flags>]

Flags:
  -h, --help                     Show context-sensitive help (also try
                                 --help-long and --help-man).
      --collector.bcache.priorityStats
                                 Expose expensive priority stats.
      --collector.cpu.info       Enables metric cpu_info
      --collector.cpu.info.flags-include=COLLECTOR.CPU.INFO.FLAGS-INCLUDE
                                 Filter the `flags` field in cpuInfo with a
                                 value that must be a regular expression
      --collector.cpu.info.bugs-include=COLLECTOR.CPU.INFO.BUGS-INCLUDE
                                 Filter the `bugs` field in cpuInfo with a value
                                 that must be a regular expression
      --collector.diskstats.ignored-devices="^(ram|loop|fd|(h|s|v|xv)d[a-z]|nvme\\d+n\\d+p)\\d+$"
                                 Regexp of devices to ignore for diskstats.
      --collector.filesystem.ignored-mount-points="^/(dev|proc|sys|var/lib/docker/.+)($|/)"
                                 Regexp of mount points to ignore for filesystem
                                 collector.
      --collector.filesystem.ignored-fs-types="^(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)$"
                                 Regexp of filesystem types to ignore for
                                 filesystem collector.
      --collector.ipvs.backend-labels="local_address,local_port,remote_address,remote_port,proto,local_mark"
                                 Comma separated list for IPVS backend stats
                                 labels.
      --collector.netclass.ignored-devices="^$"
                                 Regexp of net devices to ignore for netclass
                                 collector.
      --collector.netdev.device-include=COLLECTOR.NETDEV.DEVICE-INCLUDE
                                 Regexp of net devices to include (mutually
                                 exclusive to device-exclude).
      --collector.netdev.device-exclude=COLLECTOR.NETDEV.DEVICE-EXCLUDE
                                 Regexp of net devices to exclude (mutually
                                 exclusive to device-include).
      --collector.netstat.fields="^(.*_(InErrors|InErrs)|Ip_Forwarding|Ip(6|Ext)_(InOctets|OutOctets)|Icmp6?_(InMsgs|OutMsgs)|TcpExt_(Listen.*|Syncookies.*|TCPSynRetrans)|Tcp_(ActiveOpens|InSegs|OutSegs|OutRsts|PassiveOpens|RetransSegs|CurrEstab)|Udp6?_(InDatagrams|OutDatagrams|NoPorts|RcvbufErrors|SndbufErrors))$"
                                 Regexp of fields to return for netstat
                                 collector.
      --collector.ntp.server="127.0.0.1"
                                 NTP server to use for ntp collector
      --collector.ntp.protocol-version=4
                                 NTP protocol version
      --collector.ntp.server-is-local
                                 Certify that collector.ntp.server address is
                                 not a public ntp server
      --collector.ntp.ip-ttl=1   IP TTL to use while sending NTP query
      --collector.ntp.max-distance=3.46608s
                                 Max accumulated distance to the root
      --collector.ntp.local-offset-tolerance=1ms
                                 Offset between local clock and local ntpd time
                                 to tolerate
      --path.procfs="/proc"      procfs mountpoint.
      --path.sysfs="/sys"        sysfs mountpoint.
      --path.rootfs="/"          rootfs mountpoint.
      --collector.perf.cpus=""   List of CPUs from which perf metrics should be
                                 collected
      --collector.perf.tracepoint=COLLECTOR.PERF.TRACEPOINT ...
                                 perf tracepoint that should be collected
      --collector.powersupply.ignored-supplies="^$"
                                 Regexp of power supplies to ignore for
                                 powersupplyclass collector.
      --collector.qdisc.fixtures=""
                                 test fixtures to use for qdisc collector
                                 end-to-end testing
      --collector.runit.servicedir="/etc/service"
                                 Path to runit service directory.
      --collector.supervisord.url="http://localhost:9001/RPC2"
                                 XML RPC endpoint.
      --collector.systemd.unit-include=".+"
                                 Regexp of systemd units to include. Units must
                                 both match include and not match exclude to be
                                 included.
      --collector.systemd.unit-exclude=".+\\.(automount|device|mount|scope|slice)"
                                 Regexp of systemd units to exclude. Units must
                                 both match include and not match exclude to be
                                 included.
      --collector.systemd.enable-task-metrics
                                 Enables service unit tasks metrics
                                 unit_tasks_current and unit_tasks_max
      --collector.systemd.enable-restarts-metrics
                                 Enables service unit metric
                                 service_restart_total
      --collector.systemd.enable-start-time-metrics
                                 Enables service unit metric
                                 unit_start_time_seconds
      --collector.textfile.directory=""
                                 Directory to read text files with metrics from.
      --collector.vmstat.fields="^(oom_kill|pgpg|pswp|pg.*fault).*"
                                 Regexp of fields to return for vmstat
                                 collector.
      --collector.wifi.fixtures=""
                                 test fixtures to use for wifi collector metrics
      --collector.arp            Enable the arp collector (default: enabled).
      --collector.bcache         Enable the bcache collector (default: enabled).
      --collector.bonding        Enable the bonding collector (default:
                                 enabled).
      --collector.btrfs          Enable the btrfs collector (default: enabled).
      --collector.buddyinfo      Enable the buddyinfo collector (default:
                                 disabled).
      --collector.conntrack      Enable the conntrack collector (default:
                                 enabled).
      --collector.cpu            Enable the cpu collector (default: enabled).
      --collector.cpufreq        Enable the cpufreq collector (default:
                                 enabled).
      --collector.diskstats      Enable the diskstats collector (default:
                                 enabled).
      --collector.drbd           Enable the drbd collector (default: disabled).
      --collector.edac           Enable the edac collector (default: enabled).
      --collector.entropy        Enable the entropy collector (default:
                                 enabled).
      --collector.fibrechannel   Enable the fibrechannel collector (default:
                                 enabled).
      --collector.filefd         Enable the filefd collector (default: enabled).
      --collector.filesystem     Enable the filesystem collector (default:
                                 enabled).
      --collector.hwmon          Enable the hwmon collector (default: enabled).
      --collector.infiniband     Enable the infiniband collector (default:
                                 enabled).
      --collector.interrupts     Enable the interrupts collector (default:
                                 disabled).
      --collector.ipvs           Enable the ipvs collector (default: enabled).
      --collector.ksmd           Enable the ksmd collector (default: disabled).
      --collector.loadavg        Enable the loadavg collector (default:
                                 enabled).
      --collector.logind         Enable the logind collector (default:
                                 disabled).
      --collector.mdadm          Enable the mdadm collector (default: enabled).
      --collector.meminfo        Enable the meminfo collector (default:
                                 enabled).
      --collector.meminfo_numa   Enable the meminfo_numa collector (default:
                                 disabled).
      --collector.mountstats     Enable the mountstats collector (default:
                                 disabled).
      --collector.netclass       Enable the netclass collector (default:
                                 enabled).
      --collector.netdev         Enable the netdev collector (default: enabled).
      --collector.netstat        Enable the netstat collector (default:
                                 enabled).
      --collector.network_route  Enable the network_route collector (default:
                                 disabled).
      --collector.nfs            Enable the nfs collector (default: enabled).
      --collector.nfsd           Enable the nfsd collector (default: enabled).
      --collector.ntp            Enable the ntp collector (default: disabled).
      --collector.perf           Enable the perf collector (default: disabled).
      --collector.powersupplyclass
                                 Enable the powersupplyclass collector (default:
                                 enabled).
      --collector.pressure       Enable the pressure collector (default:
                                 enabled).
      --collector.processes      Enable the processes collector (default:
                                 disabled).
      --collector.qdisc          Enable the qdisc collector (default: disabled).
      --collector.rapl           Enable the rapl collector (default: enabled).
      --collector.runit          Enable the runit collector (default: disabled).
      --collector.schedstat      Enable the schedstat collector (default:
                                 enabled).
      --collector.sockstat       Enable the sockstat collector (default:
                                 enabled).
      --collector.softnet        Enable the softnet collector (default:
                                 enabled).
      --collector.stat           Enable the stat collector (default: enabled).
      --collector.supervisord    Enable the supervisord collector (default:
                                 disabled).
      --collector.systemd        Enable the systemd collector (default:
                                 disabled).
      --collector.tcpstat        Enable the tcpstat collector (default:
                                 disabled).
      --collector.textfile       Enable the textfile collector (default:
                                 enabled).
      --collector.thermal_zone   Enable the thermal_zone collector (default:
                                 enabled).
      --collector.time           Enable the time collector (default: enabled).
      --collector.timex          Enable the timex collector (default: enabled).
      --collector.udp_queues     Enable the udp_queues collector (default:
                                 enabled).
      --collector.uname          Enable the uname collector (default: enabled).
      --collector.vmstat         Enable the vmstat collector (default: enabled).
      --collector.wifi           Enable the wifi collector (default: disabled).
      --collector.xfs            Enable the xfs collector (default: enabled).
      --collector.zfs            Enable the zfs collector (default: enabled).
      --collector.zoneinfo       Enable the zoneinfo collector (default:
                                 disabled).
      --web.listen-address=":9100"
                                 Address on which to expose metrics and web
                                 interface.
      --web.telemetry-path="/metrics"
                                 Path under which to expose metrics.
      --web.disable-exporter-metrics
                                 Exclude metrics about the exporter itself
                                 (promhttp_*, process_*, go_*).
      --web.max-requests=40      Maximum number of parallel scrape requests. Use
                                 0 to disable.
      --collector.disable-defaults
                                 Set all collectors to disabled by default.
      --web.config=""            [EXPERIMENTAL] Path to config yaml file that
                                 can enable TLS or authentication.
      --log.level=info           Only log messages with the given severity or
                                 above. One of: [debug, info, warn, error]
      --log.format=logfmt        Output format of log messages. One of: [logfmt,
                                 json]
      --version                  Show application version.

可根据自己的需求自由搭配;

查询指标

执行配置命令后,您应该会看到这样的输出,表明节点导出器现在正在运行并在==端口 9100 ==上公开指标:

INFO[0000] Starting node_exporter (version=0.16.0, branch=HEAD, revision=d42bd70f4363dced6b77d8fc311ea57b63387e4f)  source="node_exporter.go:82"
INFO[0000] Build context (go=go1.9.6, user=root@a67a9bc13a69, date=20180515-15:53:28)  source="node_exporter.go:83"
INFO[0000] Enabled collectors:                           source="node_exporter.go:90"
INFO[0000]  - boottime                                   source="node_exporter.go:97"
...
INFO[0000] Listening on :9100                            source="node_exporter.go:111"

安装并运行节点导出器后,您可以通过卷曲/metrics端点来验证是否正在导出指标:

http://localhost:9100/metrics

你应该看到这样的输出:

# HELP go_gc_duration_seconds A summary of the GC invocation durations.
# TYPE go_gc_duration_seconds summary
go_gc_duration_seconds{quantile="0"} 3.8996e-05
go_gc_duration_seconds{quantile="0.25"} 4.5926e-05
go_gc_duration_seconds{quantile="0.5"} 5.846e-05
# etc.

说明安装部署成功!

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值