首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >将Prometheus部署到Cloud Foundry

将Prometheus部署到Cloud Foundry
EN

Stack Overflow用户
提问于 2017-02-22 04:13:51
回答 3查看 1.6K关注 0票数 3

我想在不使用Docker容器的情况下将Prometheus部署到Cloud Foundry。当我尝试使用标准Cloud Foundry Go Buildpack部署它时,我得到以下错误:

代码语言:javascript
复制
can't load package: package prometheus: no buildable Go source files in /tmp/tmp.vv4iyDzMvE/.go/src/prometheus

这在某种程度上是有道理的,因为在根目录中实际上没有源代码,并且项目是使用Prometheus实用工具编译的。

有没有办法将Prometheus部署到Cloud Foundry,就像使用另一个Buildpack之类的方法?

EN

回答 3

Stack Overflow用户

发布于 2017-02-23 21:17:29

普罗米修斯是个TSDB。并且它打算消耗千兆字节和千兆字节的数据。

在Cloud Foundry平台上,您受到可用资源的限制。那么,为什么要将Prometheus部署到Cloud Foundry呢?

为什么不启动一个独立的bosh director,并通过指挥部署Prometheus作为Bosh部署和独立部署。然后将其作为杯子注入Cloud Foundry?

我只是好奇,并试图理解用例。

票数 1
EN

Stack Overflow用户

发布于 2018-06-08 01:32:29

我也有同样的问题,但(就在今天)想出了一个稍微不同的解决方案,这对我来说似乎更容易。

我使用的是prometheus-2.2.1-linux-amd64二进制构建。

我修改了prometheus.yml以使用默认端口8080作为目标(最后一行):

代码语言:javascript
复制
    # 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

代码语言:javascript
复制
---
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个文件发生更改,这是:

代码语言:javascript
复制
cf push

现在,我让prometheus在我的Pivotal Web Services空间中运行。

票数 1
EN

Stack Overflow用户

发布于 2017-02-23 00:16:31

好的,在深入研究了一下之后,我得到了整个事情的工作原理如下

manifest.yml

代码语言:javascript
复制
---
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文件中

代码语言:javascript
复制
port := ":9090"
if s := os.Getenv("PORT"); s != "" {
    port = ":"+s
}

然后更改以下部分(也在init()函数中)

代码语言:javascript
复制
cfg.fs.StringVar(
    &cfg.web.ListenAddress, "web.listen-address", ":9090",
    "Address to listen on for the web interface, API, and telemetry.",
)

代码语言:javascript
复制
cfg.fs.StringVar(
    &cfg.web.ListenAddress, "web.listen-address", port,
    "Address to listen on for the web interface, API, and telemetry.",
)

之后,您可以简单地使用cf push部署应用程序,一切都应该非常出色

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

https://stackoverflow.com/questions/42377057

复制
相关文章

相似问题

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