gpt4 book ai didi

go - 将 Prometheus 部署到 Cloud Foundry

转载 作者:IT王子 更新时间:2023-10-29 01:12:52 26 4
gpt4 key购买 nike

我想在不使用 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 之类的?

最佳答案

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

我使用了 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

然后我添加了一个ma​​nifest.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

那是使用 binary-buildpack,并告诉 prometheus 启动监听端口 8080 的服务器。

2 个文件更改和此:

cf push

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

关于go - 将 Prometheus 部署到 Cloud Foundry,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42377057/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com