我想在不使用Docker容器的情况下将Prometheus部署到Cloud Foundry。当我尝试使用标准Cloud Foundry Go Buildpack部署它时,我得到以下错误:
can't load package: package prometheus: no buildable Go source files in /tmp/tmp.vv4iyDzMvE/.go/src/prometheus这在某种程度上是有道理的,因为在根目录中实际上没有源代码,并且项目是使用Prometheus实用工具编译的。
有没有办法将Prometheus部署到Cloud Foundry,就像使用另一个Buildpack之类的方法?
发布于 2017-02-23 21:17:29
普罗米修斯是个TSDB。并且它打算消耗千兆字节和千兆字节的数据。
在Cloud Foundry平台上,您受到可用资源的限制。那么,为什么要将Prometheus部署到Cloud Foundry呢?
为什么不启动一个独立的bosh director,并通过指挥部署Prometheus作为Bosh部署和独立部署。然后将其作为杯子注入Cloud Foundry?
我只是好奇,并试图理解用例。
发布于 2018-06-08 01:32:29
我也有同样的问题,但(就在今天)想出了一个稍微不同的解决方案,这对我来说似乎更容易。
我使用的是prometheus-2.2.1-linux-amd64二进制构建。
我修改了prometheus.yml以使用默认端口8080作为目标(最后一行):
# my global config
global:
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
# scrape_timeout is set to the global default (10s).
# Alertmanager configuration
alerting:
alertmanagers:
- static_configs:
- targets:
# - alertmanager:9093
# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
# - "first_rules.yml"
# - "second_rules.yml"
# 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'
# metrics_path defaults to '/metrics'
# scheme defaults to 'http'.
static_configs:
- targets: ['localhost:8080'] ###### Only changed this line然后我添加了一个manifest.yml
---
applications:
- name: prometheus
instances: 1
buildpack: https://github.com/cloudfoundry/binary-buildpack.git
command: ./prometheus --config.file=prometheus.yml --web.listen-address=:8080 --web.enable-admin-api
memory: 1024M
random-route: true这是使用二进制构建包,并告诉普罗米修斯启动服务器监听端口8080。
2个文件发生更改,这是:
cf push现在,我让prometheus在我的Pivotal Web Services空间中运行。
发布于 2017-02-23 00:16:31
好的,在深入研究了一下之后,我得到了整个事情的工作原理如下
manifest.yml
---
applications:
- name: prometheus
instances: 1
buildpack: https://github.com/cloudfoundry/go-buildpack.git
command: prometheus
env:
GOPACKAGENAME: github.com/prometheus/prometheus
GO_INSTALL_PACKAGE_SPEC: github.com/prometheus/prometheus/cmd/prometheus
memory: 1000M但是为了侦听正确的端口,我能找到的唯一解决方案是在init()函数的开头添加以下代码到cmd/prometheus/config.go文件中
port := ":9090"
if s := os.Getenv("PORT"); s != "" {
port = ":"+s
}然后更改以下部分(也在init()函数中)
cfg.fs.StringVar(
&cfg.web.ListenAddress, "web.listen-address", ":9090",
"Address to listen on for the web interface, API, and telemetry.",
)至
cfg.fs.StringVar(
&cfg.web.ListenAddress, "web.listen-address", port,
"Address to listen on for the web interface, API, and telemetry.",
)之后,您可以简单地使用cf push部署应用程序,一切都应该非常出色
https://stackoverflow.com/questions/42377057
复制相似问题