问题1: node_exporter 提示错误 Get “http://localhost:9100/metrics”: dial tcp 127.0.0.1:9100: connect: connection refused
截图如下:
问题2:点击上图的url ,跳转的地址也是不正确的
node_exporter:日志有一个错误:
level=info ts=2020-07-18T08:45:27.203Z caller=node_exporter.go:191 msg="Listening on" address=:9100
level=info ts=2020-07-18T08:45:27.203Z caller=tls_config.go:200 msg="TLS is enabled and it cannot be disabled on the fly." http2=true
2020/07/18 16:46:53 http: TLS handshake error from [::1]:44312: remote error: tls: bad certificate
prothemus 日志:
[root@localhost prometheus-tls]# docker logs prometheus
level=info ts=2020-07-18T09:41:27.581Z caller=main.go:302 msg="No time or size retention was set so using the default time retention" duration=15d
level=info ts=2020-07-18T09:41:27.582Z caller=main.go:337 msg="Starting Prometheus" version="(version=2.19.2, branch=HEAD, revision=c448ada63d83002e9c1d2c9f84e09f55a61f0ff7)"
level=info ts=2020-07-18T09:41:27.582Z caller=main.go:338 build_context="(go=go1.14.4, user=root@dd72efe1549d, date=20200626-09:02:20)"
level=info ts=2020-07-18T09:41:27.582Z caller=main.go:339 host_details="(Linux 3.10.0-1127.10.1.el7.x86_64 #1 SMP Wed Jun 3 14:28:03 UTC 2020 x86_64 f16ded7c96fc (none))"
level=info ts=2020-07-18T09:41:27.582Z caller=main.go:340 fd_limits="(soft=1048576, hard=1048576)"
level=info ts=2020-07-18T09:41:27.582Z caller=main.go:341 vm_limits="(soft=unlimited, hard=unlimited)"
level=info ts=2020-07-18T09:41:27.587Z caller=main.go:678 msg="Starting TSDB ..."
level=info ts=2020-07-18T09:41:27.588Z caller=web.go:524 component=web msg="Start listening for connections" address=0.0.0.0:9090
level=info ts=2020-07-18T09:41:27.597Z caller=head.go:645 component=tsdb msg="Replaying WAL and on-disk memory mappable chunks if any, this may take a while"
level=info ts=2020-07-18T09:41:27.598Z caller=head.go:706 component=tsdb msg="WAL segment loaded" segment=0 maxSegment=0
level=info ts=2020-07-18T09:41:27.598Z caller=head.go:709 component=tsdb msg="WAL replay completed" duration=375.331µs
level=info ts=2020-07-18T09:41:27.601Z caller=main.go:694 fs_type=XFS_SUPER_MAGIC
level=info ts=2020-07-18T09:41:27.601Z caller=main.go:695 msg="TSDB started"
level=info ts=2020-07-18T09:41:27.601Z caller=main.go:799 msg="Loading configuration file" filename=/etc/prometheus/prometheus.yml
level=info ts=2020-07-18T09:41:27.603Z caller=main.go:827 msg="Completed loading of configuration file" filename=/etc/prometheus/prometheus.yml
level=info ts=2020-07-18T09:41:27.603Z caller=main.go:646 msg="Server is ready to receive web requests."
备注:直接访问node_exporter 是可以访问的
2、使用环境:
node_exporter版本 1.0.1 ;
系统:centos7
配置文件prometheus.yml :
[root@localhost prometheus-tls]# cat prometheus.yml
global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_configs:
- job_name: 'prometheus'
static_configs:
- targets: ['localhost:9090']
- job_name: 'node_exporter'
scheme: https
tls_config:
ca_file: node_exporter.crt
static_configs:
- targets: ['localhost:9100']