Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploy Prometheus to Cloud Foundry

I want to deploy Prometheus to Cloud Foundry without using Docker container. When I try to deploy it with the standard Cloud Foundry Go Buildpack I get the following error:

can't load package: package prometheus: no buildable Go source files in /tmp/tmp.vv4iyDzMvE/.go/src/prometheus

Which somehow makes sense, because there are actually no sources in the root directory and the project is compiled with the Prometheus utility tool.

Is there any way to deploy Prometheus to Cloud Foundry, like using another Buildpack or something?

like image 462
wastl Avatar asked Jul 14 '26 22:07

wastl


2 Answers

I had the same question, but (just today) came up with a slightly different solution, that seemed easier to me.

I used the prometheus-2.2.1-linux-amd64 binary build.

I modified the prometheus.yml to use the default port 8080 as a target (last line):

    # 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

Then I added a 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

That is using the binary-buildpack, and tells prometheus to startup the server listening on port 8080.

2 files changes and this:

cf push

Now I have prometheus running in my space on Pivotal Web Services.

like image 193
DaShaun Avatar answered Jul 18 '26 08:07

DaShaun


Prometheus is a TSDB. And it is intended to consume gigabytes and gigabytes of data.

On a Cloud Foundry platform, you are limited by available resources. So, why deploy Prometheus to Cloud Foundry?

Why not spin up a standalone bosh director and deploy Prometheus through the director as a Bosh deployment, and a standalone. Then inject it as a CUPS into Cloud Foundry?

I am just curious and trying to understand the use case.

like image 26
K.AJ Avatar answered Jul 18 '26 08:07

K.AJ



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!