首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Prometheus容器不断崩溃并重新启动。

Prometheus容器不断崩溃并重新启动。
EN

Stack Overflow用户
提问于 2022-06-11 02:43:59
回答 1查看 704关注 0票数 0

我在一个具有6GB内存和3个核心CPU的ubuntu20.04VM和一个具有4GB内存和2个核心CPU (e2-media)的Ubuntu20.04 Google Cloud实例上运行以下命令:

我作为根用户运行:

代码语言:javascript
复制
git clone https://github.com/vegasbrianc/prometheus.git
cd prometheus
docker compose up

这显示了正常的日志(我不能在这里全部安装它们,所以我已经开始了对Prometheus容器日志的一点了解):

代码语言:javascript
复制
prometheus-prometheus-1     | level=info ts=2022-06-11T02:12:15.117919521Z caller=web.go:383 component=web msg="Start listening for connections" address=0.0.0.0:9090
prometheus-prometheus-1     | level=info ts=2022-06-11T02:12:15.126931519Z caller=main.go:509 msg="TSDB started"
prometheus-prometheus-1     | level=info ts=2022-06-11T02:12:15.126963347Z caller=main.go:585 msg="Loading configuration file" filename=/etc/prometheus/prometheus.yml
prometheus-prometheus-1     | panic: runtime error: slice bounds out of range
prometheus-prometheus-1     | 
prometheus-prometheus-1     | goroutine 169 [running]:
prometheus-prometheus-1     | github.com/prometheus/prometheus/vendor/github.com/miekg/dns.ClientConfigFromFile(0x1bfd5b1, 0x10, 0x0, 0x0, 0x0)
prometheus-prometheus-1     |   /go/src/github.com/prometheus/prometheus/vendor/github.com/miekg/dns/clientconfig.go:86 +0xad6
prometheus-prometheus-1     | github.com/prometheus/prometheus/discovery/dns.lookupWithSearchPath(0xc42014dee0, 0x13, 0x7050001, 0x28ef2c0, 0xc4203d4a80, 0xc42046e5f8, 0x7373bf, 0xc)
prometheus-prometheus-1     |   /go/src/github.com/prometheus/prometheus/discovery/dns/dns.go:246 +0x48
prometheus-prometheus-1     | github.com/prometheus/prometheus/discovery/dns.(*Discovery).refresh(0xc420318f80, 0x290a240, 0xc420318fc0, 0xc42014dee0, 0x13, 0xc420120a80, 0x1, 0x777dd5)
prometheus-prometheus-1     |   /go/src/github.com/prometheus/prometheus/discovery/dns/dns.go:174 +0x73
prometheus-prometheus-1     | github.com/prometheus/prometheus/discovery/dns.(*Discovery).refreshAll.func1(0xc420318f80, 0x290a240, 0xc420318fc0, 0xc420120a80, 0xc420320110, 0xc42014dee0, 0x13)
prometheus-prometheus-1     |   /go/src/github.com/prometheus/prometheus/discovery/dns/dns.go:163 +0x73
prometheus-prometheus-1     | created by github.com/prometheus/prometheus/discovery/dns.(*Discovery).refreshAll
prometheus-prometheus-1     |   /go/src/github.com/prometheus/prometheus/discovery/dns/dns.go:162 +0xd3
prometheus-prometheus-1 exited with code 2
prometheus-prometheus-1     | level=info ts=2022-06-11T02:12:16.053300315Z caller=main.go:499 msg="Starting TSDB ..."
prometheus-prometheus-1     | level=info ts=2022-06-11T02:12:16.053321002Z caller=web.go:383 component=web msg="Start listening for connections" address=0.0.0.0:9090
prometheus-prometheus-1     | level=info ts=2022-06-11T02:12:16.059793013Z caller=main.go:509 msg="TSDB started"
prometheus-prometheus-1     | level=info ts=2022-06-11T02:12:16.05981778Z caller=main.go:585 msg="Loading configuration file" filename=/etc/prometheus/prometheus.yml
prometheus-prometheus-1     | level=info ts=2022-06-11T02:12:16.060783302Z caller=main.go:486 msg="Server is ready to receive web requests."
prometheus-prometheus-1     | panic: runtime error: slice bounds out of range
prometheus-prometheus-1     | 
prometheus-prometheus-1     | goroutine 307 [running]:
prometheus-prometheus-1     | github.com/prometheus/prometheus/vendor/github.com/miekg/dns.ClientConfigFromFile(0x1bfd5b1, 0x10, 0x0, 0x0, 0x0)
prometheus-prometheus-1     |   /go/src/github.com/prometheus/prometheus/vendor/github.com/miekg/dns/clientconfig.go:86 +0xad6
prometheus-prometheus-1     | github.com/prometheus/prometheus/discovery/dns.lookupWithSearchPath(0xc4205343a0, 0xe, 0xc420520001, 0x28ef2c0, 0xc420f7ef60, 0xc420130840, 0x60, 0xc420523660)
prometheus-prometheus-1     |   /go/src/github.com/prometheus/prometheus/discovery/dns/dns.go:246 +0x48
prometheus-prometheus-1     | github.com/prometheus/prometheus/discovery/dns.(*Discovery).refresh(0xc420be3040, 0x290a240, 0xc420be3080, 0xc4205343a0, 0xe, 0xc4201303c0, 0x155d594, 0x2)
prometheus-prometheus-1     |   /go/src/github.com/prometheus/prometheus/discovery/dns/dns.go:174 +0x73
prometheus-prometheus-1     | github.com/prometheus/prometheus/discovery/dns.(*Discovery).refreshAll.func1(0xc420be3040, 0x290a240, 0xc420be3080, 0xc4201303c0, 0xc42044db70, 0xc4205343a0, 0xe)
prometheus-prometheus-1     |   /go/src/github.com/prometheus/prometheus/discovery/dns/dns.go:163 +0x73
prometheus-prometheus-1     | created by github.com/prometheus/prometheus/discovery/dns.(*Discovery).refreshAll
prometheus-prometheus-1     |   /go/src/github.com/prometheus/prometheus/discovery/dns/dns.go:162 +0xd3
prometheus-alertmanager-1   | ts=2022-06-11T02:12:16.112Z caller=cluster.go:705 level=info component=cluster msg="gossip not settled" polls=0 before=0 now=1 elapsed=2.000218836s
prometheus-prometheus-1 exited with code 2
prometheus-grafana-1        | logger=settings t=2022-06-11T02:12:16.7+0000 lvl=info msg="Starting Grafana" version=8.5.5 commit=d32ae18909 branch=HEAD compiled=2022-06-06T18:50:28Z
prometheus-grafana-1        | logger=settings t=2022-06-11T02:12:16.7+0000 lvl=info msg="The state of unified alerting is still not defined. The decision will be made during as we run the database migrations"
prometheus-grafana-1        | logger=settings t=2022-06-11T02:12:16.7+0000 lvl=info msg="Config loaded from" file=/usr/share/grafana/conf/defaults.ini
prometheus-grafana-1        | logger=settings t=2022-06-11T02:12:16.7+0000 lvl=info msg="Config loaded from" file=/etc/grafana/grafana.ini
prometheus-grafana-1        | logger=settings t=2022-06-11T02:12:16.7+0000 lvl=info msg="Config overridden from command line" arg="default.paths.data=/var/lib/grafana"
prometheus-grafana-1        | logger=settings t=2022-06-11T02:12:16.7+0000 lvl=info msg="Config overridden from command line" arg="default.paths.logs=/var/log/grafana"
prometheus-grafana-1        | logger=settings t=2022-06-11T02:12:16.7+0000 lvl=info msg="Config overridden from command line" arg="default.paths.plugins=/var/lib/grafana/plugins"
prometheus-grafana-1        | logger=settings t=2022-06-11T02:12:16.7+0000 lvl=info msg="Config overridden from command line" arg="default.paths.provisioning=/etc/grafana/provisioning"
prometheus-grafana-1        | logger=settings t=2022-06-11T02:12:16.7+0000 lvl=info msg="Config overridden from command line" arg="default.log.mode=console"
prometheus-grafana-1        | logger=settings t=2022-06-11T02:12:16.7+0000 lvl=info msg="Config overridden from Environment variable" var="GF_PATHS_DATA=/var/lib/grafana"
prometheus-grafana-1        | logger=settings t=2022-06-11T02:12:16.7+0000 lvl=info msg="Config overridden from Environment variable" var="GF_PATHS_LOGS=/var/log/grafana"
prometheus-grafana-1        | logger=settings t=2022-06-11T02:12:16.7+0000 lvl=info msg="Config overridden from Environment variable" var="GF_PATHS_PLUGINS=/var/lib/grafana/plugins"
prometheus-grafana-1        | logger=settings t=2022-06-11T02:12:16.7+0000 lvl=info msg="Config overridden from Environment variable" var="GF_PATHS_PROVISIONING=/etc/grafana/provisioning"
prometheus-grafana-1        | logger=settings t=2022-06-11T02:12:16.7+0000 lvl=info msg="Config overridden from Environment variable" var="GF_SECURITY_ADMIN_PASSWORD=*********"
prometheus-grafana-1        | logger=settings t=2022-06-11T02:12:16.7+0000 lvl=info msg="Config overridden from Environment variable" var="GF_USERS_ALLOW_SIGN_UP=false"
prometheus-grafana-1        | logger=settings t=2022-06-11T02:12:16.7+0000 lvl=info msg="Path Home" path=/usr/share/grafana
prometheus-grafana-1        | logger=settings t=2022-06-11T02:12:16.7+0000 lvl=info msg="Path Data" path=/var/lib/grafana
prometheus-grafana-1        | logger=settings t=2022-06-11T02:12:16.7+0000 lvl=info msg="Path Logs" path=/var/log/grafana
prometheus-grafana-1        | logger=settings t=2022-06-11T02:12:16.7+0000 lvl=info msg="Path Plugins" path=/var/lib/grafana/plugins
prometheus-grafana-1        | logger=settings t=2022-06-11T02:12:16.7+0000 lvl=info msg="Path Provisioning" path=/etc/grafana/provisioning
prometheus-grafana-1        | logger=settings t=2022-06-11T02:12:16.7+0000 lvl=info msg="App mode production"
prometheus-grafana-1        | logger=sqlstore t=2022-06-11T02:12:16.7+0000 lvl=info msg="Connecting to DB" dbtype=sqlite3
prometheus-grafana-1        | logger=migrator t=2022-06-11T02:12:16.74+0000 lvl=info msg="Starting DB migrations"
prometheus-grafana-1        | logger=migrator t=2022-06-11T02:12:16.75+0000 lvl=info msg="migrations completed" performed=0 skipped=392 duration=352.472µs
prometheus-grafana-1        | logger=plugin.manager t=2022-06-11T02:12:16.81+0000 lvl=info msg="Plugin registered" pluginId=input
prometheus-grafana-1        | logger=query_data t=2022-06-11T02:12:16.81+0000 lvl=info msg="Query Service initialization"
prometheus-grafana-1        | logger=live.push_http t=2022-06-11T02:12:16.81+0000 lvl=info msg="Live Push Gateway initialization"
prometheus-grafana-1        | logger=provisioning.datasources t=2022-06-11T02:12:16.89+0000 lvl=info msg="deleted datasource based on configuration" name=Prometheus
prometheus-grafana-1        | logger=provisioning.datasources t=2022-06-11T02:12:16.89+0000 lvl=info msg="inserting datasource from configuration " name=Prometheus uid=PBFA97CFB590B2093
prometheus-grafana-1        | logger=provisioning.plugins t=2022-06-11T02:12:16.94+0000 lvl=eror msg="Failed to read plugin provisioning files from directory" path=/etc/grafana/provisioning/plugins error="open /etc/grafana/provisioning/plugins: no such file or directory"
prometheus-grafana-1        | logger=provisioning.notifiers t=2022-06-11T02:12:16.94+0000 lvl=eror msg="Can't read alert notification provisioning files from directory" path=/etc/grafana/provisioning/notifiers error="open /etc/grafana/provisioning/notifiers: no such file or directory"
prometheus-grafana-1        | logger=ngalert t=2022-06-11T02:12:16.94+0000 lvl=info msg="warming cache for startup"
prometheus-grafana-1        | logger=grafanaStorageLogger t=2022-06-11T02:12:16.94+0000 lvl=info msg="storage starting"
prometheus-grafana-1        | logger=ngalert.multiorg.alertmanager t=2022-06-11T02:12:16.95+0000 lvl=info msg="starting MultiOrg Alertmanager"
prometheus-grafana-1        | logger=http.server t=2022-06-11T02:12:16.95+0000 lvl=info msg="HTTP Server Listen" address=[::]:3000 protocol=http subUrl= socket=
prometheus-prometheus-1     | level=info ts=2022-06-11T02:12:17.037992938Z caller=main.go:225 msg="Starting Prometheus" version="(version=2.1.0, branch=HEAD, revision=85f23d82a045d103ea7f3c89a91fba4a93e6367a)"
prometheus-prometheus-1     | level=info ts=2022-06-11T02:12:17.038027848Z caller=main.go:226 build_context="(go=go1.9.2, user=root@6e784304d3ff, date=20180119-12:01:23)"
prometheus-prometheus-1     | level=info ts=2022-06-11T02:12:17.038037127Z caller=main.go:227 host_details="(Linux 5.13.0-44-generic #49~20.04.1-Ubuntu SMP Wed May 18 18:44:28 UTC 2022 x86_64 65f714297c82 (none))"
prometheus-prometheus-1     | level=info ts=2022-06-11T02:12:17.038045055Z caller=main.go:228 fd_limits="(soft=1048576, hard=1048576)"
prometheus-prometheus-1     | level=info ts=2022-06-11T02:12:17.040298318Z caller=main.go:499 msg="Starting TSDB ..."
prometheus-prometheus-1     | level=info ts=2022-06-11T02:12:17.040338152Z caller=web.go:383 component=web msg="Start listening for connections" address=0.0.0.0:9090
prometheus-prometheus-1     | level=info ts=2022-06-11T02:12:17.044159356Z caller=main.go:509 msg="TSDB started"
prometheus-prometheus-1     | level=info ts=2022-06-11T02:12:17.04418791Z caller=main.go:585 msg="Loading configuration file" filename=/etc/prometheus/prometheus.yml
prometheus-prometheus-1     | level=info ts=2022-06-11T02:12:17.048291962Z caller=main.go:486 msg="Server is ready to receive web requests."
prometheus-prometheus-1     | panic: runtime error: slice bounds out of range
prometheus-prometheus-1     | 
prometheus-prometheus-1     | goroutine 316 [running]:
prometheus-prometheus-1     | github.com/prometheus/prometheus/vendor/github.com/miekg/dns.ClientConfigFromFile(0x1bfd5b1, 0x10, 0x0, 0x0, 0x0)
prometheus-prometheus-1     |   /go/src/github.com/prometheus/prometheus/vendor/github.com/miekg/dns/clientconfig.go:86 +0xad6
prometheus-prometheus-1     | github.com/prometheus/prometheus/discovery/dns.lookupWithSearchPath(0xc42032cb10, 0xe, 0x1, 0x28ef2c0, 0xc420dd2c60, 0xc4200914a0, 0x60, 0x0)
prometheus-prometheus-1     |   /go/src/github.com/prometheus/prometheus/discovery/dns/dns.go:246 +0x48
prometheus-prometheus-1     | github.com/prometheus/prometheus/discovery/dns.(*Discovery).refresh(0xc4201b6780, 0x290a240, 0xc4201b67c0, 0xc42032cb10, 0xe, 0xc420090ea0, 0x155d594, 0x2)
prometheus-prometheus-1     |   /go/src/github.com/prometheus/prometheus/discovery/dns/dns.go:174 +0x73
prometheus-prometheus-1     | github.com/prometheus/prometheus/discovery/dns.(*Discovery).refreshAll.func1(0xc4201b6780, 0x290a240, 0xc4201b67c0, 0xc420090ea0, 0xc420016e80, 0xc42032cb10, 0xe)
prometheus-prometheus-1     |   /go/src/github.com/prometheus/prometheus/discovery/dns/dns.go:163 +0x73
prometheus-prometheus-1     | created by github.com/prometheus/prometheus/discovery/dns.(*Discovery).refreshAll
prometheus-prometheus-1     |   /go/src/github.com/prometheus/prometheus/discovery/dns/dns.go:162 +0xd3
prometheus-prometheus-1 exited with code 2
prometheus-prometheus-1     | level=info ts=2022-06-11T02:12:17.962061071Z caller=main.go:225 msg="Starting Prometheus" version="(version=2.1.0, branch=HEAD, revision=85f23d82a045d103ea7f3c89a91fba4a93e6367a)"
prometheus-prometheus-1     | level=info ts=2022-06-11T02:12:17.962095343Z caller=main.go:226 build_context="(go=go1.9.2, user=root@6e784304d3ff, date=20180119-12:01:23)"
prometheus-prometheus-1     | level=info ts=2022-06-11T02:12:17.962105247Z caller=main.go:227 host_details="(Linux 5.13.0-44-generic #49~20.04.1-Ubuntu SMP Wed May 18 18:44:28 UTC 2022 x86_64 65f714297c82 (none))"
prometheus-prometheus-1     | level=info ts=2022-06-11T02:12:17.96211469Z caller=main.go:228 fd_limits="(soft=1048576, hard=1048576)"
prometheus-prometheus-1     | level=info ts=2022-06-11T02:12:17.964632811Z caller=main.go:499 msg="Starting TSDB ..."
prometheus-prometheus-1     | level=info ts=2022-06-11T02:12:17.967349007Z caller=web.go:383 component=web msg="Start listening for connections" address=0.0.0.0:9090
prometheus-prometheus-1     | level=info ts=2022-06-11T02:12:17.976956408Z caller=main.go:509 msg="TSDB started"
prometheus-prometheus-1     | level=info ts=2022-06-11T02:12:17.976978012Z caller=main.go:585 msg="Loading configuration file" filename=/etc/prometheus/prometheus.yml
prometheus-prometheus-1     | level=info ts=2022-06-11T02:12:17.977847651Z caller=main.go:486 msg="Server is ready to receive web requests."
prometheus-prometheus-1     | panic: runtime error: slice bounds out of range
prometheus-prometheus-1     | 
prometheus-prometheus-1     | goroutine 316 [running]:
prometheus-prometheus-1     | github.com/prometheus/prometheus/vendor/github.com/miekg/dns.ClientConfigFromFile(0x1bfd5b1, 0x10, 0x0, 0x0, 0x0)
prometheus-prometheus-1     |   /go/src/github.com/prometheus/prometheus/vendor/github.com/miekg/dns/clientconfig.go:86 +0xad6
prometheus-prometheus-1     | github.com/prometheus/prometheus/discovery/dns.lookupWithSearchPath(0xc420556270, 0xe, 0xc420950001, 0x28ef2c0, 0xc421028ae0, 0xc4209575c8, 0x458c80, 0xc42010f380)
prometheus-prometheus-1     |   /go/src/github.com/prometheus/prometheus/discovery/dns/dns.go:246 +0x48
prometheus-prometheus-1     | github.com/prometheus/prometheus/discovery/dns.(*Discovery).refresh(0xc42053a0c0, 0x290a240, 0xc42053a100, 0xc420556270, 0xe, 0xc420124600, 0xc420957778, 0x4741d4)
prometheus-prometheus-1     |   /go/src/github.com/prometheus/prometheus/discovery/dns/dns.go:174 +0x73
prometheus-prometheus-1     | github.com/prometheus/prometheus/discovery/dns.(*Discovery).refreshAll.func1(0xc42053a0c0, 0x290a240, 0xc42053a100, 0xc420124600, 0xc4201f3a20, 0xc420556270, 0xe)
prometheus-prometheus-1     |   /go/src/github.com/prometheus/prometheus/discovery/dns/dns.go:163 +0x73
prometheus-prometheus-1     | created by github.com/prometheus/prometheus/discovery/dns.(*Discovery).refreshAll
prometheus-prometheus-1     |   /go/src/github.com/prometheus/prometheus/discovery/dns/dns.go:162 +0xd3
prometheus-prometheus-1 exited with code 2
prometheus-prometheus-1     | level=info ts=2022-06-11T02:12:19.268107791Z caller=main.go:225 msg="Starting Prometheus" version="(version=2.1.0, branch=HEAD, revision=85f23d82a045d103ea7f3c89a91fba4a93e6367a)"
prometheus-prometheus-1     | level=info ts=2022-06-11T02:12:19.268140514Z caller=main.go:226 build_context="(go=go1.9.2, user=root@6e784304d3ff, date=20180119-12:01:23)"
prometheus-prometheus-1     | level=info ts=2022-06-11T02:12:19.268149497Z caller=main.go:227 host_details="(Linux 5.13.0-44-generic #49~20.04.1-Ubuntu SMP Wed May 18 18:44:28 UTC 2022 x86_64 65f714297c82 (none))"
prometheus-prometheus-1     | level=info ts=2022-06-11T02:12:19.268157011Z caller=main.go:228 fd_limits="(soft=1048576, hard=1048576)"
prometheus-prometheus-1     | level=info ts=2022-06-11T02:12:19.27019503Z caller=main.go:499 msg="Starting TSDB ..."
prometheus-prometheus-1     | level=info ts=2022-06-11T02:12:19.270209973Z caller=web.go:383 component=web msg="Start listening for connections" address=0.0.0.0:9090
prometheus-prometheus-1     | level=info ts=2022-06-11T02:12:19.276551691Z caller=main.go:509 msg="TSDB started"
prometheus-prometheus-1     | level=info ts=2022-06-11T02:12:19.276575684Z caller=main.go:585 msg="Loading configuration file" filename=/etc/prometheus/prometheus.yml
prometheus-prometheus-1     | panic: runtime error: slice bounds out of range
prometheus-prometheus-1     | 
prometheus-prometheus-1     | goroutine 266 [running]:
prometheus-prometheus-1     | github.com/prometheus/prometheus/vendor/github.com/miekg/dns.ClientConfigFromFile(0x1bfd5b1, 0x10, 0x0, 0x0, 0x0)
prometheus-prometheus-1     |   /go/src/github.com/prometheus/prometheus/vendor/github.com/miekg/dns/clientconfig.go:86 +0xad6
prometheus-prometheus-1     | github.com/prometheus/prometheus/discovery/dns.lookupWithSearchPath(0xc42031a3e0, 0xe, 0x400001, 0x28ef2c0, 0xc420ffef60, 0x7f142e99aa50, 0xc4201e4480, 0x29d9d40)
prometheus-prometheus-1     |   /go/src/github.com/prometheus/prometheus/discovery/dns/dns.go:246 +0x48
prometheus-prometheus-1     | github.com/prometheus/prometheus/discovery/dns.(*Discovery).refresh(0xc42013fc40, 0x290a240, 0xc42013fc80, 0xc42031a3e0, 0xe, 0xc4204c8240, 0x155d594, 0x2)
prometheus-prometheus-1     |   /go/src/github.com/prometheus/prometheus/discovery/dns/dns.go:174 +0x73
prometheus-prometheus-1     | github.com/prometheus/prometheus/discovery/dns.(*Discovery).refreshAll.func1(0xc42013fc40, 0x290a240, 0xc42013fc80, 0xc4204c8240, 0xc42031a010, 0xc42031a3e0, 0xe)
prometheus-prometheus-1     |   /go/src/github.com/prometheus/prometheus/discovery/dns/dns.go:163 +0x73
prometheus-prometheus-1     | created by github.com/prometheus/prometheus/discovery/dns.(*Discovery).refreshAll
prometheus-prometheus-1     |   /go/src/github.com/prometheus/prometheus/discovery/dns/dns.go:162 +0xd3
prometheus-prometheus-1 exited with code 2
prometheus-prometheus-1     | level=info ts=2022-06-11T02:12:21.384275376Z caller=main.go:225 msg="Starting Prometheus" version="(version=2.1.0, branch=HEAD, revision=85f23d82a045d103ea7f3c89a91fba4a93e6367a)"
prometheus-prometheus-1     | level=info ts=2022-06-11T02:12:21.384311163Z caller=main.go:226 build_context="(go=go1.9.2, user=root@6e784304d3ff, date=20180119-12:01:23)"
prometheus-prometheus-1     | level=info ts=2022-06-11T02:12:21.3843208Z caller=main.go:227 host_details="(Linux 5.13.0-44-generic #49~20.04.1-Ubuntu SMP Wed May 18 18:44:28 UTC 2022 x86_64 65f714297c82 (none))"
prometheus-prometheus-1     | level=info ts=2022-06-11T02:12:21.384329068Z caller=main.go:228 fd_limits="(soft=1048576, hard=1048576)"
prometheus-prometheus-1     | level=info ts=2022-06-11T02:12:21.385676072Z caller=main.go:499 msg="Starting TSDB ..."
prometheus-prometheus-1     | level=info ts=2022-06-11T02:12:21.385704699Z caller=web.go:383 component=web msg="Start listening for connections" address=0.0.0.0:9090
prometheus-prometheus-1     | level=info ts=2022-06-11T02:12:21.389219988Z caller=main.go:509 msg="TSDB started"
prometheus-prometheus-1     | level=info ts=2022-06-11T02:12:21.389242669Z caller=main.go:585 msg="Loading configuration file" filename=/etc/prometheus/prometheus.yml
prometheus-prometheus-1     | level=info ts=2022-06-11T02:12:21.390548672Z caller=main.go:486 msg="Server is ready to receive web requests."
prometheus-prometheus-1     | panic: runtime error: slice bounds out of range
prometheus-prometheus-1     | 
prometheus-prometheus-1     | goroutine 318 [running]:
prometheus-prometheus-1     | github.com/prometheus/prometheus/vendor/github.com/miekg/dns.ClientConfigFromFile(0x1bfd5b1, 0x10, 0x0, 0x0, 0x0)
prometheus-prometheus-1     |   /go/src/github.com/prometheus/prometheus/vendor/github.com/miekg/dns/clientconfig.go:86 +0xad6
prometheus-prometheus-1     | github.com/prometheus/prometheus/discovery/dns.lookupWithSearchPath(0xc42012f190, 0xe, 0x1, 0x28ef2c0, 0xc421014180, 0xc420212d80, 0x60, 0x0)
prometheus-prometheus-1     |   /go/src/github.com/prometheus/prometheus/discovery/dns/dns.go:246 +0x48
prometheus-prometheus-1     | github.com/prometheus/prometheus/discovery/dns.(*Discovery).refresh(0xc420446500, 0x290a240, 0xc420446540, 0xc42012f190, 0xe, 0xc420212900, 0x155d594, 0x2)
prometheus-prometheus-1     |   /go/src/github.com/prometheus/prometheus/discovery/dns/dns.go:174 +0x73
prometheus-prometheus-1     | github.com/prometheus/prometheus/discovery/dns.(*Discovery).refreshAll.func1(0xc420446500, 0x290a240, 0xc420446540, 0xc420212900, 0xc420198540, 0xc42012f190, 0xe)
prometheus-prometheus-1     |   /go/src/github.com/prometheus/prometheus/discovery/dns/dns.go:163 +0x73
prometheus-prometheus-1     | created by github.com/prometheus/prometheus/discovery/dns.(*Discovery).refreshAll
prometheus-prometheus-1     |   /go/src/github.com/prometheus/prometheus/discovery/dns/dns.go:162 +0xd3
prometheus-prometheus-1 exited with code 2
prometheus-alertmanager-1   | ts=2022-06-11T02:12:24.115Z caller=cluster.go:697 level=info component=cluster msg="gossip settled; proceeding" elapsed=10.003316232s
^CGracefully stopping... (press Ctrl+C again to force)
[+] Running 5/5
 ⠿ Container prometheus-node-exporter-1  Stopp...                                        0.5s
 ⠿ Container prometheus-grafana-1        Stopped                                         0.9s
 ⠿ Container prometheus-prometheus-1     Stopped                                         0.4s
 ⠿ Container prometheus-alertmanager-1   Stoppe...                                       0.4s
 ⠿ Container prometheus-cadvisor-1       Stopped                                         0.5s
canceled

最后,我CTRL+C作为普罗米修斯继续重新启动。所有其他的服务都起作用。

The docker-compose.yaml

代码语言:javascript
复制
version: '3.7'

volumes:
    prometheus_data: {}
    grafana_data: {}

networks:
  front-tier:
  back-tier:

services:

  prometheus:
    image: prom/prometheus:v2.1.0
    volumes:
      - ./prometheus/:/etc/prometheus/
      - prometheus_data:/prometheus
    command:
      - '--config.file=/etc/prometheus/prometheus.yml'
      - '--storage.tsdb.path=/prometheus'
      - '--web.console.libraries=/usr/share/prometheus/console_libraries'
      - '--web.console.templates=/usr/share/prometheus/consoles'
    ports:
      - 9090:9090
    links:
      - cadvisor:cadvisor
      - alertmanager:alertmanager
#      - pushgateway:pushgateway
    depends_on:
      - cadvisor
#      - pushgateway
    networks:
      - back-tier
    restart: always
#    deploy:
#      placement:
#        constraints:
#          - node.hostname == ${HOSTNAME}

  node-exporter:
    image: prom/node-exporter
    volumes:
      - /proc:/host/proc:ro
      - /sys:/host/sys:ro
      - /:/rootfs:ro
    command: 
      - '--path.procfs=/host/proc' 
      - '--path.sysfs=/host/sys'
      - --collector.filesystem.ignored-mount-points
      - "^/(sys|proc|dev|host|etc|rootfs/var/lib/docker/containers|rootfs/var/lib/docker/overlay2|rootfs/run/docker/netns|rootfs/var/lib/docker/aufs)($$|/)"
    ports:
      - 9100:9100
    networks:
      - back-tier
    restart: always
    deploy:
      mode: global

  alertmanager:
    image: prom/alertmanager
    ports:
      - 9093:9093
    volumes:
      - ./alertmanager/:/etc/alertmanager/
    networks:
      - back-tier
    restart: always
    command:
      - '--config.file=/etc/alertmanager/config.yml'
      - '--storage.path=/alertmanager'
#    deploy:
#      placement:
#        constraints:
#          - node.hostname == ${HOSTNAME}
  cadvisor:
    image: gcr.io/cadvisor/cadvisor
    volumes:
      - /:/rootfs:ro
      - /var/run:/var/run:rw
      - /sys:/sys:ro
      - /var/lib/docker/:/var/lib/docker:ro
    ports:
      - 8080:8080
    networks:
      - back-tier
    restart: always
    deploy:
      mode: global

  grafana:
    image: grafana/grafana
    user: "472"
    depends_on:
      - prometheus
    ports:
      - 3000:3000
    volumes:
      - grafana_data:/var/lib/grafana
      - ./grafana/provisioning/:/etc/grafana/provisioning/
    env_file:
      - ./grafana/config.monitoring
    networks:
      - back-tier
      - front-tier
    restart: always

#  pushgateway:
#    image: prom/pushgateway
#    restart: always
#    expose:
#      - 9091
#    ports:
#      - "9091:9091"
#    networks:
#      - back-tier

The prometheus.yml

代码语言:javascript
复制
# my global config
global:
  scrape_interval:     15s # By default, scrape targets every 15 seconds.
  evaluation_interval: 15s # By default, scrape targets every 15 seconds.
  # scrape_timeout is set to the global default (10s).

  # Attach these labels to any time series or alerts when communicating with
  # external systems (federation, remote storage, Alertmanager).
  external_labels:
      monitor: 'my-project'

# Load and evaluate rules in this file every 'evaluation_interval' seconds.
rule_files:
  - 'alert.rules'
  # - "first.rules"
  # - "second.rules"

# alert
alerting:
  alertmanagers:
  - scheme: http
    static_configs:
    - targets:
      - "alertmanager:9093"

# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.

  - job_name: 'prometheus'

    # Override the global default and scrape targets from this job every 5 seconds.
    scrape_interval: 5s

    static_configs:
         - targets: ['localhost:9090']


  - job_name: 'cadvisor'

    # Override the global default and scrape targets from this job every 5 seconds.
    scrape_interval: 5s

    dns_sd_configs:
    - names:
      - 'tasks.cadvisor'
      type: 'A'
      port: 8080

#     static_configs:
#          - targets: ['cadvisor:8080']

  - job_name: 'node-exporter'

    # Override the global default and scrape targets from this job every 5 seconds.
    scrape_interval: 5s

    dns_sd_configs:
    - names:
      - 'tasks.node-exporter'
      type: 'A'
      port: 9100

#  - job_name: 'pushgateway'
#    scrape_interval: 10s
#    dns_sd_configs:
#    - names:
#      - 'tasks.pushgateway'
#      type: 'A'
#      port: 9091

#     static_configs:
#          - targets: ['node-exporter:9100']

不知道是怎么回事,但我觉得奇怪的是,它不能在两个不同的环境(我的笔记本电脑上的虚拟盒VM和Google实例)上正确运行。所有文件都可以在https://github.com/vegasbrianc/prometheus.git的Prometheus git存储库中找到。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-06-13 20:28:19

当我转到舞会/普罗米修斯:最新的图片,它工作。没有解释为什么它不起作用,但万一有人在寻找一个潜在的解决办法。在船坞-Compose.yml中:

代码语言:javascript
复制
services:

  prometheus:
    image: prom/prometheus:latest
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72581370

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档